App frn linux console… is not finding the libs
-
bq.
You can also set the rpath when building your library on OS Xcan you hlp me also with rpath please.. I have also some library and when run my app frn linux console... is not finding the libs witch are next to the executable file in my home folder.
[andreyc EDIT]: Split "from":http://qt-project.org/forums/viewthread/47425/#194194. Please start new thread for your questions. It will be easier to find the new questions if they are not buried inside the other threads.
-
You can set LD_LIBRARY_PATH to search in current directory at run time
@
export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH
@
or you can specify rpath during build to make your app to search in a particular path
@
g++ ... -Wl,-rpath,$(HOME)
@
or use dot instead of $HOME. I did not test it
@
g++ ... -Wl,-rpath,.
@ -
This "blog post":http://www.tripleboot.org/?p=138 has a very detailed explanation on how to deploy your application in Linux.
-
may I get some more info about rpath in my pro file? or where I have to add @g++ ... -Wl,-rpath,$(HOME)@
this is my pro file
@include (../shared.pri)
SUBDIRS =
AtpCore
AtpTools
AtpClient
AtpCompany
AtpGui
mainTEMPLATE = subdirs
@my shared .pri @DEFINES += ATP_LIBRARY
output directory:
CONFIG(debug, debug|release) {
ROUTDIR = debug
} else {
ROUTDIR = release
}CONFIG(plugin, plugin) {
build_pass:CONFIG(debug, debug|release) {
TARGET = $$join(TARGET,,,_debug)
}
}QT += core
gui
sql \svg \
network
printsupport
xml
xmlpatterns \help \
designer
uitools
widgets
webkitwidgetsCONFIG -= warn_off
CONFIG += warn_on
CONFIG += debug_and_release ordered embed_manifest_dll embed_manifest_exeQMAKE_TARGET_COMPANY = atp-trading.net
QMAKE_TARGET_DESCRIPTION = an application for people involved in electric jobs
QMAKE_TARGET_COPYRIGHT = Open Source
QMAKE_TARGET_PRODUCT = atpElectricity Application FrameworkQMAKE_CXXFLAGS += -std=c++11
CONFIG += c++11DESTDIR = $$PWD/$$ROUTDIR
UI_DIR = .uiLIBS += -L$$PWD/$$ROUTDIR
INCLUDEPATH +=
$$PWD/src/AtpCore
$$PWD/src/AtpTools
$$PWD/src/AtpClient
$$PWD/src/AtpCompany
$$PWD/src/AtpGui@ -
I think you should add it to QMAKE_CXXFLAGS
@
QMAKE_CXXFLAGS += -Wl,-rpath,$(HOME)
@ -
Hi, actually it's
@
QMAKE_LFLAGS += -Wl,-rpath,$(HOME)
@but this I just found out, thanks arsinte_andrei for this excellent question; while I haven't been using Qt in Linux much, I always forget doing the chrpath command (as I write in that "blog post":http://www.tripleboot.org/?p=138#Linux) so I want something to stuff inside my .pro file and be done with it, and QMAKE_LFLAGS is it :-)
But the real kicker of course, is to be able to issue an LFLAGS to emulate the DLL lookup behavior in Windows, i.e. to have the ld.so chap look for Qt's .so files in the same directory as the executable .elf file, regardless of that file is in your home directory or somewhere else entirely. In my blog post I use chrpath -r $ORIGIN for this, so how to do that magic in the .pro file?
Well with a lot of coffee later. I present to you:
@
QMAKE_LFLAGS += -Wl,-rpath,"'$$ORIGIN'"
@I can explain exactly why all that extra stuffing/escaping is needed, but maybe later :-) Anyway I'm going to update the blog...