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. Problem Building a Subdirs Project for armeabi-v7a AND arm64-v8a Using Qt 5.14.
QtWS25 Last Chance

Problem Building a Subdirs Project for armeabi-v7a AND arm64-v8a Using Qt 5.14.

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
9 Posts 2 Posters 1.2k 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.
  • M Offline
    M Offline
    Mowijo
    wrote on 17 Mar 2020, 09:58 last edited by
    #1

    Problem

    I have a problem building a subdirs project for armeabi-v7a AND arm64-v8a using Qt 5.14.1 on a Linux host using qmake.

    Description

    I have a library and a an app in a subdirs project and when building i get a naming conflict. The the v7 and the v8 version of the library has the same name and hence I get a conflict.
    Therefore I have made a qmake rule that append the library name with the architecture. However, the v7 is never build for some reason and that is my problem.

    I have created a complete example to reproduce the behavior.

    You can try to run build.sh after fitting it to your platform. On my machine it outputs

    1 Info: creating stash file /home/morten/multiarch-problem/build/.qmake.stash
    2 Reading /home/morten/multiarch-problem/lib/lib.pro [/home/morten/multiarch-problem/build/lib]
    3 Project MESSAGE: Building lib as adder-arm64-v8a
    4 Reading /home/morten/multiarch-problem/app/app.pro [/home/morten/multiarch-problem/build/app]
    5 Project MESSAGE: Links app with -L/home/morten/multiarch-problem/build/app/../lib -ladder-arm64-v8a
    6 Project MESSAGE: Links app with -L/home/morten/multiarch-problem/build/app/../lib -ladder-armeabi-v7a
    7 Project MESSAGE: Links app with -L/home/morten/multiarch-problem/build/app/../lib -ladder-arm64-v8a
    8 ...
    

    What is weird is, that in line 3 the libs .pro file is processed by qmake with v8 abi but never with v7 abi. We can see from line 5,6 and 7 that the app is processed with both abis [1] but apparently not the lib.

    • A: What do I do wrong?
    • B: Am I approaching this in the completely wrong way?
    • C: Basically I just want to build a subdir project with an app and two libraries and make an multi arch apk or abb out of it. If I am approaching it the wrong way, what is the correct?

    How to Reproduce

    • Unpack the project
    • Modify build.sh to match your environment
    • cd into folder
    • Run build.sh
    • Observe how it fails. Complete log is attached as [2]

    Best regards,
    Morten

    [1] : Actually it is processed twice with v8, which I dont understand.
    [2] :

    morten@xps15:~/multiarch-problem$ rm -rf build ; ./build.sh 
    Info: creating stash file /home/morten/multiarch-problem/build/.qmake.stash
    Reading /home/morten/multiarch-problem/lib/lib.pro [/home/morten/multiarch-problem/build/lib]
    Project MESSAGE: Building lib as adder-arm64-v8a
    Reading /home/morten/multiarch-problem/app/app.pro [/home/morten/multiarch-problem/build/app]
    Project MESSAGE: Links app with -L/home/morten/multiarch-problem/build/app/../lib -ladder-arm64-v8a
    Project MESSAGE: Links app with -L/home/morten/multiarch-problem/build/app/../lib -ladder-armeabi-v7a
    Project MESSAGE: Links app with -L/home/morten/multiarch-problem/build/app/../lib -ladder-arm64-v8a
    cd lib/ && ( test -e Makefile || /home/morten/Qt5.14.1/5.14.1/android/bin/qmake -o Makefile /home/morten/multiarch-problem/lib/lib.pro -spec android-clang CONFIG+=qtquickcompiler 'ANDROID_ABIS=armeabi-v7a arm64-v8a' CONFIG+=silent ) && /opt/android/android-ndk-r21/prebuilt/linux-x86_64/bin/make -f Makefile 
    make[1]: Entering directory '/home/morten/multiarch-problem/build/lib'
    /opt/android/android-ndk-r21/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -c -target aarch64-linux-android21 -fno-limit-debug-info -fPIC -fstack-protector-strong -DANDROID -O2  -I../../lib -I/home/morten/multiarch-problem/build/lib -I../../../Qt5.14.1/5.14.1/android/mkspecs/android-clang -o Adder.o ../../lib/Adder.cpp
    rm -f libadder-arm64-v8a.a
    /opt/android/android-ndk-r21/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar cqs libadder-arm64-v8a.a Adder.o
    /opt/android/android-ndk-r21/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-ranlib libadder-arm64-v8a.a
    make[1]: Leaving directory '/home/morten/multiarch-problem/build/lib'
    cd app/ && ( test -e Makefile || /home/morten/Qt5.14.1/5.14.1/android/bin/qmake -o Makefile /home/morten/multiarch-problem/app/app.pro -spec android-clang CONFIG+=qtquickcompiler 'ANDROID_ABIS=armeabi-v7a arm64-v8a' CONFIG+=silent ) && /opt/android/android-ndk-r21/prebuilt/linux-x86_64/bin/make -f Makefile 
    make[1]: Entering directory '/home/morten/multiarch-problem/build/app'
    /opt/android/android-ndk-r21/prebuilt/linux-x86_64/bin/make -f Makefile.Armeabi-v7a all
    /opt/android/android-ndk-r21/prebuilt/linux-x86_64/bin/make -f Makefile.Arm64-v8a all
    make[2]: Entering directory '/home/morten/multiarch-problem/build/app'
    make[2]: Entering directory '/home/morten/multiarch-problem/build/app'
    uic ../../app/mainwindow.ui
    uic ../../app/mainwindow.ui
    compiling ../../app/main.cpp
    generating armeabi-v7a/moc_predefs.h
    compiling ../../app/mainwindow.cpp
    compiling ../../app/main.cpp
    generating arm64-v8a/moc_predefs.h
    compiling ../../app/mainwindow.cpp
    moc ../../app/mainwindow.h
    moc ../../app/mainwindow.h
    compiling armeabi-v7a/moc_mainwindow.cpp
    compiling arm64-v8a/moc_mainwindow.cpp
    linking libapp_armeabi-v7a.so
    /opt/android/android-ndk-r21/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -ladder-armeabi-v7a
    armeabi-v7a/main.o:main.cpp:function main: error: undefined reference to 'add(int, int)'
    clang++: error: linker command failed with exit code 1 (use -v to see invocation)
    make[2]: *** [Makefile.Armeabi-v7a:248: libapp_armeabi-v7a.so] Error 1
    make[2]: Leaving directory '/home/morten/multiarch-problem/build/app'
    make[1]: *** [Makefile:46: armeabi-v7a-all] Error 2
    make[1]: *** Waiting for unfinished jobs....
    linking libapp_arm64-v8a.so
    make[2]: Leaving directory '/home/morten/multiarch-problem/build/app'
    make[1]: Leaving directory '/home/morten/multiarch-problem/build/app'
    make: *** [Makefile:73: sub-app-make_first] Error 2
    
    J 1 Reply Last reply 17 Mar 2020, 10:16
    0
    • M Mowijo
      17 Mar 2020, 09:58

      Problem

      I have a problem building a subdirs project for armeabi-v7a AND arm64-v8a using Qt 5.14.1 on a Linux host using qmake.

      Description

      I have a library and a an app in a subdirs project and when building i get a naming conflict. The the v7 and the v8 version of the library has the same name and hence I get a conflict.
      Therefore I have made a qmake rule that append the library name with the architecture. However, the v7 is never build for some reason and that is my problem.

      I have created a complete example to reproduce the behavior.

      You can try to run build.sh after fitting it to your platform. On my machine it outputs

      1 Info: creating stash file /home/morten/multiarch-problem/build/.qmake.stash
      2 Reading /home/morten/multiarch-problem/lib/lib.pro [/home/morten/multiarch-problem/build/lib]
      3 Project MESSAGE: Building lib as adder-arm64-v8a
      4 Reading /home/morten/multiarch-problem/app/app.pro [/home/morten/multiarch-problem/build/app]
      5 Project MESSAGE: Links app with -L/home/morten/multiarch-problem/build/app/../lib -ladder-arm64-v8a
      6 Project MESSAGE: Links app with -L/home/morten/multiarch-problem/build/app/../lib -ladder-armeabi-v7a
      7 Project MESSAGE: Links app with -L/home/morten/multiarch-problem/build/app/../lib -ladder-arm64-v8a
      8 ...
      

      What is weird is, that in line 3 the libs .pro file is processed by qmake with v8 abi but never with v7 abi. We can see from line 5,6 and 7 that the app is processed with both abis [1] but apparently not the lib.

      • A: What do I do wrong?
      • B: Am I approaching this in the completely wrong way?
      • C: Basically I just want to build a subdir project with an app and two libraries and make an multi arch apk or abb out of it. If I am approaching it the wrong way, what is the correct?

      How to Reproduce

      • Unpack the project
      • Modify build.sh to match your environment
      • cd into folder
      • Run build.sh
      • Observe how it fails. Complete log is attached as [2]

      Best regards,
      Morten

      [1] : Actually it is processed twice with v8, which I dont understand.
      [2] :

      morten@xps15:~/multiarch-problem$ rm -rf build ; ./build.sh 
      Info: creating stash file /home/morten/multiarch-problem/build/.qmake.stash
      Reading /home/morten/multiarch-problem/lib/lib.pro [/home/morten/multiarch-problem/build/lib]
      Project MESSAGE: Building lib as adder-arm64-v8a
      Reading /home/morten/multiarch-problem/app/app.pro [/home/morten/multiarch-problem/build/app]
      Project MESSAGE: Links app with -L/home/morten/multiarch-problem/build/app/../lib -ladder-arm64-v8a
      Project MESSAGE: Links app with -L/home/morten/multiarch-problem/build/app/../lib -ladder-armeabi-v7a
      Project MESSAGE: Links app with -L/home/morten/multiarch-problem/build/app/../lib -ladder-arm64-v8a
      cd lib/ && ( test -e Makefile || /home/morten/Qt5.14.1/5.14.1/android/bin/qmake -o Makefile /home/morten/multiarch-problem/lib/lib.pro -spec android-clang CONFIG+=qtquickcompiler 'ANDROID_ABIS=armeabi-v7a arm64-v8a' CONFIG+=silent ) && /opt/android/android-ndk-r21/prebuilt/linux-x86_64/bin/make -f Makefile 
      make[1]: Entering directory '/home/morten/multiarch-problem/build/lib'
      /opt/android/android-ndk-r21/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -c -target aarch64-linux-android21 -fno-limit-debug-info -fPIC -fstack-protector-strong -DANDROID -O2  -I../../lib -I/home/morten/multiarch-problem/build/lib -I../../../Qt5.14.1/5.14.1/android/mkspecs/android-clang -o Adder.o ../../lib/Adder.cpp
      rm -f libadder-arm64-v8a.a
      /opt/android/android-ndk-r21/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar cqs libadder-arm64-v8a.a Adder.o
      /opt/android/android-ndk-r21/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-ranlib libadder-arm64-v8a.a
      make[1]: Leaving directory '/home/morten/multiarch-problem/build/lib'
      cd app/ && ( test -e Makefile || /home/morten/Qt5.14.1/5.14.1/android/bin/qmake -o Makefile /home/morten/multiarch-problem/app/app.pro -spec android-clang CONFIG+=qtquickcompiler 'ANDROID_ABIS=armeabi-v7a arm64-v8a' CONFIG+=silent ) && /opt/android/android-ndk-r21/prebuilt/linux-x86_64/bin/make -f Makefile 
      make[1]: Entering directory '/home/morten/multiarch-problem/build/app'
      /opt/android/android-ndk-r21/prebuilt/linux-x86_64/bin/make -f Makefile.Armeabi-v7a all
      /opt/android/android-ndk-r21/prebuilt/linux-x86_64/bin/make -f Makefile.Arm64-v8a all
      make[2]: Entering directory '/home/morten/multiarch-problem/build/app'
      make[2]: Entering directory '/home/morten/multiarch-problem/build/app'
      uic ../../app/mainwindow.ui
      uic ../../app/mainwindow.ui
      compiling ../../app/main.cpp
      generating armeabi-v7a/moc_predefs.h
      compiling ../../app/mainwindow.cpp
      compiling ../../app/main.cpp
      generating arm64-v8a/moc_predefs.h
      compiling ../../app/mainwindow.cpp
      moc ../../app/mainwindow.h
      moc ../../app/mainwindow.h
      compiling armeabi-v7a/moc_mainwindow.cpp
      compiling arm64-v8a/moc_mainwindow.cpp
      linking libapp_armeabi-v7a.so
      /opt/android/android-ndk-r21/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -ladder-armeabi-v7a
      armeabi-v7a/main.o:main.cpp:function main: error: undefined reference to 'add(int, int)'
      clang++: error: linker command failed with exit code 1 (use -v to see invocation)
      make[2]: *** [Makefile.Armeabi-v7a:248: libapp_armeabi-v7a.so] Error 1
      make[2]: Leaving directory '/home/morten/multiarch-problem/build/app'
      make[1]: *** [Makefile:46: armeabi-v7a-all] Error 2
      make[1]: *** Waiting for unfinished jobs....
      linking libapp_arm64-v8a.so
      make[2]: Leaving directory '/home/morten/multiarch-problem/build/app'
      make[1]: Leaving directory '/home/morten/multiarch-problem/build/app'
      make: *** [Makefile:73: sub-app-make_first] Error 2
      
      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 17 Mar 2020, 10:16 last edited by
      #2

      @Mowijo said in Problem Building a Subdirs Project for armeabi-v7a AND arm64-v8a Using Qt 5.14.:

      add(int, int)

      Where is it defined?

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

      M 1 Reply Last reply 17 Mar 2020, 10:19
      0
      • J jsulm
        17 Mar 2020, 10:16

        @Mowijo said in Problem Building a Subdirs Project for armeabi-v7a AND arm64-v8a Using Qt 5.14.:

        add(int, int)

        Where is it defined?

        M Offline
        M Offline
        Mowijo
        wrote on 17 Mar 2020, 10:19 last edited by
        #3

        Dear @jsulm

        Thanks for taking the time to reply

        Where is it defined?

        int add(int,int) is defined in lib/Adder.cpp

        Thanks,
        Morten

        J 1 Reply Last reply 17 Mar 2020, 10:19
        0
        • M Mowijo
          17 Mar 2020, 10:19

          Dear @jsulm

          Thanks for taking the time to reply

          Where is it defined?

          int add(int,int) is defined in lib/Adder.cpp

          Thanks,
          Morten

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 17 Mar 2020, 10:19 last edited by
          #4

          @Mowijo And you're linking against that lib?

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

          M 1 Reply Last reply 17 Mar 2020, 10:29
          0
          • J jsulm
            17 Mar 2020, 10:19

            @Mowijo And you're linking against that lib?

            M Offline
            M Offline
            Mowijo
            wrote on 17 Mar 2020, 10:29 last edited by
            #5

            @jsulm said in Problem Building a Subdirs Project for armeabi-v7a AND arm64-v8a Using Qt 5.14.:

            @Mowijo And you're linking against that lib?

            Yes I am, but it is not build for armeabi-v7a which is the core of my problem.
            If I build for arm64-v8a, the lib is build but not when building for armeabi-v7a

            J 1 Reply Last reply 17 Mar 2020, 11:55
            0
            • M Mowijo
              17 Mar 2020, 10:29

              @jsulm said in Problem Building a Subdirs Project for armeabi-v7a AND arm64-v8a Using Qt 5.14.:

              @Mowijo And you're linking against that lib?

              Yes I am, but it is not build for armeabi-v7a which is the core of my problem.
              If I build for arm64-v8a, the lib is build but not when building for armeabi-v7a

              J Offline
              J Offline
              jsulm
              Lifetime Qt Champion
              wrote on 17 Mar 2020, 11:55 last edited by
              #6

              @Mowijo Somehow I don't get the problem: if you build for v8a then you build for v8a, if you build for v7a then you build for v7a. There should not be any naming conflicts. Or are you building for both platforms in same build directory?

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

              M 1 Reply Last reply 17 Mar 2020, 12:19
              0
              • J jsulm
                17 Mar 2020, 11:55

                @Mowijo Somehow I don't get the problem: if you build for v8a then you build for v8a, if you build for v7a then you build for v7a. There should not be any naming conflicts. Or are you building for both platforms in same build directory?

                M Offline
                M Offline
                Mowijo
                wrote on 17 Mar 2020, 12:19 last edited by
                #7

                @jsulm said in Problem Building a Subdirs Project for armeabi-v7a AND arm64-v8a Using Qt 5.14.:

                Or are you building for both platforms in same build directory?

                Yes. I am building for both abis in the same build.

                @jsulm said in Problem Building a Subdirs Project for armeabi-v7a AND arm64-v8a Using Qt 5.14.:

                Somehow I don't get the problem: if you build for v8a then you build for v8a

                And in that case the library is build.

                @jsulm said in Problem Building a Subdirs Project for armeabi-v7a AND arm64-v8a Using Qt 5.14.:

                if you build for v7a then you build for v7a.

                And in that case the library is NOT build. No matter if I build for both ABI's or only the v7.

                J 1 Reply Last reply 18 Mar 2020, 06:16
                0
                • M Mowijo
                  17 Mar 2020, 12:19

                  @jsulm said in Problem Building a Subdirs Project for armeabi-v7a AND arm64-v8a Using Qt 5.14.:

                  Or are you building for both platforms in same build directory?

                  Yes. I am building for both abis in the same build.

                  @jsulm said in Problem Building a Subdirs Project for armeabi-v7a AND arm64-v8a Using Qt 5.14.:

                  Somehow I don't get the problem: if you build for v8a then you build for v8a

                  And in that case the library is build.

                  @jsulm said in Problem Building a Subdirs Project for armeabi-v7a AND arm64-v8a Using Qt 5.14.:

                  if you build for v7a then you build for v7a.

                  And in that case the library is NOT build. No matter if I build for both ABI's or only the v7.

                  J Offline
                  J Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on 18 Mar 2020, 06:16 last edited by
                  #8

                  @Mowijo said in Problem Building a Subdirs Project for armeabi-v7a AND arm64-v8a Using Qt 5.14.:

                  I am building for both abis in the same build.

                  Why? Usually one builds for each ABI in a separate build to not mess up.

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

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    Mowijo
                    wrote on 18 Mar 2020, 07:30 last edited by
                    #9

                    @jsulm said in Problem Building a Subdirs Project for armeabi-v7a AND arm64-v8a Using Qt 5.14.:

                    Why? Usually one builds for each ABI in a separate build to not mess up.

                    Because that is how it is done from Qt 5.14 and forward. Or how it is supposed to be, at least.

                    1 Reply Last reply
                    2

                    9/9

                    18 Mar 2020, 07:30

                    • Login

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