Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. How to install Boost library? How to add library to project?

How to install Boost library? How to add library to project?

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
50 Posts 3 Posters 8.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • mzimmersM mzimmers

    My bad...I gave you bad advice on the LIBS entry. You need to specify the full path to the library you want to use. There may be a way to wildcard that; I'll do some looking. In the meantime, if you know specifically which boost libraries you need, modify your LIBS entry to contain the full path to those libraries.

    EDIT:

    Look at the LIBS entry on this page for how to explicitly add libraries to your project.

    A Offline
    A Offline
    aret777
    wrote on last edited by
    #21

    @mzimmers Okay, if it will work, its fine.
    But what file I need then to add to LIBS?
    Screenshot_2.png
    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?

    1 Reply Last reply
    0
    • mzimmersM Offline
      mzimmersM Offline
      mzimmers
      wrote on last edited by mzimmers
      #22

      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.

      A 1 Reply Last reply
      0
      • mzimmersM mzimmers

        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.

        A Offline
        A Offline
        aret777
        wrote on last edited by aret777
        #23

        @mzimmers Thanks a lot.
        But now I get other error:
        download.png

        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
        Screenshot_3.png
        but adding this flags from solutions doesnt work... (however, advices are very old, more than 6 years passed...)

        1 Reply Last reply
        0
        • mzimmersM Offline
          mzimmersM Offline
          mzimmers
          wrote on last edited by
          #24

          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.

          1 Reply Last reply
          1
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #25

            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 ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            A 1 Reply Last reply
            0
            • SGaistS SGaist

              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 ?

              A Offline
              A Offline
              aret777
              wrote on last edited by
              #26

              @SGaist And what I need to do here?
              Screenshot_4.png

              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!

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #27

                See the environment block ? That's what you need to change.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  aret777
                  wrote on last edited by aret777
                  #28

                  Humm, I already have this variable and it doesnt permit set another one (LD_LIBRARY_PATH)
                  I tried to set variable in analogue with others... but it changed nothing in compiler errors.
                  Screenshot_2.png

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #29

                    The error you show is a run time error not a compiler error.

                    Where exactly is that library located ?

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    mzimmersM 1 Reply Last reply
                    0
                    • SGaistS SGaist

                      The error you show is a run time error not a compiler error.

                      Where exactly is that library located ?

                      mzimmersM Offline
                      mzimmersM Offline
                      mzimmers
                      wrote on last edited by
                      #30

                      @SGaist according to the console read-out in the first post, it appears that library is located at: /home/user/Documents/BoostLibrary/stage/lib, which is indeed part of the definition of LD_LIBRARY_PATH.

                      SGaistS 1 Reply Last reply
                      0
                      • mzimmersM mzimmers

                        @SGaist according to the console read-out in the first post, it appears that library is located at: /home/user/Documents/BoostLibrary/stage/lib, which is indeed part of the definition of LD_LIBRARY_PATH.

                        SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #31

                        @mzimmers good point, I have misread that part.

                        Second thing I would do is run ldd to see what it has to say and the first would be to switch to the distribution provided boost if recent enough.

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        mzimmersM 1 Reply Last reply
                        0
                        • SGaistS SGaist

                          @mzimmers good point, I have misread that part.

                          Second thing I would do is run ldd to see what it has to say and the first would be to switch to the distribution provided boost if recent enough.

                          mzimmersM Offline
                          mzimmersM Offline
                          mzimmers
                          wrote on last edited by
                          #32

                          @SGaist agreed, but (IMO) it's still worth knowing why this isn't working for him. At this point, it seems like he's done everything necessary.

                          BTW: when did Linux distros begin including Boost?

                          1 Reply Last reply
                          0
                          • SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #33

                            The exact debut, I don't know but at least Debian does.

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            1 Reply Last reply
                            0
                            • A Offline
                              A Offline
                              aret777
                              wrote on last edited by
                              #34

                              Okay, here is the my ldd commands - I dont know why it wont work
                              Screenshot_3.png

                              Anyway, I can deinstall Boost if needed. I downloaded from Boost site the «boost_1_81_0.tar.gz» archive, it still on my download folder.

                              mzimmersM 1 Reply Last reply
                              0
                              • A aret777

                                Okay, here is the my ldd commands - I dont know why it wont work
                                Screenshot_3.png

                                Anyway, I can deinstall Boost if needed. I downloaded from Boost site the «boost_1_81_0.tar.gz» archive, it still on my download folder.

                                mzimmersM Offline
                                mzimmersM Offline
                                mzimmers
                                wrote on last edited by
                                #35

                                @aret777 I believe you want to run ldd on your executable, to see what dependencies it has. You appear to be running it in the boost directories.

                                A 1 Reply Last reply
                                0
                                • mzimmersM mzimmers

                                  @aret777 I believe you want to run ldd on your executable, to see what dependencies it has. You appear to be running it in the boost directories.

                                  A Offline
                                  A Offline
                                  aret777
                                  wrote on last edited by
                                  #36

                                  @mzimmers what executable? Of a QT project? It doesnt build.

                                  mzimmersM 1 Reply Last reply
                                  0
                                  • A aret777

                                    @mzimmers what executable? Of a QT project? It doesnt build.

                                    mzimmersM Offline
                                    mzimmersM Offline
                                    mzimmers
                                    wrote on last edited by
                                    #37

                                    @aret777 yes it does build - that's what SGaist was trying to tell you. If you look in your build directory, under debug or release or whatever build mode you're using, you should find an executable. Run ldd on that file.

                                    1 Reply Last reply
                                    0
                                    • A Offline
                                      A Offline
                                      aret777
                                      wrote on last edited by
                                      #38

                                      Screenshot_4.png
                                      Emmm, I dont see any folder.

                                      1 Reply Last reply
                                      0
                                      • mzimmersM Offline
                                        mzimmersM Offline
                                        mzimmers
                                        wrote on last edited by
                                        #39

                                        in user/Documents, is there a folder with a really long name starting with "build?"

                                        1 Reply Last reply
                                        0
                                        • A Offline
                                          A Offline
                                          aret777
                                          wrote on last edited by
                                          #40

                                          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)
                                          
                                          1 Reply Last reply
                                          0

                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved