Compilation fails with Xcode 14.3
Describe the bug?
When upgrading Xcode to the latest version, my team and I noticed the build process fails when compiling the pod associated with @okta/okta-react-native (2.7.0). No code changes were made in react-native or native code, just the xcode upgrade.
While many other dependencies failed with a similar error, upgrading to a newer version of the dependency fixed the issues, except for @okta/okta-react-native, where even though the latest version (2.8.0) allows the app to be built for release, building it for unit tests on a simulator fails to compile. See details below:
xcpretty output
▸ Linking OktaSdkBridgeReactNative
❌ Undefined symbols for architecture x86_64
> Symbol: _OBJC_CLASS_$_RCTEventEmitter
> Referenced from: _$s24OktaSdkBridgeReactNative0abC0CN in OktaSdkBridge.o
❌ ld: symbol(s) not found for architecture x86_64
❌ clang: error: linker command failed with exit code 1 (use -v to see invocation)
** TEST FAILED **
The following build commands failed:
Ld ./ios/derivedDataBuild/Build/Products/Debug-iphonesimulator/OktaSdkBridgeReactNative/OktaSdkBridgeReactNative.framework/OktaSdkBridgeReactNative normal (in target 'OktaSdkBridgeReactNative' from project 'Pods')
(1 failure)
raw log output
Ld ./ios/derivedData/Build/Products/Debug-iphonesimulator/OktaSdkBridgeReactNative/OktaSdkBridgeReactNative.framework/OktaSdkBridgeReactNative normal (in target 'OktaSdkBridgeReactNative' from project 'Pods')
cd ./ios/Pods
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -target x86_64-apple-ios11.0-simulator -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.2.sdk -L./ios/derivedData/Build/Intermediates.noindex/EagerLinkingTBDs -L./ios/derivedData/Build/Products/Debug-iphonesimulator/OktaSdkBridgeReactNative -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.2.sdk/usr/lib/swift -F./ios/derivedData/Build/Intermediates.noindex/EagerLinkingTBDs -F./ios/derivedData/Build/Products/Debug-iphonesimulator/OktaSdkBridgeReactNative -F./ios/derivedData/Build/Products/Debug-iphonesimulator/DoubleConversion -F./ios/derivedData/Build/Products/Debug-iphonesimulator/FBReactNativeSpec -F./ios/derivedData/Build/Products/Debug-iphonesimulator/Folly -F./ios/derivedData/Build/Products/Debug-iphonesimulator/OktaOidc -F./ios/derivedData/Build/Products/Debug-iphonesimulator/RCTTypeSafety -F./ios/derivedData/Build/Products/Debug-iphonesimulator/React-Core -F./ios/derivedData/Build/Products/Debug-iphonesimulator/React-RCTAnimation -F./ios/derivedData/Build/Products/Debug-iphonesimulator/React-RCTBlob -F./ios/derivedData/Build/Products/Debug-iphonesimulator/React-RCTImage -F./ios/derivedData/Build/Products/Debug-iphonesimulator/React-RCTLinking -F./ios/derivedData/Build/Products/Debug-iphonesimulator/React-RCTNetwork -F./ios/derivedData/Build/Products/Debug-iphonesimulator/React-RCTSettings -F./ios/derivedData/Build/Products/Debug-iphonesimulator/React-RCTText -F./ios/derivedData/Build/Products/Debug-iphonesimulator/React-RCTVibration -F./ios/derivedData/Build/Products/Debug-iphonesimulator/React-cxxreact -F./ios/derivedData/Build/Products/Debug-iphonesimulator/React-jsi -F./ios/derivedData/Build/Products/Debug-iphonesimulator/React-jsiexecutor -F./ios/derivedData/Build/Products/Debug-iphonesimulator/React-jsinspector -F./ios/derivedData/Build/Products/Debug-iphonesimulator/ReactCommon -F./ios/derivedData/Build/Products/Debug-iphonesimulator/Yoga -F./ios/derivedData/Build/Products/Debug-iphonesimulator/glog -filelist ./ios/derivedData/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/OktaSdkBridgeReactNative.build/Objects-normal/x86_64/OktaSdkBridgeReactNative.LinkFileList -install_name @rpath/OktaSdkBridgeReactNative.framework/OktaSdkBridgeReactNative -Xlinker -rpath -Xlinker /usr/lib/swift -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -dead_strip -Xlinker -object_path_lto -Xlinker ./ios/derivedData/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/OktaSdkBridgeReactNative.build/Objects-normal/x86_64/OktaSdkBridgeReactNative_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -Xlinker -debug_variant -fobjc-arc -fobjc-link-runtime -fprofile-instr-generate -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -L/usr/lib/swift -Xlinker -add_ast_path -Xlinker ./ios/derivedData/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/OktaSdkBridgeReactNative.build/Objects-normal/x86_64/OktaSdkBridgeReactNative.swiftmodule -framework OktaOidc -framework Foundation -Xlinker -no_adhoc_codesign -compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker ./ios/derivedData/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/OktaSdkBridgeReactNative.build/Objects-normal/x86_64/OktaSdkBridgeReactNative_dependency_info.dat -o ./ios/derivedData/Build/Products/Debug-iphonesimulator/OktaSdkBridgeReactNative/OktaSdkBridgeReactNative.framework/OktaSdkBridgeReactNative
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_RCTEventEmitter", referenced from:
_$s24OktaSdkBridgeReactNative0abC0CN in OktaSdkBridge.o
"_OBJC_METACLASS_$_RCTEventEmitter", referenced from:
_OBJC_METACLASS_$_OktaSdkBridge in OktaSdkBridge.o
"_RCTPresentedViewController", referenced from:
_$s24OktaSdkBridgeReactNative0abC0C23presentedViewControllerSo06UIViewH0CSgyF in OktaSdkBridge.o
"_RCTRegisterModule", referenced from:
_initialize_OktaSdkBridge in ReactNativeOktaSdkBridge.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Test command (fastlane run_tests)
run_tests(
clean: true,
derived_data_path: "derivedData",
workspace: "App.xcworkspace",
scheme: "App",
device: "iPhone 14",
ensure_devices_found: true,
reset_simulator: true,
xcargs: "-allowProvisioningUpdates",
)
What is expected to happen?
The app should build successfully for unit tests
What is the actual behavior?
The app fails to compile for unit tests
Reproduction Steps?
- Build app for unit tests with the latest Xcode version (e.g.
fastlane run_tests)
Additional Information?
No response
SDK Version
- OktaOidc (3.11.2):
- OktaOidc/AppAuth (= 3.11.2)
- OktaOidc/Okta (= 3.11.2)
- OktaOidc/AppAuth (3.11.2)
- OktaOidc/Okta (3.11.2):
- OktaOidc/AppAuth
- OktaSdkBridgeReactNative (2.8.0):
- OktaOidc (= 3.11.2)
- React
Build Information
iOS: Ventura 13.2.1 (22D68) Xcode: Version 14.3 (14E222b)
Hi @andersonvom, I'll take a look at this soon. Before I do, I wanted to double check that you cleaned out your Pods folder, and maybe your node_modules? I've seen issues like this in the past where a stale dependency needs to be rebuilt.
Hi @mikenachbaur-okta! Thanks for getting back to me. Yes, I have cleaned ios/Pods and node_modules. I also see the error both locally and in our CI infrastructure, which runs with a fresh repo every time, so I can be pretty confident this is not an error due to stale dependencies.
Hello @mikenachbaur-okta,
we're also experiencing almost the same issue @andersonvom described above(Unable to build/run the app). Are you actively investigating this problem? If so, have you made any progress in finding a solution or identifying a workaround? Any assistance you can provide would be greatly appreciated.
For your reference, here are the details of my development environment:
iOS: Ventura 13.2.1 Xcode: Versions 14.2, 14.3 The current "@okta/okta-react-native" version in my project is "2.2.0" but I've also tried 2.6.0, 2.70, and 2.8.0, but nothing works.
Thank you in advance for your attention to this matter.
Hey @sindhusingh, I haven't investigated it further, and have just disabled iOS unit tests for the time being 😢
Thank you, @andersonvom, for the suggestion!
In our situation, we encountered a compile-time error after upgrading to Xcode 14.2 or a higher version. Here's the error we encountered:
After spending a few hours investigating the issue and reviewing responses from various sources online, I managed to find a temporary solution. The solution involved commenting out the line @available(iOS 13.0, *). Once this line was commented out, the project started functioning again. However, since I'm not well-versed in the Swift language, I'm uncertain about the potential impact of commenting out this line in real-world scenarios, which still needs to be tested.
In my specific case, the issue was resolved, as shown in the following screenshot:
Once again, I appreciate your input, Anderson!
CC @mikenachbaur-okta