diff --git a/CHANGELOG.md b/CHANGELOG.md index 546ae994..ad592065 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,9 @@ - Fix background transaction pre-empt on foreground record open - ProtectedStore is now exported correctly through the VeilidAPI object and the old reust interface is removed. Switch to accessing ProtectedStore through VeilidAPI. +- veilid-flutter: + - Fix missing symbols for iOS release builds. + - veilid-python: - More tests diff --git a/scripts/ios_build.sh b/scripts/ios_build.sh index 19e11be9..af196090 100755 --- a/scripts/ios_build.sh +++ b/scripts/ios_build.sh @@ -68,7 +68,9 @@ do HOMEBREW_DIR=$(dirname `which brew`) fi - env -i PATH=/usr/bin:/bin:$HOMEBREW_DIR:$CARGO_DIR HOME="$HOME" USER="$USER" IPHONEOS_DEPLOYMENT_TARGET="$IPHONEOS_DEPLOYMENT_TARGET" ${RUST_ENV[@]+"${RUST_ENV[@]}"} cargo $CARGO_TOOLCHAIN build $EXTRA_CARGO_OPTIONS --target $CARGO_TARGET --manifest-path $CARGO_MANIFEST_PATH + # staticlib alone: built alongside cdylib, LTO internalizes the #[no_mangle] FFI exports out of the archive + # (rustc needs one package, so -p selects it out of the virtual workspace manifest; crate name uses dashes) + env -i PATH=/usr/bin:/bin:$HOMEBREW_DIR:$CARGO_DIR HOME="$HOME" USER="$USER" IPHONEOS_DEPLOYMENT_TARGET="$IPHONEOS_DEPLOYMENT_TARGET" ${RUST_ENV[@]+"${RUST_ENV[@]}"} cargo $CARGO_TOOLCHAIN rustc $EXTRA_CARGO_OPTIONS -p "${PACKAGE_NAME//_/-}" --lib --crate-type staticlib --target $CARGO_TARGET --manifest-path $CARGO_MANIFEST_PATH LIPOS="$LIPOS $TARGET_PATH/$CARGO_TARGET/$BUILD_MODE/lib$PACKAGE_NAME.a" diff --git a/veilid-flutter/example/ios/Runner.xcodeproj/project.pbxproj b/veilid-flutter/example/ios/Runner.xcodeproj/project.pbxproj index 7fa30302..726ed1ce 100644 --- a/veilid-flutter/example/ios/Runner.xcodeproj/project.pbxproj +++ b/veilid-flutter/example/ios/Runner.xcodeproj/project.pbxproj @@ -384,6 +384,7 @@ "OTHER_LDFLAGS[sdk=iphoneos*]" = ( "$(inherited)", "-Wl,-force_load,$(SRCROOT)/../../../target/lipo-ios/libveilid_flutter.a", + "-Wl,-export_dynamic", ); "OTHER_LDFLAGS[sdk=iphonesimulator*]" = ( "$(inherited)", @@ -524,6 +525,7 @@ "OTHER_LDFLAGS[sdk=iphoneos*]" = ( "$(inherited)", "-Wl,-force_load,$(SRCROOT)/../../../target/lipo-ios/libveilid_flutter.a", + "-Wl,-export_dynamic", ); "OTHER_LDFLAGS[sdk=iphonesimulator*]" = ( "$(inherited)", @@ -556,6 +558,7 @@ "OTHER_LDFLAGS[sdk=iphoneos*]" = ( "$(inherited)", "-Wl,-force_load,$(SRCROOT)/../../../target/lipo-ios/libveilid_flutter.a", + "-Wl,-export_dynamic", ); "OTHER_LDFLAGS[sdk=iphonesimulator*]" = ( "$(inherited)", diff --git a/veilid-flutter/ios/veilid.podspec b/veilid-flutter/ios/veilid.podspec index b2f08ea0..b5a27e57 100644 --- a/veilid-flutter/ios/veilid.podspec +++ b/veilid-flutter/ios/veilid.podspec @@ -29,7 +29,9 @@ Veilid Network Plugin cargo_target_dir = File.join(workspace_dir, 'target') s.xcconfig = { - 'OTHER_LDFLAGS' => "-Wl,-force_load,#{File.join(cargo_target_dir, 'lipo-ios', 'libveilid_flutter.a')}", + # -export_dynamic: the FFI entry points have no static referrer (Dart resolves them via + # dlsym at runtime), so a release -dead_strip drops them unless they are export roots + 'OTHER_LDFLAGS' => "-Wl,-force_load,#{File.join(cargo_target_dir, 'lipo-ios', 'libveilid_flutter.a')} -Wl,-export_dynamic", "LIBRARY_SEARCH_PATHS" => File.join(cargo_target_dir, 'lipo-ios') }