[Interest] QDesktopServices::openUrl() without inheriting environment?
realnc at gmail.com
Sat Oct 24 02:10:10 CEST 2020
On 23/10/2020 18:50, Olivier B. wrote:
> An application needs custom library search path to use it's own versions
> of external libraries.
You should look into doing that at link-time, not runtime. With a qmake
project, you should be able to add:
QMAKE_RPATHDIR += lib
in the project file. Make sure it's a relative directory. In this
example, the runtime loader will look for a "lib" directory in the same
directory as the executable and prefer libraries that exist there. This
uses the linker's $ORIGIN feature to do this.
This means you don't have to set LD_LIBRARY_PATH prior to starting your
application and thus external processes launched through
QDesktopServices::openUrl() will not use your bundled libs.
You can also something like "../lib" instead, if your application's
directory structure uses the traditional "bin" and "lib" layout. The
important thing is whatever you specify is a relative path.
More information about the Interest