June 14, 2011

ludde ludde
Lab Rat
325 posts

Qt Creator locating dynamic libraries

 

On Windows, Qt Creator seems to have some way of automatically locating dynamic libraries, so that they are found when a built application is run. Because in some situations it manages to run applications I build without any need for me to move or include DLLs in the path. However, for some weird reason it does not work if I use e.g. the full win32-msvc2008 mkspec to add the library path:

  1. win32-msvc2008:LIBS += /my/lib/path

But it works if I do:

  1. win32:LIBS += /my/lib/path

Or just:

  1. LIBS += /my/lib/path

Has anyone else seen this, and can anyone think of what is going on and why?
(On Linux, I have to add the paths to the LD_LIBRARY_PATH manually in the run environment.)

9 replies

June 15, 2011

TobbY TobbY
Lab Rat
209 posts

u can use like this for windows.

LIBS += C:\QtSDK\mingw\lib\libws2_32.a

or read

http://doc.qt.nokia.com/qq/qq11-unix-deployment.html#sharedlibraries

 Signature 

Code Code Code

June 16, 2011

ludde ludde
Lab Rat
325 posts

Not sure I understand your answer, and not really sure you understood my question either… :)

My question does not have anyhting to do with deployment.
It has to do with running my application from Qt Creator, pressing the Run button or Ctrl-R.
And I know how to make qmake find libraries at compile time.
What I don’t understand is how Qt Creator finds the corresponding DLLs at run time.

March 28, 2012

Dynasty1215 Dynasty1215
Lab Rat
6 posts

Hi, ludde
Did you solved it?
I have the same problem, i add a .so file to my application
Then it compiled and link is ok
But when i pressing the Run button or Ctrl-R, there some error:
“To help dpkg-shlibdeps find private libraries, you might need to set LD_LIBRARY_PATH.
dh_shlibdeps: command returned error code 512”

how do i set the LD_LIBRARY_PATH

March 28, 2012

ludde ludde
Lab Rat
325 posts

Hi.

You can set LD_LIBRARY_PATH in the run environment in Qt Creator. The run environment is accessible on the Projects page, under Run Settings. Just press the Details button under Run Environment, and then the Add button. (This is for Qt Creator 2.4.1, it might look slightly different in another version.)

I’m not developing on Linux at the moment, so I don’t have this problem any more, and don’t know if it has been fixed in a recent Qt Creator release. But if you have the same problem, I guess it hasn’t. But setting LD_LIBRARY_PATH as I describe should solve it for you.

March 28, 2012

Dynasty1215 Dynasty1215
Lab Rat
6 posts

Thx
I can founded the run environment is accessible on the Projects page, under Run Settings.
But i don’t know how set the “LD_LIBRARY_PATH” ‘s value. It is “value” would be what?

March 28, 2012

ludde ludde
Lab Rat
325 posts

The value is the full path of the directory where the DLLs are located.
If they are spread over more than one directory, the value is a list of directories, separated by a ‘:’ character.

March 28, 2012

Tobias Hunger Tobias Hunger
Area 51 Engineer
3383 posts

Ludde: Creator evaluates the LIBS variable from qmake and sets up the environment in such a way that those libs are found. That the first case does not work is a bug. Did you file a report [bugreports.qt-project.org] for it?

March 28, 2012

ludde ludde
Lab Rat
325 posts

Yes, I filed this as QTCREATORBUG-5394 [bugreports.qt-project.org].
Current status: Not Evaluated.

March 29, 2012

Dynasty1215 Dynasty1215
Lab Rat
6 posts

Thanks all
Problem solved here :http://www.developer.nokia.com/Community/Wiki/How_to_deploy_and_link_a_shared_library_on_Harmattan

 
  ‹‹ QtCreator and QML files      Linux 32 Bit On-Line installer hangs @ 24-26% ››

You must log in to post a reply. Not a member yet? Register here!