user3191398
user3191398

Reputation:

Qt, compiling program with dynamic libraried in the same path

I am trying to run my program in other computer without libraries. In *.pro file i added:

LIBS += -L"$$OUT_PWD/libs" -ltinyxml2
LIBS += -L"$$OUT_PWD/libs" -lopencv_highgui -lopencv_core -lopencv_imgcodecs -lopencv_imgproc
LIBS += -L"$$OUT_PWD/libs" -lboost_system

Then i copied libraries to other computer to ~/myprogram/libs and binary file to ~/myprogram, but it can not load libraries

./gpAnalizer: error while loading shared libraries: libtinyxml2.so.2: cannot open shared object file: No such file or directory

Upvotes: 1

Views: 52

Answers (1)

Evgeny
Evgeny

Reputation: 4010

You should use QMAKE_RPATHDIR variable.

Add the follow line to your .pro file:

QMAKE_RPATHDIR += $$OUT_PWD/libs

Of course this may work if $$OUT_PWD is ~/myprogram/. If not then replace it with actual path.

Upvotes: 2

Related Questions