How to install Boost library? How to add library to project?
-
@mzimmers Okay, if it will work, its fine.
But what file I need then to add to LIBS?
LIBS += /home/user/Documents/BoostLibrary/stage/lib/libboost_program_options.a
LIBS += /home/user/Documents/BoostLibrary/stage/lib/libboost_program_options.so
LIBS += /home/user/Documents/BoostLibrary/stage/lib/libboost_program_options.so.1.81.0
And, how to link 2 libraries? Just to repeat LIBS+= "path" again?And just for curiosity - I am doing tutorial with that boost library, it says:
Remember that the Boost.ProgramOptions library consists of more than just header files, so
Therefore, your program must link with the libboost_program_options library.
We did linkage? -
You should only need one of those libraries. I'm working from memory, so you might want to double-check me, but an .so library is a dynamic library, while a .a is a static library. The one with a specific version number appears to be the actual library, while libboost_program_options.so is a link (so when you update boost, you don't have to rebuild your project. I'd use the link in your LIBS statement.
When you want to add multiple libraries, you can either have multiple LIBS statements (just remember to use "+=" or the second LIBS statement will undo the first), or you can concatenate the needed libs in one LIBS statement.
-
@mzimmers Thanks a lot.
But now I get other error:
I tried to google, found this:
https://stackoverflow.com/questions/36090824/trouble-using-boost-cannot-open-shared-object-file
https://forum.qt.io/topic/58963/error-while-loading-shared-libraries-cannot-open-shared-object-file-no-such-file-or-directory/3
but adding this flags from solutions doesnt work... (however, advices are very old, more than 6 years passed...) -
Interesting. We're getting away from my area of expertise -- it's been awhile since I've developed for Linux -- so I'm not sure how much help I'll be.
Looking at the link you provided...I wonder if you need to use this variable. I don't remember having to use it back when I did use Qt for Linux, but who knows.
Maybe someone more knowledgable than I can chime in here.
-
Hi,
You can define the LD_LIBRARY_PATH environment variable in the Run part of the project panel and point it to where your boost libraries are.
One question though: why not use the boost libraries from your Linux distribution ?
-
@SGaist And what I need to do here?
One question though: why not use the boost libraries from your Linux distribution ?
Because I am newbie, obviuos steps when you need a library - download it from library site.
If it will be easier to use them from Linux and link them to projects in Qt - awesome! -
See the environment block ? That's what you need to change.
-
The error you show is a run time error not a compiler error.
Where exactly is that library located ?
-
The exact debut, I don't know but at least Debian does.
-
Here
user@user-X542URR:~/Documents/build-Testing-Desktop_Qt_6_4_1_GCC_64bit-Debug$ ldd Testing linux-vdso.so.1 (0x00007ffed6fc7000) libboost_program_options.so.1.81.0 => not found libQt6Widgets.so.6 => /home/user/Qt/6.4.1/gcc_64/lib/libQt6Widgets.so.6 (0x00007f531a924000) libQt6Core.so.6 => /home/user/Qt/6.4.1/gcc_64/lib/libQt6Core.so.6 (0x00007f531a2a6000) libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f531a07c000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f531a05c000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f5319e32000) libQt6Gui.so.6 => /home/user/Qt/6.4.1/gcc_64/lib/libQt6Gui.so.6 (0x00007f5319492000) libGL.so.1 => /lib/x86_64-linux-gnu/libGL.so.1 (0x00007f531940b000) libxkbcommon.so.0 => /lib/x86_64-linux-gnu/libxkbcommon.so.0 (0x00007f53193c4000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f53193bf000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f53192d8000) libicui18n.so.56 => /home/user/Qt/6.4.1/gcc_64/lib/libicui18n.so.56 (0x00007f5318e00000) libicuuc.so.56 => /home/user/Qt/6.4.1/gcc_64/lib/libicuuc.so.56 (0x00007f5318a00000) libicudata.so.56 => /home/user/Qt/6.4.1/gcc_64/lib/libicudata.so.56 (0x00007f5317000000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f53192d1000) libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f5316ec6000) libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f53192b5000) libgthread-2.0.so.0 => /lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007f53192ae000) librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f53192a9000) /lib64/ld-linux-x86-64.so.2 (0x00007f531b08d000) libEGL.so.1 => /lib/x86_64-linux-gnu/libEGL.so.1 (0x00007f5318ded000) libfontconfig.so.1 => /lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007f5316e7c000) libX11.so.6 => /lib/x86_64-linux-gnu/libX11.so.6 (0x00007f5316d3c000) libQt6DBus.so.6 => /home/user/Qt/6.4.1/gcc_64/lib/libQt6DBus.so.6 (0x00007f5316c78000) libfreetype.so.6 => /lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007f5316bb0000) libGLdispatch.so.0 => /lib/x86_64-linux-gnu/libGLdispatch.so.0 (0x00007f5316af8000) libGLX.so.0 => /lib/x86_64-linux-gnu/libGLX.so.0 (0x00007f5318db9000) libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f5316a82000) libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f5316a51000) libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007f531929c000) libxcb.so.1 => /lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f5316a27000) libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007f53169d9000) libpng16.so.16 => /lib/x86_64-linux-gnu/libpng16.so.16 (0x00007f531699e000) libbrotlidec.so.1 => /lib/x86_64-linux-gnu/libbrotlidec.so.1 (0x00007f53189f2000) libXau.so.6 => /lib/x86_64-linux-gnu/libXau.so.6 (0x00007f53189ec000) libXdmcp.so.6 => /lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f53189e4000) libsystemd.so.0 => /lib/x86_64-linux-gnu/libsystemd.so.0 (0x00007f53168d7000) libbrotlicommon.so.1 => /lib/x86_64-linux-gnu/libbrotlicommon.so.1 (0x00007f53168b4000) libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007f531689c000) liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f531686f000) libzstd.so.1 => /lib/x86_64-linux-gnu/libzstd.so.1 (0x00007f53167a0000) liblz4.so.1 => /lib/x86_64-linux-gnu/liblz4.so.1 (0x00007f5316780000) libcap.so.2 => /lib/x86_64-linux-gnu/libcap.so.2 (0x00007f5316775000) libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007f5316637000) libmd.so.0 => /lib/x86_64-linux-gnu/libmd.so.0 (0x00007f531662a000) libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007f5316602000)