Hey folks, not sure what I’m doing wrong here. I’m attempting to build a CMake project, github .com/duckdb/duckdb_spatial for Android and am failing to set linker options for a dependency.
The project uses a Makefile to kick off its build. So in order to do the simplest thing that could possibly work, I add a simple build target pointing to the hard-coded NDK rules path on my system:
android_release:
mkdir -p build/release/android && \
cmake $(GENERATOR) $(BUILD_FLAGS) $(CLIENT_FLAGS) -DCMAKE_BUILD_TYPE=Release -S ./duckdb/ -DCMAKE_TOOLCHAIN_FILE=/home/nolan/android/android-ndk-r27c/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a -B build/release/android && \
cmake --build build/release/android --config Release
Running that gives me this:
[ 40%] Linking C shared library libz.so
ld.lld: error: version script assignment of 'local' to symbol 'gz_intmax' failed: symbol not defined
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The solution (github .com/llvm/llvm-project/issues/75056, edited because I exceeded the number of links I can post) seems to involve adding -Wl,--undefined-version
to my linker flags and nothing I do seems to achieve that. Things I’ve tried:
LDFLAGS="-Wl,--undefined-version" make android_release
- Adding
-DLDFLAGS=-Wl,--undefined-version
or-DCMAKE_LDFLAGS=-Wl,--undefined-version
to the new android_release target defined above - Adding the above
-D
flags here - Adding
add_link_options(-Wl,--undefined-version)
here
Nothing makes a difference and this compilation error persists. zlib is added as an external project vendored in the source tree, and appears to be built via cmake as well. How do I add a linker option that isn’t another library to the zlib project? Bonus points if I can scope the option specifically to Android builds.
Thanks.