Qt + Android problem



  • Hi,

    I have installed Qt and Android SDK and NDK and I'm trying to compile a project but I got this error:

    09:13:03: Running steps for project ContainerApp...
    09:13:03: Starting: "/home/amsantosr/Applications/Qt/5.11.1/android_armv7/bin/qmake" /home/amsantosr/Projects/ContainerApp/ContainerApp.pro -spec android-g++ CONFIG+=debug CONFIG+=qml_debug
    clang++: error: unknown argument: '-mthumb-interwork'
    Project ERROR: failed to parse default search paths from compiler output
    09:13:03: The process "/home/amsantosr/Applications/Qt/5.11.1/android_armv7/bin/qmake" exited with code 3.
    Error while building/deploying project ContainerApp (kit: Android for armeabi-v7a (GCC 4.9, Qt 5.11.1 for Android armv7))
    When executing step "qmake"
    09:13:03: Elapsed time: 00:00.
    

    Any suggestions?

    Thanks



  • @amsantosr said in Qt + Android problem:

    clang++: error: unknown argument: '-mthumb-interwork'

    Are you using Clang instead of GCC for this build? I'm asking because the error you have:

    clang++: error: unknown argument: '-mthumb-interwork'

    is a response from clang as it doesn't understand the argument used by GCC (all -m args are ARM options)



  • @Pablo-J.-Rogina said in Qt + Android problem:

    @amsantosr said in Qt + Android problem:

    clang++: error: unknown argument: '-mthumb-interwork'

    Are you using Clang instead of GCC for this build? I'm asking because the error you have:

    clang++: error: unknown argument: '-mthumb-interwork'

    is a response from clang as it doesn't understand the argument used by GCC (all -m args are ARM options)

    I don't want to use clang++. I am trying to use the default Qt and Android build configuration. How should I configure them correctly?



  • @amsantosr I assume you're using Qt Creator. Could you please share the kits configured there?





  • @amsantosr your kit seems Ok, and it was auto-detected by Qt Creator.

    However, you may have been bitten by the "using latest software packages" bug. It looks like GCC was ditched from Android NDK as of revision r18 (Sep/18).

    I haven't tried it myself yet, but I suspect that it might be using some symlink so calls to gcc still works using underlying clang. But for some special conditions (the ARM options here), it may not work.

    I'd suggest to try a previous NDK release which still has GCC available...



  • @Pablo-J.-Rogina Solved! I tried with android-ndk-r17c and it worked. Thank you!



  • I hardly vote that this thread isn't solved. Relying on a deprecated implementation is not a solution:
    Even with Android NDK r17 the gcc part was depricated:
    https://github.com/android-ndk/ndk/wiki/Changelog-r17

    The current release removed the deprecated gcc:
    https://developer.android.com/ndk/downloads/revision_history

    This was focused to deploy up-to-date libstdc++ as part of clang:
    https://developer.android.com/ndk/guides/cpp-support#libc

    Relying on the deprecated gcc disables modern C++ usage like C++17, C++14 or parts of C++11. This is a no-go for current software development. So an specific bug has to be filed to work correctly with non deprecated compilers.



  • @cguenther-0 said in Qt + Android problem:

    So an specific bug has to be filed to work correctly with non deprecated compilers.

    You are more than welcome to file such a bug. Whenever you have the ticket number, you can update this post for further reference. Thanks



  • I just run into this problem too. The bug report was already created in May but was unfortunately closed as invalid.

    Unfortunately the Android port of Qt is very poorly maintained. There is a lot of annoying bugs that nobody cares about. With each new version of Qt one problem is fixed and two new appear. :-(


  • Lifetime Qt Champion

    @vlada What you might be ignoring is that the Android NDK releases are a real pain as its developers are changing things here and there breaking workflow if not compilation. It's for a reason that r10e has stayed the reference for so long. Most of the releases in between have broken stuff one way or another and that's outside of Qt. IIRC r17 is the first that can be used since r10e.



  • @SGaist I know it is very difficult to keep up with all the changes Google is making to Android NDK. But sometimes it takes IMO too much time to fix the problems. I'm using the r17 and didn't run into any problems. Of course mith r18 Qt won't work at all because of the switch to Clang.



  • @amsantosr said in Qt + Android problem:

    @Pablo-J.-Rogina Solved! I tried with android-ndk-r17c and it worked. Thank you!

    Hi @amsantosr ,
    I'm facing exactly the same problem, but I have problems also with r17c.

    Could you provide the complete configure options you have used?

    Which Android platform version are you using? (I need 26, and the device is armeabi-v7a)

    Thanks in advance!

    The error I get:

    Checking for target architecture... 
    + cd /build/users/davide/git/qt5-sources/config.tests/arch && /build/users/davide/git/qt5-sources/qtbase/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console s
    ingle_arch" "QMAKE_CFLAGS += --sysroot=/build/users/davide/android/ndk/android-ndk-r17c/platforms/android-26/arch-arm" "QMAKE_CXXFLAGS += --sysroot=/build/users/davide/android/ndk/android-ndk-r17c/platforms
    /android-26/arch-arm" "QMAKE_LFLAGS += --sysroot=/build/users/davide/android/ndk/android-ndk-r17c/platforms/android-26/arch-arm" -early "CONFIG += cross_compile" /build/users/davide/git/qt5-sources/qtbase/c
    onfig.tests/arch
    + cd /build/users/davide/git/qt5-sources/config.tests/arch && MAKEFLAGS= /usr/bin/make
    > /build/users/davide/android/ndk/android-ndk-r17c/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -c -D__ANDROID_API__=26 --sysroot=/build/users/davide/android/ndk/
    android-ndk-r17c/sysroot -isystem /build/users/davide/android/ndk/android-ndk-r17c/sysroot/usr/include/arm-linux-androideabi -isystem /build/users/davide/android/ndk/android-ndk-r17c/sources/cxx-stl/gnu-lib
    stdc++/4.9/include -isystem /build/users/davide/android/ndk/android-ndk-r17c/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -fstack-protector-strong -DANDROID -march=armv7-a -mfloat-abi=softfp -
    mfpu=vfp -fno-builtin-memmove --sysroot=/build/users/davide/android/ndk/android-ndk-r17c/platforms/android-26/arch-arm -mthumb -Os -std=gnu++11 -fPIC  -I/build/users/davide/git/qt5-sources/qtbase/config.tes
    ts/arch -I. -I/build/users/davide/git/qt5-sources/qtbase/mkspecs/android-g++ -o arch.o /build/users/davide/git/qt5-sources/qtbase/config.tests/arch/arch.cpp
    > /build/users/davide/git/qt5-sources/qtbase/config.tests/arch/arch.cpp:43:19: fatal error: stdio.h: No such file or directory
    >  #include <stdio.h>
    >                    ^
    > compilation terminated.
    > Makefile:177: recipe for target 'arch.o' failed
    > make: *** [arch.o] Error 1
    Project ERROR: Could not determine target architecture. See config.log for details.
    

    My configure args:

    ./configure \
            -xplatform android-g++ \
            --disable-rpath \
            -sysroot $HOME/android/ndk/android-ndk-r17c/platforms/android-26/arch-arm \
            -android-ndk $HOME/android/ndk/android-ndk-r17c \
            -android-sdk ~/android/sdk \
            -android-ndk-host linux-x86_64 \
            -android-ndk-platform android-26 \
            -android-toolchain-version 4.9 \
            -android-arch armeabi-v7a \
            --prefix=./out \
            -nomake examples \
            -nomake tests \
            -skip qt3d \
            -skip qtactiveqt \
            -skip qtcanvas3d \
            -skip qtcharts \
            -skip qtdatavis3d \
            -skip qtdeclarative \
            -skip qtdoc \
            -skip qtdocgallery \
            -skip qtgamepad \
            -skip qtgraphicaleffects \
            -skip qtmacextras \
            -skip qtpurchasing \
            -skip qtqa \
            -skip qtquickcontrols \
            -skip qtquickcontrols2 \
            -skip qtrepotools \
            -skip qtscript \
            -skip qtscxml \
            -skip qtserialport \
            -skip qttranslations \
            -skip qtwayland  \
            -skip qtwebengine \
            -skip qtwebglplugin \
            -skip qtwebview \
            -skip qtwinextras \
            -skip qtx11extras \
            -no-warnings-are-errors \
            -opensource \
            -confirm-license \
            -verbose
    


  • A similar problem was described here. I hope it might help you.

    However it works on my computer with Android-NDK R17, Qt 5.10 and 5.11, Java SDK 8 and latest Android SDK (API 28, Gradle 4.4, have some problems with 4.6).

    I have the missing header file is in this directory: ..\ndk-bundle\sources\cxx-stl\gnu-libstdc++\4.9\include\tr1\stdio.h

    But the problem doesn't seem to be in the header file. The make process complains that target architecture was not defined. I would look towards this direction for the problem.



  • Hi,

    I have a similar problem.
    Starting qtcreator I get an error:

    clang++: error: unknown argument: '-mthumb-interwork'
    

    Trying to compile an app for android i got this error:

    Project ERROR: failed to parse default search paths from compiler output
    

    and this error:

    Fehler beim Auswerten der Datei myProjekt.pro. 
    

    in english: Error when evaluating the file myProjekt.pro.

    I think the problem is the clang error. But I have no idea where it comes from.
    When I compile the same code as a desktop app there is no error.
    I have the same configuration as shown above from @amsantosr

    Any ideas?


  • Lifetime Qt Champion

    Hi,

    You are likely using ndk18 which is not yet support (but almost) so currently as already suggested earlier in this thread use a prior version of it.



  • @SGaist : you where right, I changed to ndk 17c and it works :-)
    Thanks!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.