Fix .pro file to find QT_HOME
-
My
.pro
file 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
.pro
file 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_HOME
so that the project builds properly for everyone/every system? -
Hi,
AFAIK, the
QT += sql
ligne should set things up appropriately for you. -
@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.pro
You're using a syntax specifically tailored for environment variables (obtained when
qmake
is 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.
-
@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.so
is equivalent to:
ANDROID_EXTRA_LIBS = $$(QT_HOME)/android_armv7/lib/libQt5Sql.so
when
qmake
is called with the environment variableQT_HOME
set, i.e. callingqmake
like this:$> QT_HOME=/home/gkistner/Qt/5.9.1 qmake yourprojectfile.pro