Qt project file issues when building for android
-
I am attempting to use gmp, mpfr, and boost for an app that i will hopefully build for desktop and mobile (android), I got it to build with the x86 emulator but i really need it to work on an arm environment as well.
The problem ...
QT += qml quick CONFIG += c++11 SOURCES += main.cpp \ dynamicentrymodel.cpp \ file.cpp \ fileitem.cpp RESOURCES += qml.qrc # Additional import path used to resolve QML modules in Qt Creator's code model QML_IMPORT_PATH = # Additional import path used to resolve QML modules just for Qt Quick Designer QML_DESIGNER_IMPORT_PATH = # The following define makes your compiler emit warnings if you use # any feature of Qt which as been marked deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target contains(ANDROID_TARGET_ARCH,armeabi-v7a) { MPFR_GMP_PATH = C:\Users\thenthusiast\Documents\Dev\androidlibs\android-mpfr-master BOOST_PATH = C:\Users\thenthusiast\Documents\Dev\androidlibs\Boost-for-Android-Prebuilt-master\boost_1_64_0 ANDROID_EXTRA_LIBS = C:\Users\thenthusiast\Documents\Dev\androidlibs\android-mpfr-master\armeabi-v7a\libgmp.so C:\Users\thenthusiast\Documents\Dev\androidlibs\android-mpfr-master\armeabi-v7a\libmpfr.so QMAKE_LIBDIR +=$${MPFR_GMP_PATH}\armeabi-v7a QMAKE_LIBDIR +=$${BOOST_PATH}\armeabi-v7a INCLUDEPATH += $${MPFR_GMP_PATH}\armeabi-v7a INCLUDEPATH += $${MPFR_GMP_PATH} INCLUDEPATH += $${BOOST_PATH}\include LIBS += -lmpfr -lgmp } contains(ANDROID_TARGET_ARCH,x86) { MPFR_GMP_PATH = C:\Users\thenthusiast\Documents\Dev\androidlibs\android-mpfr-master BOOST_PATH = C:\Users\thenthusiast\Documents\Dev\androidlibs\Boost-for-Android-Prebuilt-master\boost_1_64_0 ANDROID_EXTRA_LIBS = C:/Users/thenthusiast/Documents/qtprojects/Asistantrials/../../Dev/androidlibs/android-mpfr-master/x86/libgmp.so C:/Users/thenthusiast/Documents/qtprojects/Asistantrials/../../Dev/androidlibs/android-mpfr-master/x86/libmpfr.so QMAKE_LIBDIR +=$${MPFR_GMP_PATH}\x86 QMAKE_LIBDIR +=$${BOOST_PATH}\x86 INCLUDEPATH += $${MPFR_GMP_PATH}\x86 INCLUDEPATH += $${MPFR_GMP_PATH} INCLUDEPATH += $${BOOST_PATH}\include LIBS += -lmpfr -lgmp } win32 { GMP_PATH = C:\Users\thenthusiast\Documents\Dev\gmp\gmp32 MPFR_PATH = C:\Users\thenthusiast\Documents\Dev\mpfr\mpfr32 INCLUDEPATH += $${GMP_PATH} INCLUDEPATH += $${MPFR_PATH} INCLUDEPATH += C:\Users\thenthusiast\Documents\Dev\boost QMAKE_LIBDIR +=$${GMP_PATH} QMAKE_LIBDIR +=$${MPFR_PATH} LIBS += -lmpfr -lgmp } HEADERS += \ dynamicentrymodel.h \ file.h \ fileitem.h DISTFILES +=
This is the project file as i would like it. (I have used qt before but i have't done too much project file editing so it may be a little off).
i would like to make conditions so qmake knows when to link and package the correct libs with out commenting out bits of the file.
everything desktop (win32) is fine but when i build for android using armabi-v7a i get issues unless i comment out the x86 bit.
to be honest i don't really understand what the
contains()
statement means , i can't seem to find it in the docs. I used it after it was generated after i used build setting to add the libs.. so i figured i could use it to set paths and link as well( this might be the issue and if so what could be an alternative ?) . also about the linking... x86 seems to work when i use
LIBS += -lmpfr -lgmp
but arm seems to link the added libs automatically .. would anyone know the correct thing to do there . the issues when arm is build are ..
1 when it does compile it works when the file is like so ..
contains(ANDROID_TARGET_ARCH,armeabi-v7a) { MPFR_GMP_PATH = C:\Users\thenthusiast\Documents\Dev\androidlibs\android-mpfr-master BOOST_PATH = C:\Users\thenthusiast\Documents\Dev\androidlibs\Boost-for-Android-Prebuilt-master\boost_1_64_0 ANDROID_EXTRA_LIBS = C:\Users\thenthusiast\Documents\Dev\androidlibs\android-mpfr-master\armeabi-v7a\libgmp.so C:\Users\thenthusiast\Documents\Dev\androidlibs\android-mpfr-master\armeabi-v7a\libmpfr.so QMAKE_LIBDIR +=$${MPFR_GMP_PATH}\armeabi-v7a QMAKE_LIBDIR +=$${BOOST_PATH}\armeabi-v7a INCLUDEPATH += $${MPFR_GMP_PATH}\armeabi-v7a INCLUDEPATH += $${MPFR_GMP_PATH} # INCLUDEPATH += $${BOOST_PATH}\include LIBS += -lmpfr -lgmp } #contains(ANDROID_TARGET_ARCH,x86) #{ # MPFR_GMP_PATH = C:\Users\thenthusiast\Documents\Dev\androidlibs\android-mpfr-master # BOOST_PATH = C:\Users\thenthusiast\Documents\Dev\androidlibs\Boost-for-Android-Prebuilt-master\boost_1_64_0 # ANDROID_EXTRA_LIBS = C:/Users/thenthusiast/Documents/qtprojects/Asistantrials/../../Dev/androidlibs/android-mpfr-master/x86/libgmp.so C:/Users/thenthusiast/Documents/qtprojects/Asistantrials/../../Dev/androidlibs/android-mpfr-master/x86/libmpfr.so # QMAKE_LIBDIR +=$${MPFR_GMP_PATH}\x86 # QMAKE_LIBDIR +=$${BOOST_PATH}\x86 # INCLUDEPATH += $${MPFR_GMP_PATH}\x86 # INCLUDEPATH += $${MPFR_GMP_PATH} # INCLUDEPATH += $${BOOST_PATH}\include #LIBS += -lmpfr -lgmp #} win32 { GMP_PATH = C:\Users\thenthusiast\Documents\Dev\gmp\gmp32 MPFR_PATH = C:\Users\thenthusiast\Documents\Dev\mpfr\mpfr32 INCLUDEPATH += $${GMP_PATH} INCLUDEPATH += $${MPFR_PATH} INCLUDEPATH += C:\Users\thenthusiast\Documents\Dev\boost QMAKE_LIBDIR +=$${GMP_PATH} QMAKE_LIBDIR +=$${MPFR_PATH} LIBS += -lmpfr -lgmp }
if i leave certain things un commented in x86 i get diff issues , for example when i leave the
LIBS += -lmpfr -lgmp
the app crashes when it gets deployed.
2 .. another unrelated issue that is confusing is boost. after many unsuccessful attempts to compile gmp, mpfr and boost for android i just got them from git all compiled against android build sdk 19, so that's what i am compiling against( just in case this is also an issue).
all is well again with x86 but when i add the include folderINCLUDEPATH += $${BOOST_PATH}\include
i get this error
error: No rule to make target '../../Dev/androidlibs/Boost-for-Android-Prebuilt-master/boost_1_64_0/include/boost/numeric/conversion/detail/preprocessed/numeric_cast_traits_common.hpp', needed by 'main.obj'. Stop.
but when its not added it works (not so on x86).
so to summarize i need to make conditions to build for android arm and android x86. I also am confused as to how the arm build is finding boost files and errors are happening when its included .. but this is not really an issue.
-
Did you solve this problem? I have a simmilar issue
:-1: error: dependent '..\App\vcpkg\installed\x86-windows\include\boost\numeric\conversion\detail\preprocessed\numeric_cast_traits_common.hpp' does not exist.
although it does exsist...