PDA

View Full Version : MinGW Windows Library Search Path



zztop
23rd March 2006, 12:42
Hello *
I'm trying to make a binary distribution of my project for Windoze.
The project compiles fine, resolves its library dependencies and is able to run, but only if the used DLLs (Qt4: QtCore, QtGui and QtXml; some other libraries) reside in the the same directory as the application. I would like to put all libraries into a subfolder (lib) and have only the executable in the application root directory, but whenever I start the application with this configuration it complains about not finduing the DLLs. If I start via a BATch-file and set the PATH environment accordingly it works, but this is not an acceptable solution.
QCoreApplication brings some static methods to set the library include paths, but they don't work cause the the application fails to start due to the missing libraries in the dynamic library loader before even executing the first statements....
I also tried messing around with linker flags adding a -Wl,-rpath,lib, but after it didn't work I checked with the documentation and found out that the mingw-gcc ignores the rpath...
I don't want to l link it static because there is a proprietary library where no static version is available...

Has anybody any idea on how to solve this?

Thanks in advance

wysota
23rd March 2006, 12:50
You have to convince Windows to look for the library there. There is probably some environment variable in the system which stores a list of library paths. An alternative is to install those libs you need in Windows' System directory.

zztop
23rd March 2006, 12:57
Thanks wysota, but there has to be another (more windows like) way to do this.
Installng all libraries to some windows internal include path requires admin rights and setting/including my path to an environment variable is the same as starting from a batch file.
It's simply not very nice :(
It would be really nice to run for example from CD or USB stick and adding a temporary path to a system include path sounds wrong...

wysota
23rd March 2006, 13:02
Thanks wysota, but there has to be another (more windows like) way to do this.
Installng all libraries to some windows internal include path requires admin rights and setting/including my path to an environment variable is the same as starting from a batch file.
It's simply not very nice :(
It would be really nice to run for example from CD or USB stick and adding a temporary path to a system include path sounds wrong...

You can modify the environment just for one binary (at least it should be possible). I think you can do this by modifying properties of the file (or a shortcut to it).

dimitri
26th March 2006, 16:18
I would like to put all libraries into a subfolder (lib) and have only the executable in the application root directory, but whenever I start the application with this configuration it complains about not finduing the DLLs.
Why would you want to do that? The usual and recommended way on Windows is to put the DLLs needed by an application in the application's directory. See also:

The End of DLL Hell (http://msdn.microsoft.com/library/en-us/dnsetup/html/dlldanger1.asp)
Isolated Applications and Side-by-side Assemblies (http://msdn.microsoft.com/library/en-us/sbscs/setup/isolated_applications_and_side_by_side_assemblies_ start_page.asp)