In an Android project, we are using a static library (mainly boost) which is built on Mac, using clang and NDK 17. Under Mac, the project builds fine.
But now we have a developer that is working on Windows, and he gets a bunch of undefined reference errors, like the compiler is not finding the library:
C/C++: ../../../../../../libs/android/include\boost/filesystem/v3/operations.hpp:289: error: undefined reference to 'boost::filesystem3::detail::status(boost::filesystem3::path const&, boost::system::error_code*)'
C/C++: clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)
My understanding was that a static library for Android (for any cross-compiled platform actually) would work always, given that the compiler remains in the same version, no matter the host platform.
We are using NDK 17's clang and the project is setup with CMake. The project structure is the same in both systems, and the library is contained in a subfolder of the project.
So, assuming all compiler flags are the same, compiler version numbers are the same and the libraries are correctly found, my questions are:
- Can an Android library built on a Mac host be used from a Windows host using the same NDK version? Or must it be rebuilt?
- And more in general, can a library built in a cross-platform way on a particular host for a particular target, be used in a different host for the same particular target? Or must it be rebuilt?
Edit: The library is correctly included into the compiler command:
clang++.exe [...] lib/arm64-v8a/libboost_thread.a lib/arm64-v8a/libboost_system.a lib/arm64-v8a/libboost_filesystem.a [...]