Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Linking to static libraries with correct architecture when building in xcode
QtWS25 Last Chance

Linking to static libraries with correct architecture when building in xcode

Scheduled Pinned Locked Moved Solved Mobile and Embedded
qmakeqtcreatorc++linkerios
7 Posts 3 Posters 4.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Larpon
    wrote on last edited by Larpon
    #1

    I have a QMake .pri file with something like this:

    LIBS += \
            -L$$PWD/sdk/libs/ios/arm64 -laid \
            -L$$PWD/sdk/libs/ios/arm64 -lapp \
            -L$$PWD/sdk/libs/ios/armv7 -laid \
            -L$$PWD/sdk/libs/ios/armv7 -lapp
    

    The libs are static libraries (aid.a, app.a). When I use QtCreator to compile the project (and deploy on ios) using xcode - I get linker errors if both LIBS are linked but it compiles and deploy fine if I take one of the architectures out and use QMAKE_IOS_DEVICE_ARCHS = armv7:

    QMAKE_IOS_DEVICE_ARCHS = armv7
    
    LIBS += \
            -L$$PWD/sdk/libs/ios/armv7 -laid \
            -L$$PWD/sdk/libs/ios/armv7 -lapp
    

    But I'll really like to be able to build for both architectures in one go - so I don't end up having to maintain two builds in the app store? Is this possible?

    jsulmJ 1 Reply Last reply
    1
    • L Larpon

      I have a QMake .pri file with something like this:

      LIBS += \
              -L$$PWD/sdk/libs/ios/arm64 -laid \
              -L$$PWD/sdk/libs/ios/arm64 -lapp \
              -L$$PWD/sdk/libs/ios/armv7 -laid \
              -L$$PWD/sdk/libs/ios/armv7 -lapp
      

      The libs are static libraries (aid.a, app.a). When I use QtCreator to compile the project (and deploy on ios) using xcode - I get linker errors if both LIBS are linked but it compiles and deploy fine if I take one of the architectures out and use QMAKE_IOS_DEVICE_ARCHS = armv7:

      QMAKE_IOS_DEVICE_ARCHS = armv7
      
      LIBS += \
              -L$$PWD/sdk/libs/ios/armv7 -laid \
              -L$$PWD/sdk/libs/ios/armv7 -lapp
      

      But I'll really like to be able to build for both architectures in one go - so I don't end up having to maintain two builds in the app store? Is this possible?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Larpon Check QMake documentation: http://doc.qt.io/qt-5/qmake-variable-reference.html
      It is done like this:

      unix:LIBS += -L/usr/local/lib -lmath
      win32:LIBS += c:/mylibs/math.lib
      

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • L Offline
        L Offline
        Larpon
        wrote on last edited by Larpon
        #3

        @jsulm thanks - I've seen that syntax before but how do I set it for eg. both ios armv7 and arm64?

        I can't find a list of ios specifics anywhere?

        It should maybe be something like:

        ios-armv7:LIBS += -L... -l...
        ios-arm64:LIBS += -L... -l...
        

        But these don't exist AFAIK?
        xcode is building multiple architectures but I can't find a way to include my static libs to each architecture - a solution within xcode would be ok I guess

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          AFAIK, the standard way to do that on macOS (but is also valid for iOS) is to assemble your different libraries builds into only one that is multi arch and then link your application to it.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          L 1 Reply Last reply
          0
          • SGaistS SGaist

            Hi,

            AFAIK, the standard way to do that on macOS (but is also valid for iOS) is to assemble your different libraries builds into only one that is multi arch and then link your application to it.

            L Offline
            L Offline
            Larpon
            wrote on last edited by
            #5

            @SGaist - cool thanks. So I should be able to do this to them? And link new.a yeah?

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Yes, exactly

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              L 1 Reply Last reply
              0
              • SGaistS SGaist

                Yes, exactly

                L Offline
                L Offline
                Larpon
                wrote on last edited by
                #7

                @SGaist Thank you very much!

                I haven't got around to test it properly yet - but I'm marking this as solved.

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved