Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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



  • 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
    

  • Qt Champions 2019



  • 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


  • Qt Champions 2019

    @Mowijo And you're linking against that lib?



  • @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


  • Qt Champions 2019

    @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?



  • @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.


  • Qt Champions 2019

    @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.



  • @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.


Log in to reply