alexiscreuzot / SwiftyGif

High performance GIF engine
MIT License
2.02k stars 212 forks source link

bitcode_strip error with Carthage and Generic iOS Device build #110

Closed GiuseppePiscopo closed 5 years ago

GiuseppePiscopo commented 5 years ago

Hi there

we've been working with SwiftyGif in a custom framework of us for some time, always through the simulator. But now we're facing an issue when trying to build for Generic iOS Device.

Our framework depends on SwiftyGif through Carthage. I understand that Carthage is not officially mentioned on readme, but until now it was going fine.

Here below are the steps to reproduce, to be used with a (really) minimal repro workspace at SwiftyGif-BitcodeIssue.

Does anyone have an idea why this happen? If that can help, we could contribute with a PR in order to solve the issue.

Description

Steps to reproduce

  1. Open workspace in Xcode
  2. Make sure My App schema is selected, as well as Generic iOS Device
  3. Build product

Expected result

Product builds fine, with no errors.

Actual result

Product build fails. App reports following error from bitcode_strip: string table not at the end of the file (can't be processed) in file. Here's the full output (derived data and toolchain directories omitted for brevity):

PBXCp ...derivedData/Build/Products/Debug-iphoneos/MyLib.framework ...derivedData/Build/Products/Debug-iphoneos/MyApp.app/Frameworks/MyLib.framework (in target: MyApp) cd /Users/braincrumbz/Documents/Projects/Lab/Swift/BitcodeIssue/MyApp builtin-copy -exclude .DS_Store -exclude CVS -exclude .svn -exclude .git -exclude .hg -exclude Headers -exclude PrivateHeaders -exclude Modules -exclude *.tbd -bitcode-strip replace-with-marker -bitcode-strip-tool ...toolchain/bitcode_strip -resolve-src-symlinks ...derivedData/Build/Products/Debug-iphoneos/MyLib.framework ...derivedData/Build/Products/Debug-iphoneos/MyApp.app/Frameworks

...toolchain/bitcode_strip ...derivedData/Build/Products/Debug-iphoneos/MyLib.framework/MyLib -m -o ...derivedData/Build/Products/Debug-iphoneos/MyApp.app/Frameworks/MyLib.framework/MyLib ...toolchain/bitcode_strip ...derivedData/Build/Products/Debug-iphoneos/MyLib.framework/SwiftyGif.framework.dSYM/Contents/Resources/DWARF/SwiftyGif -m -o ...derivedData/Build/Products/Debug-iphoneos/MyApp.app/Frameworks/MyLib.framework/SwiftyGif.framework.dSYM/Contents/Resources/DWARF/SwiftyGif ...toolchain/bitcode_strip: string table not at the end of the file (can't be processed) in file: ...derivedData/Build/Products/Debug-iphoneos/MyLib.framework/SwiftyGif.framework.dSYM/Contents/Resources/DWARF/SwiftyGif (for architecture i386)error: bitcode_strip ...derivedData/Build/Products/Debug-iphoneos/MyLib.framework/SwiftyGif.framework.dSYM/Contents/Resources/DWARF/SwiftyGif: ...toolchain/bitcode_strip exited with 1

alexiscreuzot commented 5 years ago

Could this be tied to this issue ? https://github.com/Carthage/Carthage/issues/687

GiuseppePiscopo commented 5 years ago

I've also seen that issue, but I think it is now obsolete. As of today, when Carthage builds SwiftyGif, it correctly copies both the .framework and .dSYM files into .\Carthage\Build\iOS\ directory, from where they are both added in library project (each one in the right build phases).

I was thinking (just speculating) that it could be related to SwiftyGif not being a fat-framework/universal binary, and so it works for simulator and not for other target devices. Could it be?

GiuseppePiscopo commented 5 years ago

Just to confirm that obsolete behaviour, there's this closing comment which refers this merged PR

alexiscreuzot commented 5 years ago

Maybe looking at how Cocoapods handles it could give you a clue, as it works correctly using that dependency manager.

GiuseppePiscopo commented 5 years ago

Thanks for your feedback. Not an expert on Cocoapods, so don't know where to start from, I'll see.

In the meantime, just to give some more info: we tried with other dummy sample projects, this time adding another framework which supports Carthage already - https://github.com/thoughtbot/Curry/ - and the same issue shows up.

So it does not seem limited to SwiftyGif. It might as well be a matter of Xcode/build configuration. Feel free to close this if you don't think it matters to receive info on this.

GiuseppePiscopo commented 5 years ago

Ok, I think we've found a fix. It is mentioned in repro project, but just for reference I'll copy here as well:


[...] thanks to posts like this. The main gist is to add a user-defined build setting named STRIP_BITCODE_FROM_COPIED_FILES and set that to NO.