Qt
  1. Qt
  2. QTBUG-58754

Adding an Objective-C source to an iOS project on Simulator fails with bitcode error

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: P2: Important P2: Important
    • Resolution: Done
    • Affects Version/s: 5.8.0
    • Fix Version/s: 5.9
    • Labels:
      None
    • Environment:

      Qt 5.8.0
      Xcode 8.2.1
      macOS 10.12.2

    • Commits:
      840aa67146773d36c98fbdd0c446a1076551efaa

      Description

      Adding a custom Objective-C or Objective-C++ file to an iOS project currently breaks the build. You can reproduce it by adding an empty file with

      ios {
        OBJECTIVE_SOURCES += MyClass.m
      }
      

      to the project file and run it for the simulator target. The resulting error is something like:

      ld: '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphonesimulator.a(arclite.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture x86_64
      clang: error: linker command failed with exit code 1 (use -v to see invocation)
      

      (it might be another library if adding others to the project, so I guess the library itself is irrelevant).

      This only happens for Simulator build targets and not for devices. Probably there is something messed up in the default project configuration from qmake?

        Issue Links

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

          Hide
          Jake Petroules added a comment -

          This is also reproducible with tests/auto/corelib/plugin/quuid/quuid.pro. Unfortunately we don't build tests on iOS yet (WIP!) which would have caught this sooner.

          Basically it's due to bitcode.prf not having been updated to deal with the new combined simulator and device builds. Even more unfortunately, the -fembed-bitcode* flags don't work with -Xarch, so this could be very tricky if not impossible to fix...

          Show
          Jake Petroules added a comment - This is also reproducible with tests/auto/corelib/plugin/quuid/quuid.pro. Unfortunately we don't build tests on iOS yet (WIP!) which would have caught this sooner. Basically it's due to bitcode.prf not having been updated to deal with the new combined simulator and device builds. Even more unfortunately, the -fembed-bitcode* flags don't work with -Xarch, so this could be very tricky if not impossible to fix...
          Hide
          Petar Koretic added a comment - - edited

          Jake Petroules can we workaround this somehow for now?

          EDIT: we have made same changes to our 5.8 installations as gerrit patch shows, works as expected

          Show
          Petar Koretic added a comment - - edited Jake Petroules can we workaround this somehow for now? EDIT: we have made same changes to our 5.8 installations as gerrit patch shows, works as expected
          Hide
          Ekkehard added a comment -

          sorry for reporting a duplicate

          for me this happens without adding any custom Objective-C and it happens also on device and only in release builds, not debug builds

          it seems the release was build fine - so can I ignore the issues ?

          THX

          Show
          Ekkehard added a comment - sorry for reporting a duplicate for me this happens without adding any custom Objective-C and it happens also on device and only in release builds, not debug builds it seems the release was build fine - so can I ignore the issues ? THX
          Hide
          Ekkehard added a comment -

          @Petar: seems you have changed the

          ...sdk_580/5.8/ios/mkspecs/features/uikit/bitcode.prf
          

          can you provide the modified file so I'm sure not doing wrong things - this kind of stuff isn't my domain
          thx

          Show
          Ekkehard added a comment - @Petar: seems you have changed the ...sdk_580/5.8/ios/mkspecs/features/uikit/bitcode.prf can you provide the modified file so I'm sure not doing wrong things - this kind of stuff isn't my domain thx
          Hide
          Jake Petroules added a comment -

          Ekkehard: you can see the modifications to bitcode.prf here: https://codereview.qt-project.org/#/c/185931/3//ALL

          Show
          Jake Petroules added a comment - Ekkehard : you can see the modifications to bitcode.prf here: https://codereview.qt-project.org/#/c/185931/3//ALL
          Hide
          Ekkehard added a comment -

          thx - will try to change this. really appreciate your help.

          Show
          Ekkehard added a comment - thx - will try to change this. really appreciate your help.
          Hide
          Ekkehard added a comment -

          it works
          have modified the bitcode.prf and now the -fembed-bitcode-marker Issues are gone
          only two
          :-1: warning: -headerpad_max_install_names is ignored when used with -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES)
          left - and I know I can ignore them

          Show
          Ekkehard added a comment - it works have modified the bitcode.prf and now the -fembed-bitcode-marker Issues are gone only two :-1: warning: -headerpad_max_install_names is ignored when used with -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES) left - and I know I can ignore them
          Hide
          Jake Petroules added a comment -

          For those warnings there is another patch: https://codereview.qt-project.org/#/c/185929/

          Show
          Jake Petroules added a comment - For those warnings there is another patch: https://codereview.qt-project.org/#/c/185929/
          Hide
          Ekkehard added a comment -

          thx for the info. will take a look later - at the moment I can live with two issues.

          Show
          Ekkehard added a comment - thx for the info. will take a look later - at the moment I can live with two issues.

            People

            • Assignee:
              Jake Petroules
              Reporter:
              Alex Leutgöb
            • Votes:
              3 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews

                There are no open Gerrit changes