bazelbuild / bazelbuild/rules_apple
Bitcode issue with apple_xcframework
- Dominant language
- Starlark
- Stars
- 593
- Forks
- 334
- Avg merge
- 16h 48m
- Merged PRs (30d)
- 9
Description
Hello, I have been trying to use an XCFramework built from the `apple_xcframework` in a regular iOS Xcode project but unless I disable bitcode for the whole application the IPA generation fails.
I have created a sample project [here](https://github.com/piellarda/apple_xcframework_test) that reproduces the issue i'm facing.
Running the IPA generation through fastlane I get the following logs:
```
+ xcodebuild -exportArchive -exportOptionsPlist /var/folders/lg/xfqc35j107g7l06bmvljptw40000gn/T/gym_config20220427-66913-pesk7z.plist -archivePath '/Users/antoine/Library/Developer/Xcode/Archives/2022-04-27/MyTestApp 2022-04-27 10.51.40.xcarchive' -exportPath /var/folders/lg/xfqc35j107g7l06bmvljptw40000gn/T/gym_output20220427-66913-yqicyu
objc[68277]: Class AppleTypeCRetimerRestoreInfoHelper is implemented in both /usr/lib/libauthinstall.dylib (0x2097f1eb0) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x105dc84f8). One of the two will be used. Which one is undefined.
objc[68277]: Class AppleTypeCRetimerFirmwareAggregateRequestCreator is implemented in both /usr/lib/libauthinstall.dylib (0x2097f1f00) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x105dc8548). One of the two will be used. Which one is undefined.
objc[68277]: Class AppleTypeCRetimerFirmwareRequestCreator is implemented in both /usr/lib/libauthinstall.dylib (0x2097f1f50) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x105dc8598). One of the two will be used. Which one is undefined.
objc[68277]: Class ATCRTRestoreInfoFTABFile is implemented in both /usr/lib/libauthinstall.dylib (0x2097f1fa0) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x105dc85e8). One of the two will be used. Which one is undefined.
objc[68277]: Class AppleTypeCRetimerFirmwareCopier is implemented in both /usr/lib/libauthinstall.dylib (0x2097f1ff0) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x105dc8638). One of the two will be used. Which one is undefined.
objc[68277]: Class ATCRTRestoreInfoFTABSubfile is implemented in both /usr/lib/libauthinstall.dylib (0x2097f2040) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x105dc8688). One of the two will be used. Which one is undefined.
2022-04-27 10:51:43.763 xcodebuild[68277:7461392] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2022-04-27 10:51:43.763 xcodebuild[68277:7461392] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2022-04-27 10:51:43.874 xcodebuild[68277:7461392] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path "/var/folders/lg/xfqc35j107g7l06bmvljptw40000gn/T/MyTestApp_2022-04-27_10-51-43.874.xcdistributionlogs".
error: exportArchive: ipatool failed with an exception: #:0: warning: using sysroot for 'MacOSX' but targeting 'iPhone'
Exited with 0
Command took 0 seconds
Swift: cd /var/folders/lg/xfqc35j107g7l06bmvljptw40000gn/T/tempezdavi9m
['/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc', '-frontend', '-emit-object', '-target', 'arm64-apple-ios15.2', '-Xllvm', '-aarch64-use-tbi', '-O', '-disable-llvm-optzns', '-module-name', 'MyTestApp', '2.bc', '-o', '2.o']
-= Output =-
:0: warning: using sysroot for 'MacOSX' but targeting 'iPhone'
Exited with 0
Command took 0 seconds
Using: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
Search Path: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.1.6/lib/darwin, /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos, /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.4.sdk/usr/lib, /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.4.sdk/System/Library/Frameworks
MyLib not found in dylib search path
Stderr:
>
/Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:372:in `run'
/Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:2889:in `block in CompileOrStripBitcodeInBundle'
/Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:2828:in `each'
/Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:2828:in `CompileOrStripBitcodeInBundle'
/Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:3115:in `block in ProcessIPA'
/Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:3076:in `each'
/Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:3076:in `ProcessIPA'
/Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:4038:in `'
Error Domain=IDEFoundationErrorDomain Code=1 "ipatool failed with an exception: #:0: warning: using sysroot for 'MacOSX' but targeting 'iPhone'
Exited with 0
Command took 0 seconds
Swift: cd /var/folders/lg/xfqc35j107g7l06bmvljptw40000gn/T/tempezdavi9m
['/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc', '-frontend', '-emit-object', '-target', 'arm64-apple-ios15.2', '-Xllvm', '-aarch64-use-tbi', '-O', '-disable-llvm-optzns', '-module-name', 'MyTestApp', '2.bc', '-o', '2.o']
-= Output =-
:0: warning: using sysroot for 'MacOSX' but targeting 'iPhone'
Exited with 0
Command took 0 seconds
Using: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
Search Path: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.1.6/lib/darwin, /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos, /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.4.sdk/usr/lib, /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.4.sdk/System/Library/Frameworks
MyLib not found in dylib search path
Stderr:
>
/Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:372:in `run'
/Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:2889:in `block in CompileOrStripBitcodeInBundle'
/Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:2828:in `each'
/Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:2828:in `CompileOrStripBitcodeInBundle'
/Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:3115:in `block in ProcessIPA'
/Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:3076:in `each'
/Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:3076:in `ProcessIPA'
/Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:4038:in `'" UserInfo={NSLocalizedDescription=ipatool failed with an exception: #:0: warning: using sysroot for 'MacOSX' but targeting 'iPhone'
Exited with 0
Command took 0 seconds
Swift: cd /var/folders/lg/xfqc35j107g7l06bmvljptw40000gn/T/tempezdavi9m
['/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc', '-frontend', '-emit-object', '-target', 'arm64-apple-ios15.2', '-Xllvm', '-aarch64-use-tbi', '-O', '-disable-llvm-optzns', '-module-name', 'MyTestApp', '2.bc', '-o', '2.o']
-= Output =-
:0: warning: using sysroot for 'MacOSX' but targeting 'iPhone'
Exited with 0
Command took 0 seconds
Using: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
Search Path: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.1.6/lib/darwin, /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos, /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.4.sdk/usr/lib, /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.4.sdk/System/Library/Frameworks
MyLib not found in dylib search path
Stderr:
>
/Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:372:in `run'
/Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:2889:in `block in CompileOrStripBitcodeInBundle'
/Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:2828:in `each'
/Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:2828:in `CompileOrStripBitcodeInBundle'
/Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:3115:in `block in ProcessIPA'
/Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:3076:in `each'
/Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:3076:in `ProcessIPA'
/Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:4038:in `'}
** EXPORT FAILED **
```
Contributor guide
Research direction
Start with the linked apple_xcframework_test sample project and reproduce the failure using the reported fastlane xcodebuild -exportArchive command. Trace the apple_xcframework output and the bitcode-build-tool error reporting “MyLib not found in dylib search path”; done means IPA generation succeeds without disabling bitcode for the application.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios
- Domain
- build-system, mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100