Fix .pro file to find QT_HOME
-
My
.profile has the following entries:ANDROID_EXTRA_LIBS = \ $$(QT_HOME)/android_armv7/lib/libQt5Sql.so \ $$_PRO_FILE_PWD_/libs/android_armv7/libcrypto.so \ $$_PRO_FILE_PWD_/libs/android_armv7/libssl.so }When I try to build, it fails saying:
External library /android_armv7/lib/libQt5Sql.so does not exist!I can "fix" this by hacking
.profile to use an absolute path, but clearly this is machine-specific and the wrong way to fix this problem.ANDROID_EXTRA_LIBS = \ - $$(QT_HOME)/android_armv7/lib/libQt5Sql.so \ + /home/gkistner/Qt/5.9.1/android_armv7/lib/libQt5Sql.so \How/where do I need to set
QT_HOMEso that the project builds properly for everyone/every system? -
Hi,
AFAIK, the
QT += sqlligne should set things up appropriately for you. -
My
.profile has the following entries:ANDROID_EXTRA_LIBS = \ $$(QT_HOME)/android_armv7/lib/libQt5Sql.so \ $$_PRO_FILE_PWD_/libs/android_armv7/libcrypto.so \ $$_PRO_FILE_PWD_/libs/android_armv7/libssl.so }When I try to build, it fails saying:
External library /android_armv7/lib/libQt5Sql.so does not exist!I can "fix" this by hacking
.profile to use an absolute path, but clearly this is machine-specific and the wrong way to fix this problem.ANDROID_EXTRA_LIBS = \ - $$(QT_HOME)/android_armv7/lib/libQt5Sql.so \ + /home/gkistner/Qt/5.9.1/android_armv7/lib/libQt5Sql.so \How/where do I need to set
QT_HOMEso that the project builds properly for everyone/every system?@Phrogz said in Fix .pro file to find QT_HOME:
How/where do I need to set QT_HOME so that the project builds properly for everyone/every system?
QT_HOME=/some/path qmake projectname.proYou're using a syntax specifically tailored for environment variables (obtained when
qmakeis run). If you don't have that environment variable set, then it will expand to nothing. -
@Phrogz said in Fix .pro file to find QT_HOME:
How/where do I need to set QT_HOME so that the project builds properly for everyone/every system?
QT_HOME=/some/path qmake projectname.proYou're using a syntax specifically tailored for environment variables (obtained when
qmakeis run). If you don't have that environment variable set, then it will expand to nothing.@kshegunov Can you clarify which path you're referring to? (Path to qmake for Android? Path to the project?) And does it have to be absolute? Ideally the solution would not require any absolute paths (or even relative paths outside the project), since many developers can have the project repo cloned in various locations, and can have Qt installed in various locations.
-
@kshegunov Can you clarify which path you're referring to? (Path to qmake for Android? Path to the project?) And does it have to be absolute? Ideally the solution would not require any absolute paths (or even relative paths outside the project), since many developers can have the project repo cloned in various locations, and can have Qt installed in various locations.
@Phrogz What He is saying that in your pro file to add a new line with
QT += sqlThis will add SQL support and will automatically link to the lib
-
@kshegunov Can you clarify which path you're referring to? (Path to qmake for Android? Path to the project?) And does it have to be absolute? Ideally the solution would not require any absolute paths (or even relative paths outside the project), since many developers can have the project repo cloned in various locations, and can have Qt installed in various locations.
@Phrogz said in Fix .pro file to find QT_HOME:
Can you clarify which path you're referring to?
I'm referring to the environment variable you're using in your project file -
$$(QT_HOME). As other already noted it should be enough for you to specify only the modules you're using and Qt should take care of the rest. I have no knowledge of how Qt was installed and where it resides in your setup, I was explaining what the used syntax does. To make it clear, doing:ANDROID_EXTRA_LIBS = /home/gkistner/Qt/5.9.1/android_armv7/lib/libQt5Sql.sois equivalent to:
ANDROID_EXTRA_LIBS = $$(QT_HOME)/android_armv7/lib/libQt5Sql.sowhen
qmakeis called with the environment variableQT_HOMEset, i.e. callingqmakelike this:$> QT_HOME=/home/gkistner/Qt/5.9.1 qmake yourprojectfile.pro