Fix .pro file to find QT_HOME
.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?
QT += sqlligne should set things up appropriately for you.
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
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.
@Phrogz What He is saying that in your pro file to add a new line with
QT += sql
This will add SQL support and will automatically link to the lib
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
qmakeis called with the environment variable
QT_HOMEset, i.e. calling
$> QT_HOME=/home/gkistner/Qt/5.9.1 qmake yourprojectfile.pro
@SGaist Thanks, that did it. Not sure where the offending code in the
.procame from, but adding yours and deleting mine caused things to work without issue.