Answer the question
In order to leave comments, you need to log in
Why doesn't the program work outside of Qt Creator?
For the program to work, two external libraries are needed, which I added via gui like this:
unix:!macx: LIBS += -L$$PWD/curl/ -lcurl
INCLUDEPATH += $$PWD/curl
DEPENDPATH += $$PWD/curl
unix:!macx: PRE_TARGETDEPS += $$PWD/curl/libcurl.a
unix:!macx: LIBS += -L$$PWD/jansson/ -ljansson
INCLUDEPATH += $$PWD/jansson
DEPENDPATH += $$PWD/jansson
$ ./myapp
./myapp: error while loading shared libraries: libjansson.so.4: cannot open shared object file: No such file or directory
Answer the question
In order to leave comments, you need to log in
I see several ways to resolve dependencies.
First, you can build libcurl and libjansson statically and link to your application.
Secondly, in addition to static libcurl and libjansson, Qt itself can also be compiled into static and linked to your application. As a result, you will get a large executable file (the size can be trimmed with the upx utility ), which will run in all modern GNU/Linux distributions that have X's.
Thirdly, the most rational way is to build a DEB or RPM package, in which, as dependencies, add the packages libcurl3(4), libjansson4, and the necessary modules with qt4(5).
Well, running the binary itself is simple. You have an environment variable in Qt Creator LD_LIBRARY_PATH. Just copy its value to the terminal before running the program:
Curl seems to be built statically. Try to build jansson into static too. Then you will not receive errors error while loading shared libraries: libjansson.so.4: cannot open shared object file: No such file or directory .
It is likely that the library folders you are using are not in the shared library search paths.
If you are using linux, then you can try to run your program by first adding the paths to the corresponding folders to the LD_LIBRARY_PATH environment variable.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question