Building for iOS

Hi! I’m stuck with some missing symbols when trying to build for iOS. I’ve attached the items below. I built the libraries with the following commands:
git clone git@github.com:CesiumGS/cesium-native.git
cd cesium-native
cmake -B build-ios -S . -GXcode -DCMAKE_TOOLCHAIN_FILE=“unreal-ios-toolchain.cmake” -DCMAKE_BUILD_TYPE=Release -DCMAKE_XCODE_ATTRIBUTE_ARCHS=arm64 -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY=1,2

– I go into the Xcode project here and set the development team and set the destination target to the “My Mac (Designed for iPad)” just to get the iOS/Arm binaries built and then run the ALL_BUILD target which does build all of the cesium native libraries ok. Then I bring those libraries into my test project and I’ve built all the other dependency libraries ok, but something about the S2 and Abseil libraries just won’t build ok. I’ve tried building them separately, I’ve tried to set the namespace values, etc, but even when I bring all of the S2/abseil source into my test app, I still run into issues with what looks like the “absl::lts_20240722::string_view” parameter. In any case, just curious if there’s some thoughts about how to get cesium native running ok on iOS. Thank you!

Showing Recent Errors Only

Undefined symbol: absl::lts_20240722::log_internal::LogMessageFatal::LogMessageFatal(char const*, int, absl::lts_20240722::string_view)

Undefined symbol: std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>* absl::lts_20240722::log_internal::MakeCheckOpString<long long, long long>(long long, long long, char const*)

Undefined symbol: std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>* absl::lts_20240722::log_internal::MakeCheckOpString<unsigned long long, unsigned long long>(unsigned long long, unsigned long long, char const*)

Undefined symbol: S2CellId::FromToken(absl::lts_20240722::string_view)

Undefined symbol: operator<<(std::__1::basic_ostream<char, std::__1::char_traits>&, S1Angle)

Undefined symbol: ___size_returning_new

Hi @Malcolm_Toon, welcome to the community!

I don’t have a direct answer for you, except to say that I feel your pain. Abseil can be a real hassle like this. The problem is that it adapts itself to your compilation environment. So if you compile cesium-native in one compilation environment, and then try to use it in a project that uses a slightly different one, you may get a very different Abseil configuration, which will cause linker errors like this. For example, are you using the same version of C++ everywhere? cesium-native is configured to use C++20.

Beyond that, I can’t offer much specific advice. But perhaps if you can put together a minimal project that demonstrates the problem and share it with us, we might be able to help you get it working.

Hi! Thanks for the response. I found a (very janky, but working!) work-around where I can ask vpcpkg to build for arm64-ios and then I just copy the libraries from it’s cache to my project. that’s working well. I also realized I was trying to build abseil first and then S2 (which is what uses it) and using vcpkg to build S2, it builds the correct abseil as a dependency, so that fixed that last bit. Finally, after all of that, I was able to build native and debug within Xcode, so that’s where I was trying to get to. Once I have time, I’m planning on looping back around and I’d like to clean up the build chain to make it more straightforward. Thanks again!