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?
QtWS25 Last Chance

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

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
50 Posts 3 Posters 8.7k 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.
  • M Offline
    M Offline
    mzimmers
    wrote on 26 Dec 2022, 17:07 last edited by mzimmers
    #18

    No, something's still wrong with your .pro file. You need to get rid of that entry for the BoostLinkingTest.pro file.

    EDIT:
    disregard that last line.

    May I see the complete contents of your .pro file?

    A 1 Reply Last reply 26 Dec 2022, 17:12
    0
    • M mzimmers
      26 Dec 2022, 17:07

      No, something's still wrong with your .pro file. You need to get rid of that entry for the BoostLinkingTest.pro file.

      EDIT:
      disregard that last line.

      May I see the complete contents of your .pro file?

      A Offline
      A Offline
      aret777
      wrote on 26 Dec 2022, 17:12 last edited by
      #19

      @mzimmers Its same from the beggining. I created now new project just for test, but same errors:
      Screenshot_1.png

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mzimmers
        wrote on 26 Dec 2022, 17:15 last edited by mzimmers
        #20

        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 1 Reply Last reply 26 Dec 2022, 17:25
        1
        • M mzimmers
          26 Dec 2022, 17:15

          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 26 Dec 2022, 17:25 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
          • M Offline
            M Offline
            mzimmers
            wrote on 26 Dec 2022, 17:30 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 26 Dec 2022, 17:48
            0
            • M mzimmers
              26 Dec 2022, 17:30

              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 26 Dec 2022, 17:48 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
              • M Offline
                M Offline
                mzimmers
                wrote on 26 Dec 2022, 18:00 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
                • S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 26 Dec 2022, 19:38 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 26 Dec 2022, 20:30
                  0
                  • S SGaist
                    26 Dec 2022, 19:38

                    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 26 Dec 2022, 20:30 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
                    • S Offline
                      S Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on 26 Dec 2022, 21:02 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 27 Dec 2022, 13:03 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
                        • S Offline
                          S Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on 27 Dec 2022, 19:15 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

                          M 1 Reply Last reply 27 Dec 2022, 19:20
                          0
                          • S SGaist
                            27 Dec 2022, 19:15

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

                            Where exactly is that library located ?

                            M Offline
                            M Offline
                            mzimmers
                            wrote on 27 Dec 2022, 19:20 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.

                            S 1 Reply Last reply 27 Dec 2022, 19:25
                            0
                            • M mzimmers
                              27 Dec 2022, 19:20

                              @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.

                              S Offline
                              S Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on 27 Dec 2022, 19:25 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

                              M 1 Reply Last reply 27 Dec 2022, 19:27
                              0
                              • S SGaist
                                27 Dec 2022, 19:25

                                @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.

                                M Offline
                                M Offline
                                mzimmers
                                wrote on 27 Dec 2022, 19:27 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
                                • S Offline
                                  S Offline
                                  SGaist
                                  Lifetime Qt Champion
                                  wrote on 27 Dec 2022, 19:31 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 28 Dec 2022, 15:00 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.

                                    M 1 Reply Last reply 28 Dec 2022, 15:21
                                    0
                                    • A aret777
                                      28 Dec 2022, 15:00

                                      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.

                                      M Offline
                                      M Offline
                                      mzimmers
                                      wrote on 28 Dec 2022, 15:21 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 28 Dec 2022, 15:32
                                      0
                                      • M mzimmers
                                        28 Dec 2022, 15:21

                                        @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 28 Dec 2022, 15:32 last edited by
                                        #36

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

                                        M 1 Reply Last reply 28 Dec 2022, 16:23
                                        0
                                        • A aret777
                                          28 Dec 2022, 15:32

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

                                          M Offline
                                          M Offline
                                          mzimmers
                                          wrote on 28 Dec 2022, 16:23 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

                                          27/50

                                          26 Dec 2022, 21:02

                                          • Login

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