Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error while exporting with Bitcode enabled (symbol not found for architecture armv7)

I have a fairly old project with a minimum deployment target set to iOS 8.4. For technical reasons bitcode must be enabled. The project builds and runs fine. When trying to export an archived build however, things go wrong. I am using Xcode 8.2.1.

When I create a test build (signed with Enterprise certificate) with the option Rebuild from bitcode enabled, the export fails at the stage when it is compiling bitcode.

Screenshot bitcode setting

Screenshot export error

Here is the relevant part of the log:

"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0/lib/darwin/libclang_rt.ios.a" "-o" "/private/var/folders/qy/cgq_nq7x2tx1j3z__7f4yx100000gn/T/<redacted target name>WX9bPu/<redacted target name>.armv7.out" 
    -= Output =-
    Undefined symbols for architecture armv7:
      "_llvm_gcov_init", referenced from:
          __hidden#2_ in 001.o
          __hidden#3_ in 001.o
          __hidden#4_ in 001.o
          __hidden#5_ in 001.o
          __hidden#6_ in 001.o
          __hidden#7_ in 001.o
          __hidden#8_ in 001.o
          ...
      "_llvm_gcda_end_file", referenced from:
          __hidden#0_ in 001.o
          __hidden#0_ in 002.o
          __hidden#0_ in 003.o
          __hidden#0_ in 004.o
          __hidden#0_ in 005.o
          __hidden#0_ in 006.o
          __hidden#0_ in 007.o
          ...
      "_llvm_gcda_emit_function", referenced from:
          __hidden#0_ in 001.o
          __hidden#0_ in 002.o
          __hidden#0_ in 004.o
          __hidden#0_ in 005.o
          __hidden#0_ in 006.o
          __hidden#0_ in 007.o
          __hidden#0_ in 008.o
          ...
      "_llvm_gcda_emit_arcs", referenced from:
          __hidden#0_ in 001.o
          __hidden#0_ in 002.o
          __hidden#0_ in 004.o
          __hidden#0_ in 005.o
          __hidden#0_ in 006.o
          __hidden#0_ in 007.o
          __hidden#0_ in 008.o
          ...
      "_llvm_gcda_start_file", referenced from:
          __hidden#0_ in 001.o
          __hidden#0_ in 002.o
          __hidden#0_ in 003.o
          __hidden#0_ in 004.o
          __hidden#0_ in 005.o
          __hidden#0_ in 006.o
          __hidden#0_ in 007.o
          ...
      "_llvm_gcda_summary_info", referenced from:
          __hidden#0_ in 001.o
          __hidden#0_ in 002.o
          __hidden#0_ in 003.o
          __hidden#0_ in 004.o
          __hidden#0_ in 005.o
          __hidden#0_ in 006.o
          __hidden#0_ in 007.o
          ...
    ld: symbol(s) not found for architecture armv7
    Exited with 1
    
    
    error: Failed to compile bundle: /var/folders/qy/cgq_nq7x2tx1j3z__7f4yx100000gn/T/<redacted target name>WX9bPu/<redacted target name>.armv7.xar
    

Stderr:
>
    /Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:202:in `run'
    /Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:1987:in `block in CompileOrStripBitcodeInBundle'
    /Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:1944:in `each'
    /Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:1944:in `CompileOrStripBitcodeInBundle'
    /Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:2119:in `ProcessIPA'
    /Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:2687:in `<main>'";
            info =             {
            };
            level = ERROR;
            type = exception;
        }
    );
    thinnableAssetCatalogs =     (
        "/var/folders/qy/cgq_nq7x2tx1j3z__7f4yx100000gn/T/XcodeDistPipeline.hn6/Root/Payload/<redacted target name>.app/Assets.car"
    );
}
2017-03-31 12:21:37 +0000 [MT] Exporting using IDEDistributionPackageExportStep
2017-03-31 12:21:58 +0000 [MT] Canceled distribution assistant

When I disable Rebuild from bitcode, the export is successful and the resulting build runs fine. I'm afraid this will give problems when the build will be submitted to iTunes Connect however.

Does anyone have a clue why this error occurs and how to fix this? I'm a bit at a loss here.


Edit:

To clarify: yes, bitcode is enabled at the target level. Here are the linked libraries:

Screenshot of linked libraries

These are the dependencies:

# Reporting
pod 'Fabric'
pod 'Crashlytics'
pod 'GoogleAnalytics'
pod 'CocoaLumberjack', '~> 1.6.2'

# Networking
pod 'AFNetworking', '~> 2.6.3'
pod 'RestKit', '~> 0.27'
pod 'Reachability'

# Other
pod 'UIColor-Utilities', '~> 1.0.1'
pod 'ViewDeck', '~> 2.4'
pod 'SDWebImage', '~> 3.7.0'
pod 'AMRatingControl', '~> 1.3.0'
like image 237
Kymer Avatar asked Mar 31 '17 13:03

Kymer


1 Answers

After some trial and error and by the helpful suggestions by Sven Drielecker (and others) the issue has ben fixed.

The GCC_INSTRUMENT_PROGRAM_FLOW_ARCS build setting was set to YES for both debug and release builds. Turning it off for release has fixed the issue.

like image 78
Kymer Avatar answered Oct 25 '22 23:10

Kymer