Opened 6 years ago
Last modified 6 years ago
#12616 new Bugs
Cannot build boost 1.62 for x32 ABI
Reported by: | Owned by: | ||
---|---|---|---|
Milestone: | To Be Determined | Component: | Building Boost |
Version: | Boost 1.62.0 | Severity: | Problem |
Keywords: | Cc: |
Description
To build boost for the X32 ABI (which is x86-64 but with 32-bit pointers) we set CFLAGS to -mx32.
However boost then decides that it knows best and also passes in -march=i686 -m32.
For example:
| "x86_64-poky-linux-gnux32-g++" "-mx32" "-Wl,-O1" "-Wl,--hash-style=gnu" "-Wl,--as-needed" "--sysroot=/data/poky-master/tmp-glibc/sysroots/intel-corei7-64" -ftemplate-depth-128 -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/data/poky-master/tmp-glibc/work/x86_64_x32-poky-linux-gnux32/boost/1.62.0-r1=/usr/src/debug/boost/1.62.0-r1 -fdebug-prefix-map=/data/poky-master/tmp-glibc/sysroots/x86_64-linux= -fdebug-prefix-map=/data/poky-master/tmp-glibc/sysroots/intel-corei7-64= -fvisibility-inlines-hidden -O3 -finline-functions -Wno-inline -Wall -march=i686 -pthread -fPIC -m32 -DBOOST_ALL_NO_LIB=1 -DBOOST_FILESYSTEM_DYN_LINK=1 -DBOOST_SYSTEM_DYN_LINK=1 -DNDEBUG -I"." -c -o "/data/poky-master/tmp-glibc/work/x86_64_x32-poky-linux-gnux32/boost/1.62.0-r1/boost_1_62_0/x86_64-poky-linux-gnux32/boost/bin.v2/libs/filesystem/build/aca09349fdb84d131321425f6c3a38ed/windows_file_codecvt.o" "libs/filesystem/src/windows_file_codecvt.cpp" | | In file included from /data/poky-master/tmp-glibc/sysroots/intel-corei7-64/usr/include/features.h:392:0, | from /data/poky-master/tmp-glibc/sysroots/intel-corei7-64/usr/include/c++/6.2.0/x86_64-poky-linux-gnux32/bits/os_defines.h:39, | from /data/poky-master/tmp-glibc/sysroots/intel-corei7-64/usr/include/c++/6.2.0/x86_64-poky-linux-gnux32/bits/c++config.h:495, | from /data/poky-master/tmp-glibc/sysroots/intel-corei7-64/usr/include/c++/6.2.0/cstddef:49, | from ./boost/config/compiler/gcc.hpp:165, | from ./boost/config.hpp:39, | from ./boost/filesystem/config.hpp:28, | from libs/filesystem/src/windows_file_codecvt.cpp:20: | /data/poky-master/tmp-glibc/sysroots/intel-corei7-64/usr/include/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file or directory | # include <gnu/stubs-32.h>
The -mx32 is our CFLAGS. -m32 -march=i686 is from boost/tools/build. The compiler ends up thinking that its doing a i686 build and tries to open stubs-32.h which doesn't exist as this sysroot is x32 so only stubs-x32.h is present.
Change History (3)
comment:1 by , 6 years ago
Component: | None → Building Boost |
---|
comment:2 by , 6 years ago
In an attempt to have less magic I added the flags line to gcc.jam in build:
diff --git a/src/tools/gcc.py b/src/tools/gcc.py index 270ca97..f31f4ef 100644 --- a/src/tools/gcc.py +++ b/src/tools/gcc.py @@ -746,2 +746,3 @@ def cpu_flags(toolset, variable, architecture, instruction_set, values, default= flags('gcc', 'OPTIONS', ['<architecture>x86/<address-model>32'], ['-m32']) +flags('gcc', 'OPTIONS', ['<architecture>x86/<address-model>32_64'], ['-mx32']) flags('gcc', 'OPTIONS', ['<architecture>x86/<address-model>64'], ['-m64'])
Then passed address-model=32_64 to my externally built jam (we're cross-compiling).
It's passing less stupid options now:
| "x86_64-poky-linux-gnux32-g++" "-mx32" "-Wl,-O1" "-Wl,--hash-style=gnu" "-Wl,--as-needed" "--sysroot=/data/poky-master/tmp-glibc/sysroots/intel-corei7-64" -ftemplate-depth-128 -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/data/poky-master/tmp-glibc/work/x86_64_x32-poky-linux-gnux32/boost/1.62.0-r1=/usr/src/debug/boost/1.62.0-r1 -fdebug-prefix-map=/data/poky-master/tmp-glibc/sysroots/x86_64-linux= -fdebug-prefix-map=/data/poky-master/tmp-glibc/sysroots/intel-corei7-64= -fvisibility-inlines-hidden -O3 -finline-functions -Wno-inline -Wall -pedantic -pthread -fPIC -DBOOST_ALL_NO_LIB=1 -DBOOST_REGEX_DYN_LINK=1 -DNDEBUG -I"." -c -o "/data/poky-master/tmp-glibc/work/x86_64_x32-poky-linux-gnux32/boost/1.62.0-r1/boost_1_62_0/x86_64-poky-linux-gnux32/boost/bin.v2/libs/regex/build/8b5ffabbece29b037869af5264487af2/winstances.o" "libs/regex/build/../src/winstances.cpp"
Now it fails differently:
libs/context/src/unsupported.cpp:7:2: error: #error "platform not supported" #error "platform not supported"
Presumably because this new 32_64 address-model doesn't match the build rules for context which use a 64-bit address-model but abi to mark x32:
# X86_64/SYSV/X32 alias asm_context_sources : [ make asm/make_x86_64_sysv_elf_gas.o : asm/make_x86_64_sysv_elf_gas.S : @gas64 ] [ make asm/jump_x86_64_sysv_elf_gas.o : asm/jump_x86_64_sysv_elf_gas.S : @gas64 ] [ make asm/ontop_x86_64_sysv_elf_gas.o : asm/ontop_x86_64_sysv_elf_gas.S : @gas64 ] : <abi>x32 <address-model>64 <architecture>x86 <binary-format>elf ;
comment:3 by , 6 years ago
Ahh, I misunderstood about address-model feature, 32_64 is for the OS X fat binary at this time.
Hmm, it needs changing both of build and context, build should provide 'abi' feature (or address-model) and update setup-address-model, and context should change that requirements.
Try following.