I am new in the community and I would like to ask a question. I have written an application in c++ with QT that I can compile and use on my linux distribution. However, I cannot use the binary file on another computer which is normal because the libraries are different. Using the ldd command on my aplication, I see that shared libraries are the following:
linux-vdso.so.1 (0x00007ffee0fee000)
libgvc.so.6 => /usr/lib/libgvc.so.6 (0x00007f2124aea000)
libcgraph.so.6 => /usr/lib/libcgraph.so.6 (0x00007f21248d4000)
libcdt.so.5 => /usr/lib/libcdt.so.5 (0x00007f21246cd000)
libQt5PrintSupport.so.5 => /opt/Qt5.9.1/5.9.1/gcc_64/lib/libQt5PrintSupport.so.5 (0x00007f212445f000)
libQt5Widgets.so.5 => /opt/Qt5.9.1/5.9.1/gcc_64/lib/libQt5Widgets.so.5 (0x00007f2123c2e000)
libQt5Gui.so.5 => /opt/Qt5.9.1/5.9.1/gcc_64/lib/libQt5Gui.so.5 (0x00007f2123480000)
libQt5Core.so.5 => /opt/Qt5.9.1/5.9.1/gcc_64/lib/libQt5Core.so.5 (0x00007f2122d46000)
libGL.so.1 => /usr/lib/x86_64-linux-gnu/libGL.so.1 (0x00007f2122ad4000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f21228b7000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f2122535000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f2122231000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f212201a000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f2121c7b000)
libltdl.so.7 => /usr/lib/x86_64-linux-gnu/libltdl.so.7 (0x00007f2121a71000)
libxdot.so.4 => /usr/lib/libxdot.so.4 (0x00007f212186b000)
libpathplan.so.4 => /usr/lib/libpathplan.so.4 (0x00007f2121663000)
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f2121439000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f212121f000)
libicui18n.so.56 => /opt/Qt5.9.1/5.9.1/gcc_64/lib/libicui18n.so.56 (0x00007f2120d86000)
libicuuc.so.56 => /opt/Qt5.9.1/5.9.1/gcc_64/lib/libicuuc.so.56 (0x00007f21209ce000)
libicudata.so.56 => /opt/Qt5.9.1/5.9.1/gcc_64/lib/libicudata.so.56 (0x00007f211efeb000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f211ede7000)
libgthread-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007f211ebe5000)
libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f211e8d1000)
/lib64/ld-linux-x86-64.so.2 (0x00007f2125102000)
libxcb-dri3.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-dri3.so.0 (0x00007f211e6ce000)
libxcb-present.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-present.so.0 (0x00007f211e4cb000)
libxcb-sync.so.1 => /usr/lib/x86_64-linux-gnu/libxcb-sync.so.1 (0x00007f211e2c4000)
libxshmfence.so.1 => /usr/lib/x86_64-linux-gnu/libxshmfence.so.1 (0x00007f211e0c2000)
libglapi.so.0 => /usr/lib/x86_64-linux-gnu/libglapi.so.0 (0x00007f211de93000)
libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007f211dc81000)
libXdamage.so.1 => /usr/lib/x86_64-linux-gnu/libXdamage.so.1 (0x00007f211da7e000)
libXfixes.so.3 => /usr/lib/x86_64-linux-gnu/libXfixes.so.3 (0x00007f211d878000)
libX11-xcb.so.1 => /usr/lib/x86_64-linux-gnu/libX11-xcb.so.1 (0x00007f211d676000)
libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f211d336000)
libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f211d10e000)
libxcb-glx.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-glx.so.0 (0x00007f211cef3000)
libxcb-dri2.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-dri2.so.0 (0x00007f211ccee000)
libXxf86vm.so.1 => /usr/lib/x86_64-linux-gnu/libXxf86vm.so.1 (0x00007f211cae8000)
libdrm.so.2 => /usr/lib/x86_64-linux-gnu/libdrm.so.2 (0x00007f211c8d8000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f211c665000)
libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f211c461000)
libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f211c25b000)
libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007f211c045000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f211be3d000)
I would like to include these libraries in my application to be able to use it on another computer.
I don't know if i have to use it as static or shared and I do not care, I just want it works :).
I have tried adding them in my .pro file on QTcreator by the following way (examples with libgvc):
unix:!macx: LIBS += -L$$PWD/../../../../usr/lib/ -lgvc
INCLUDEPATH += $$PWD/../../../../usr/lib
DEPENDPATH += $$PWD/../../../../usr/lib
The compilation goes well. However, it still does not work on another computer like if libraries were not included in the binary file.
I also tried to add the following commands:
QMAKE_LFLAGS += -static
LIBS +=-Wl,-Bstatic
But in this case, I get an error message during compilation
Cannot find -lgvc
Do you have an idea of how I can compile my program as standalone on Linux with Qt creator?