Dear all,
I'm using QtCreator on Ubuntu x64.
I've created a shared library MilpLibrary which I use in another application MilpClient. The library builds well, and so does the application. But when I run the application MilpClient it exits with an error:
error while loading shared libraries: libMilpLibrary.so.1: cannot open shared object file: No such file or directory
and also ldd confirms that the linked library is not found.
Only after running make and sudo make install on the library build dir (that installs the libMilpLibrary.so in /usr/lib) the application MilpClient will run.
I would like to not need to install the libMilpLibrary.so in /usr/lib and still be able to use the library.
What am I doing wrong?
Thanks in advance!
This is the .pro-file of MilpClient:
QT += core
QT += gui
QT += network
TARGET = MilpClient
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp \
ETC...
HEADERS += mainwindow.h \
ETC...
FORMS += mainwindow.ui \
ETC...
# include own lib
INCLUDEPATH += /home/simon/MilpLibrary # header files
LIBS += -L/home/simon/MilpLibrary-build-desktop -lMilpLibrary # .so files
QT += core
QT += gui
QT += network
TARGET = MilpClient
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp \
ETC...
HEADERS += mainwindow.h \
ETC...
FORMS += mainwindow.ui \
ETC...
# include own lib
INCLUDEPATH += /home/simon/MilpLibrary # header files
LIBS += -L/home/simon/MilpLibrary-build-desktop -lMilpLibrary # .so files
To copy to clipboard, switch view to plain text mode
Added after 17 minutes:
It works if I do a:
export LD_LIBRARY_PATH=/home/simon/MilpLibrary-build-desktop
export LD_LIBRARY_PATH=/home/simon/MilpLibrary-build-desktop
To copy to clipboard, switch view to plain text mode
Is this the way to go?
Added after 1 6 minutes:
I've found no way to add this to the build environment of QtCreator.
What permanently works, is adding a file to /etc/ld.so.conf.d/ with the appropriate library path and than running "sudo ldconfig -v"...
Anyone better ideas?
Bookmarks