google / sandboxed-api

Generate sandboxes for C/C++ libraries automatically
https://developers.google.com/sandboxed-api/
Apache License 2.0
1.65k stars 189 forks source link

Linking issue with libunwind and zlib on aarch64 #169

Open gbryant-arm opened 11 months ago

gbryant-arm commented 11 months ago

On arm and aarch64, libunwind is configured to use debug frames (CONFIG_DEBUG_FRAME), but this feature requires zlib. This is what happens when building sandboxed-api on aarch64:

...
[ 89%] Linking CXX executable forkserver_bin
/usr/bin/ld: ../../libunwind_ptrace.a(Gfind_proc_info-lsb.c.o): in function `load_debug_frame':
Gfind_proc_info-lsb.c:(.text+0x157c): undefined reference to `uncompress'
collect2: error: ld returned 1 exit status
make[2]: *** [sandboxed_api/sandbox2/CMakeFiles/sandbox2_forkserver_bin.dir/build.make:197: sandboxed_api/sandbox2/forkserver_bin] Error 1
make[1]: *** [CMakeFiles/Makefile2:9407: sandboxed_api/sandbox2/CMakeFiles/sandbox2_forkserver_bin.dir/all] Error 2

Looks like neither libunwind nor sandboxed-api resolves the zlib symbols. As a dirty workaround I've added z to target_link_libraries in cmake/libunwind.cmake.

Can anyone confirm it's a bug?

To reproduce

Run this on aarch64:

git clone --recursive https://github.com/google/sandboxed-api
mkdir build
cd build
cmake ..
make -j 8