NativeScript / ios

NativeScript for iOS and visionOS using V8
https://docs.nativescript.org/guide/ios-marshalling
131 stars 33 forks source link

@nativescript/ios >= 7.0.1: Undefined symbols for architecture i386 #99

Open felixkrautschuk opened 3 years ago

felixkrautschuk commented 3 years ago

My config

The problem When creating a new NativeScript app and adding the following to App_Resources/iOS/Podfile:

platform :ios, '9.0'
pod 'Mapbox-iOS-SDK', '~> 6.3.0'

or

pod 'Braintree', '4.36.1'

I have trouble to build the app and run the app on iOS in some situations.

Project successfully prepared (ios) Building project... Xcode build... warning: Stale file '/Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/sharedpch/SharedPrecompiledHeaders/1429772644690191759/testapp-Prefix.pch.gch' is located outside of the allowed root paths.

warning: Stale file '/Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/sharedpch/SharedPrecompiledHeaders/9659924947654793526/testapp-Prefix.pch.gch' is located outside of the allowed root paths.

./.build_env_vars.sh: line 441: declare: UID: readonly variable NSLD: Swift bridging header '*-Swift.h' not found under '/Users/felixkrautschuk/Library/Developer/Xcode/DerivedData/testapp-cefposwjsgscvxbviyywdtdofqkw/Build/Intermediates.noindex/testapp.build/Debug-iphonesimulator/testapp.build/Objects-normal/i386' Generating metadata...~/Downloads/testapp/platforms/ios/internal/metadata-generator/bin ~/Downloads/testapp/platforms/ios Python version: 2.7.16 (default, Jun 5 2020, 22:59:21) [GCC 4.2.1 Compatible Apple LLVM 11.0.3 (clang-1103.0.29.20) (-macos10.15-objc- Generating metadata for x86_64 Metadata Generator Arguments: ./objc-metadata-generator -verbose -output-bin /Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator/metadata-x86_64.bin -output-umbrella /Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator/umbrella-x86_64.h -docset-path /Users/felixkrautschuk/Library/Developer/Shared/Documentation/DocSets/com.apple.adc.documentation.iOS.docset Xclang -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.2.sdk -mios-simulator-version-min=9.0 -std=gnu99 -target x86_64-apple-ios13.0-macabi -I/Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator/include -I/Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator/MDFInternationalization/MDFInternationalization.framework/Headers -I/Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator/MapboxMobileEvents/MapboxMobileEvents.framework/Headers -I/Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator/MaterialComponents/MaterialComponents.framework/Headers -I/Users/felixkrautschuk/Downloads/testapp/platforms/ios/internal/Swift-Modules -I/Users/felixkrautschuk/Downloads/testapp/platforms/ios/internal -I/Users/felixkrautschuk/Downloads/testapp/platforms/ios/../../App_Resources/iOS/src -I/Users/felixkrautschuk/Downloads/testapp/platforms/ios/../../node_modules/@nativescript/core/platforms/ios/src -F/Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator -F/Users/felixkrautschuk/Downloads/testapp/platforms/ios/internal/ -F/Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator -F/Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator/MDFInternationalization -F/Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator/MapboxMobileEvents -F/Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator/MaterialComponents -F/Users/felixkrautschuk/Downloads/testapp/platforms/ios/Pods/Mapbox-iOS-SDK/dynamic -F/Users/felixkrautschuk/Downloads/testapp/platforms/ios/../../node_modules/@nativescript/core/platforms/ios -DCOCOAPODS=1 -DDEBUG=1 Clang Arguments: "-v", "-x", "objective-c", "-fno-objc-arc", "-fmodule-maps", "-ferror-limit=0", "-Wno-unknown-pragmas", "-Wno-ignored-attributes", "-Wno-nullability-completeness", "-Wno-expansion-to-defined", "-DNATIVESCRIPT_METADATA_GENERATOR=1", "-isysroot", "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.2.sdk", "-mios-simulator-version-min=9.0", "-std=gnu99", "-target", "x86_64-apple-ios13.0-macabi", "-I/Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator/include", "-I/Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator/MDFInternationalization/MDFInternationalization.framework/Headers", "-I/Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator/MapboxMobileEvents/MapboxMobileEvents.framework/Headers", "-I/Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator/MaterialComponents/MaterialComponents.framework/Headers", "-I/Users/felixkrautschuk/Downloads/testapp/platforms/ios/internal/Swift-Modules", "-I/Users/felixkrautschuk/Downloads/testapp/platforms/ios/internal", "-I/Users/felixkrautschuk/Downloads/testapp/platforms/ios/../../App_Resources/iOS/src", "-I/Users/felixkrautschuk/Downloads/testapp/platforms/ios/../../node_modules/@nativescript/core/platforms/ios/src", "-F/Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator", "-F/Users/felixkrautschuk/Downloads/testapp/platforms/ios/internal/", "-F/Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator", "-F/Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator/MDFInternationalization", "-F/Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator/MapboxMobileEvents", "-F/Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator/MaterialComponents", "-F/Users/felixkrautschuk/Downloads/testapp/platforms/ios/Pods/Mapbox-iOS-SDK/dynamic", "-F/Users/felixkrautschuk/Downloads/testapp/platforms/ios/../../node_modules/@nativescript/core/platforms/ios", "-DCOCOAPODS=1", "-DDEBUG=1", Merged 849 categories. Result: 46392 declarations from 156 top level modules Done! Running time: 5.495 sec Saving metadata generation's stderr stream to: /Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator/metadata-generation-stderr-x86_64.txt Generating metadata for i386 Metadata Generator Arguments: ./objc-metadata-generator -verbose -output-bin /Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator/metadata-i386.bin -output-umbrella /Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator/umbrella-i386.h -docset-path /Users/felixkrautschuk/Library/Developer/Shared/Documentation/DocSets/com.apple.adc.documentation.iOS.docset Xclang -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.2.sdk -mios-simulator-version-min=9.0 -std=gnu99 -target i386-apple-ios13.0-macabi -I/Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator/include -I/Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator/MDFInternationalization/MDFInternationalization.framework/Headers -I/Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator/MapboxMobileEvents/MapboxMobileEvents.framework/Headers -I/Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator/MaterialComponents/MaterialComponents.framework/Headers -I/Users/felixkrautschuk/Downloads/testapp/platforms/ios/internal/Swift-Modules -I/Users/felixkrautschuk/Downloads/testapp/platforms/ios/internal -I/Users/felixkrautschuk/Downloads/testapp/platforms/ios/../../App_Resources/iOS/src -I/Users/felixkrautschuk/Downloads/testapp/platforms/ios/../../node_modules/@nativescript/core/platforms/ios/src -F/Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator -F/Users/felixkrautschuk/Downloads/testapp/platforms/ios/internal/ -F/Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator -F/Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator/MDFInternationalization -F/Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator/MapboxMobileEvents -F/Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator/MaterialComponents -F/Users/felixkrautschuk/Downloads/testapp/platforms/ios/Pods/Mapbox-iOS-SDK/dynamic -F/Users/felixkrautschuk/Downloads/testapp/platforms/ios/../../node_modules/@nativescript/core/platforms/ios -DCOCOAPODS=1 -DDEBUG=1 Clang Arguments: "-v", "-x", "objective-c", "-fno-objc-arc", "-fmodule-maps", "-ferror-limit=0", "-Wno-unknown-pragmas", "-Wno-ignored-attributes", "-Wno-nullability-completeness", "-Wno-expansion-to-defined", "-DNATIVESCRIPT_METADATA_GENERATOR=1", "-isysroot", "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.2.sdk", "-mios-simulator-version-min=9.0", "-std=gnu99", "-target", "i386-apple-ios13.0-macabi", "-I/Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator/include", "-I/Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator/MDFInternationalization/MDFInternationalization.framework/Headers", "-I/Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator/MapboxMobileEvents/MapboxMobileEvents.framework/Headers", "-I/Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator/MaterialComponents/MaterialComponents.framework/Headers", "-I/Users/felixkrautschuk/Downloads/testapp/platforms/ios/internal/Swift-Modules", "-I/Users/felixkrautschuk/Downloads/testapp/platforms/ios/internal", "-I/Users/felixkrautschuk/Downloads/testapp/platforms/ios/../../App_Resources/iOS/src", "-I/Users/felixkrautschuk/Downloads/testapp/platforms/ios/../../node_modules/@nativescript/core/platforms/ios/src", "-F/Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator", "-F/Users/felixkrautschuk/Downloads/testapp/platforms/ios/internal/", "-F/Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator", "-F/Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator/MDFInternationalization", "-F/Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator/MapboxMobileEvents", "-F/Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator/MaterialComponents", "-F/Users/felixkrautschuk/Downloads/testapp/platforms/ios/Pods/Mapbox-iOS-SDK/dynamic", "-F/Users/felixkrautschuk/Downloads/testapp/platforms/ios/../../node_modules/@nativescript/core/platforms/ios", "-DCOCOAPODS=1", "-DDEBUG=1", Merged 849 categories. Result: 46392 declarations from 155 top level modules Done! Running time: 5.2533 sec Saving metadata generation's stderr stream to: /Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator/metadata-generation-stderr-i386.txt ~/Downloads/testapp/platforms/ios ld: warning: ld: warning: ignoring file /Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator/TKLiveSync.framework/TKLiveSync, building for iOS Simulator-i386 but attempting to link with file built for iOS Simulator-x86_64ignoring file /Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator/NativeScript.framework/NativeScript, building for iOS Simulator-i386 but attempting to link with file built for iOS Simulator-x86_64

ld: warning: ignoring file /Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator/MDFInternationalization/MDFInternationalization.framework/MDFInternationalization, building for iOS Simulator-i386 but attempting to link with file built for iOS Simulator-x86_64 ld: warning: ignoring file /Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator/MapboxMobileEvents/MapboxMobileEvents.framework/MapboxMobileEvents, building for iOS Simulator-i386 but attempting to link with file built for iOS Simulator-x86_64 ld: warning: ignoring file /Users/felixkrautschuk/Downloads/testapp/platforms/ios/build/Debug-iphonesimulator/MaterialComponents/MaterialComponents.framework/MaterialComponents, building for iOS Simulator-i386 but attempting to link with file built for iOS Simulator-x86_64 Undefined symbols for architecture i386: "_OBJCCLASS$_Config", referenced from: objc-class-ref in main.o "_OBJCCLASS$_NativeScript", referenced from: objc-class-ref in main.o (maybe you meant: _OBJCCLASS$_NativeScriptEmbedder) "_TNSInitializeLiveSync", referenced from: _main in main.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation) note: Using new build system note: Building targets in parallel note: Using codesigning identity override: note: Planning build note: Constructing build description warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.2.99. (in target 'MDFInternationalization' from project 'Pods') BUILD FAILED

Unable to apply changes on device: D4022399-722F-4DC5-92B0-6001474E4A7B. Error is: Command xcodebuild failed with exit code 65.

So I guess the important part is:

Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_Config", referenced from:
      objc-class-ref in main.o
  "_OBJC_CLASS_$_NativeScript", referenced from:
      objc-class-ref in main.o
     (maybe you meant: _OBJC_CLASS_$_NativeScriptEmbedder)
  "_TNSInitializeLiveSync", referenced from:
      _main in main.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

The newly created NativeScript app using @nativescript/ios 7.1.0 and the Mapbox-iOS-SDK Podfile can be found here: testapp.zip

There is already a discussion on Github for the nativescript mapbox plugin here: https://github.com/nativescript-community/ui-mapbox/issues/3#issuecomment-732140591 . Yes, it might be related to the Mapbox-iOS-SDK somehow, as this problem does not exist for all Pods, for example pod 'Google-Mobile-Ads-SDK', '7.67.0' is working fine with the latest ios v8 runtime.

BUT the error message above sounds like a NativeScript issue, and when I create a new native Xcode iOS App Project and add the Mapbox Pod there, xcode is building and running the project in Simulator as expected. The native xcode project can be found here: iosmapboxapp.zip (Run pod install first, when you want to try it out).

It would be nice if we could use the latest ios runtime and also all ios pods without having problems to build the ios app. Thanks in advance!

triniwiz commented 3 years ago

The v8 runtime (v7+) does not support i386 and x86 I would suggest ignoring those archs in your build.xcconfig or the simplest solution would be setting the platform to 11 (platform :ios, '11.0') which removed 32bit support .. weird 7 worked but yes if you wanna use those other archs you could use the jsc runtime