touren / twitter-kit-ios

Twitter Kit is a native SDK to include Twitter content inside mobile apps.
Apache License 2.0
110 stars 80 forks source link

Failed to Verify Bitcode #4

Closed 0xLeif closed 5 years ago

0xLeif commented 5 years ago

While exporting the export failed to verify the bitcode.

Expected behavior

Successfully archive a build.

Actual behavior

Error Domain=IDEFoundationErrorDomain Code=1 "Failed to verify bitcode in TwitterKit.framework/TwitterKit:
error: Linker option verification failed for bundle /var/folders/mx/3800rps92kd6jw5mygd5t1880000gn/T/TwitterKit1LwIBZ/TwitterKit.arm64.xar (unrecognized arguments: -platform_version iOS 9.0.0 13.0.0)

" UserInfo={NSLocalizedDescription=Failed to verify bitcode in TwitterKit.framework/TwitterKit:
error: Linker option verification failed for bundle /var/folders/mx/3800rps92kd6jw5mygd5t1880000gn/T/TwitterKit1LwIBZ/TwitterKit.arm64.xar (unrecognized arguments: -platform_version iOS 9.0.0 13.0.0)

}

Steps to reproduce the behavior

Happened during fastlane build & deploy

xcodebuild -exportArchive -exportOptionsPlist /var/folders/mx/3800rps92kd6jw5mygd5t1880000gn/T/gym_config20191021-61705-ab5grj.plist -archivePath '/Users/panda/Library/Developer/Xcode/Archives/2019-10-21/FanX 2019-10-21 09.55.09.xcarchive' -exportPath /var/folders/mx/3800rps92kd6jw5mygd5t1880000gn/T/gym_output20191021-61705-wepi6m
aliozinan commented 5 years ago

Have you tried setting Enable Bitcode to NO under Build Settings?

0xLeif commented 5 years ago

I have Bitcode disabled for my project.

aliozinan commented 5 years ago

@zmeriksen have you tried this solution?

0xLeif commented 5 years ago

I will try that! Give me a moment to try and build...

0xLeif commented 5 years ago

@aliozinan I am getting this error now after adding the Run Script...

[Transporter Error Output]: ERROR ITMS-90085: "No architectures in the binary. Lipo failed to detect any architectures in the bundle executable."

and

dyld: Library not loaded: @rpath/Flurry_iOS_SDK.framework/Flurry_iOS_SDK
  Referenced from: /Users/panda/Library/Developer/CoreSimulator/Devices/B32DE0BE-22F9-4DB0-B302-14BFF287624B/data/Containers/Bundle/Application/16D053E2-7590-4D61-A16E-4C16F5186BEF/FanX.app/FanX
  Reason: image not found

Any ideas?

aliozinan commented 5 years ago

I had come across the very same error before. The errors you get are obviously pointing an architecture support problem in the build settings :

...TwitterKit.arm64.xar (unrecognized arguments: -platform_version iOS 9.0.0 13.0.0)

[Transporter Error Output]: ERROR ITMS-90085: "No architectures in the binary. Lipo failed to detect any architectures in the bundle executable."

As applying the script causes a similar conflict, revert back the solution on stackoverflow. The first error was thrown at TwitterKit build phase, so try setting BITCODE_GENERATION_MODE to NO under TwitterKit's build settings (and do the same for all other libraries' targets).

aliozinan commented 5 years ago

a PR that fixes build errors on XCode's latest versions is waiting for approval as a side note. You can test the dev branch and provide feedback here.

0xLeif commented 5 years ago

@aliozinan I am using CocoaPods so I can't just change the project settings or pull in your PR changes that easy. I will test once your PR gets merged into dev 👍

@touren Ping

aliozinan commented 5 years ago

you can also try removing tvOS targets as the original error is related with arm64

0xLeif commented 5 years ago

@aliozinan could this be an issue with Xcode 10.3 vs Xcode 11?

When I tried to build this project I got this error:

twitter-kit-ios(master*) » ./build.sh
xcodebuild: error: SDK "iphonesimulator13.0" cannot be located.
xcodebuild: error: SDK "iphoneos13.0" cannot be located.

I switched to Xcode 11 Command Line Tools and it worked just fine... I'm checking anywhere if we target WatchOS still...

aliozinan commented 5 years ago

The problems arises at TvOS builds which is unnecessary imo as this is a mobile app development kit. Regarding your question, yes there are issues with XCode 11.x versions, especially when TwitterKit is migrated to the recommended settings.

You can download the awaiting version here and try to build on your XCode to check the results.

0xLeif commented 5 years ago

Alright I will try your version later. I expect I will have issues with 5.0.1 and 5.1 compiler for my project. I'm still in 10.3 land :(

aliozinan commented 5 years ago

It's interesting that in my project (which is React Native based) Enable Bitcode is set to Yes and I'm still able to get successful build (I'm on XCode 11.1). The only detail is i had removed all TvOS references under build settings. I also do have SafariServices.framework and WebKit.framework added under General > Frameworks, Libraries and Embedded Content.

I had fixed the XCode 11 compatibility issues by myself.

The current version of TwitterKit5 you install via CocoaPods is compatible and bug free with XCode 10.x so I still beleive that the errors you're getting are about different device support in your targets' build settings. It might be of other pods as well.

Also do not forget using empty Build Cache methods :

rm -rf ~/Library/Developer/Xcode/DerivedData/

Hope this helps & good luck