Cannot build on Windows for ARM64: error on init_priority attribute.
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- cmake, cpp
- Domain
- build-system
Research direction
Start with libs/filesystem/CMakeLists.txt and libs/nowide/CMakeLists.txt, then inspect config/check_attribute_init_priority.cpp and the existing CMAKE_REQUIRED_FLAGS handling in libs/atomic/CMakeLists.txt and libs/log/CMakeLists.txt. Reproduce the check with the aarch64-w64-mingw32 compiler and verify that the configuration test rejects the ignored attribute warning and the Windows ARM64 build no longer fails later.
Written by the indexing model from the issue text.
Description
I tried to compile Boost libraries with aarch64-w64-mingw32 cross compiler.
Unfortunately, the build process failed after a while with this error message:
boost-1.90.0-1.noarch/src/boost-1.90.0/libs/nowide/src/iostream.cpp:148:70: error: 'init_priority' attribute ignored [-Werror=attributes]
148 | #define BOOST_NOWIDE_INIT_PRIORITY __attribute__((init_priority(101)))
| ^
At the time of writing, the support for init_priority is tested into two CMakeLists.txt files:
- libs/filesystem/CMakeLists.txt
- libs/nowide/CMakeLists.txt
Inside these scripts, check_cxx_source_compiles() is used.
These calls check if the test compiles fine and they define BOOST_NOWIDE_HAS_INIT_PRIORITY and BOOST_FILESYSTEM_HAS_INIT_PRIORITY if everything looks ok.
However, these tests do not fail if there is a just warning.
For example, I tried to compile the test source myself and I got this:
$ aarch64-w64-mingw32-g++ boost-1.90.0-1.noarch/src/boost-1.90.0/libs/nowide/config/check_attribute_init_priority.cpp -c -o c.o
boost-1.90.0-1.noarch/src/boost-1.90.0/libs/nowide/config/check_attribute_init_priority.cpp:9:43: warning: 'init_priority' attribute ignored [-Wattributes]
9 | Foo foo __attribute__((init_priority(101)));
| ^
So, for CMake the test was good anyways.
The problem comes out because the -Werror option, which makes the build process to fail later.
I have not enough knowledge at the moment, but I can see these two solutions:
Adding -Wno-error=attributes (if supported) when building those libraries, or
Adding -Werror (if supported) when compiling the tests with check_cxx_source_compiles().
This issue happens when building for Windows on ARM64 with GCC.
The i686-w64-mingw32 and x86_64-w64-mingw32 cross compilers also work with that attribute, but they don't emit any warning and that's why this issue was not seen before.
I hope that you will find this report useful.
EDIT: it looks like these scripts already handle CMAKE_REQUIRED_FLAGS before calling check_cxx_source_compiles():
- libs/atomic/CMakeLists.txt
- libs/log/CMakeLists.txt
Probably, it would be enough to follow the same way for adding the needed option.
- Dominant language
- HTML
- Stars
- 8.6k
- Forks
- 2k
- Avg merge
- 9h 35m
- Merged PRs (30d)
- 1
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from boostorg/boost
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 3/5 1-2 days Newbie friendliness 52/100
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
-
CI: pin OS images in build/publish tests instead of `*-latest`Possibly taken @shikhabhadoria claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
vacanza/holidays#4220 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Niko1221/Strata#6731 · 2 comments ·
Maintainers usually reply within 6 days
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
dependencies go good first issue priority: medium
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
fukubie/StockLlama#48 ·