stacktrace
stacktrace copied to clipboard
boost_stacktrace_addr2line does not build
Hello, I'm trying to cross build boost for M1 on an Intel mac. Everything goes fine, except addr2line does not build. From the configuration check, it shows
- libbacktrace builds : no [2]
- libbacktrace builds : no [3]
- addr2line builds : no [2]
- addr2line builds : no [3]
below is my script
chmod u+x bootstrap.sh tools/build/src/engine/build.sh
./bootstrap.sh --with-python=/usr/bin/python3
./b2 install architecture=arm \
"cxxflags=-std=c++17 -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -mmacosx-version-min=11.0" \
"cflags=-arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -mmacosx-version-min=11.0" \
"linkflags=-arch arm64 -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -mmacosx-version-min=11.0" \
--prefix=prefix abi=aapcs
building environment
- operating system: macOS 12.0.1
- Xcode version: 12.4
It seems that macOS doesn't have addr2line at /usr/bin/addr2line. I'm wondering how does boost check for addr2line builds. Moreover, building boost natively (either on intel or M1) and cross building for x86_64 on M1 all generate boost_stacktrace_addr2line. Is it the limitation on intel mac for cross building?
I got a similar problem when cross building for Android. The cause seems to be that the build script detects addr2line and libbacktrace by trying to compile and run some C++ code
https://github.com/boostorg/stacktrace/blob/75b7986f9799184ecd679d86273532cb54e6a0dc/build/Jamfile.v2#L42-L52
Unfortunately, as we are cross compiling, the code is built for the target system and won't run on host system.
Error log from config.log:
/bin/sh: 2: <redacted>/boost/bin.v2/libs/stacktrace/build/clng-lnx-7/dbg/lnk-sttc/nm-on/trgt-os-andrd/thrd-mlt/vsblt-hdn/ libbacktrace_exe: Exec format error
...removing <redacted>/boost/bin.v2/libs/stacktrace/build/clng-lnx-7/dbg/lnk-sttc/nm-on/trgt-os-andrd/thrd-mlt/vsblt-hdn/ libbacktrace.output
...failed updating 1 target...
/bin/sh: 2: <redacted>/boost/bin.v2/libs/stacktrace/build/clng-lnx-7/dbg/lnk-sttc/nm-on/trgt-os-andrd/thrd-mlt/vsblt-hdn/ addr2line_exe: Exec format error
...removing <redacted>/boost/bin.v2/libs/stacktrace/build/clng-lnx-7/dbg/lnk-sttc/nm-on/trgt-os-andrd/thrd-mlt/vsblt-hdn/ addr2line.output
...failed updating 1 target...