Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. qt does not try to find a 3rd party lib even though its location is specified
Qt 6.11 is out! See what's new in the release blog

qt does not try to find a 3rd party lib even though its location is specified

Scheduled Pinned Locked Moved Unsolved General and Desktop
qmakestracelinux
34 Posts 5 Posters 21.0k Views 1 Watching
  • 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.
  • K kenchan

    not really... on MAC OS X I generally put my -LIBS += -Lsomepath and my LIBS += -lsomelib on separate lines. That is just to make it easier to change though.
    I do find that the link order is important for some libraries on UNIX boxes (like Mac OS X).
    Are you using a Mac or something else?
    I might be useful to see what you get in the compile output window.

    ohuohuoO Offline
    ohuohuoO Offline
    ohuohuo
    wrote on last edited by ohuohuo
    #15

    @kenchan no, it's on Ubuntu12.04 32bit. The compile output is:

    23:39:32: Running build steps for project RemoteClient...
    23:39:32: Configuration unchanged, skipping qmake step.
    23:39:32: Starting: "/usr/bin/make" -w
    make: Entering directory /home/.../QtWorkspace/RemoteClient-build-desktop-Qt_4_8_1_in_PATH__System__Debug' make: Nothing to be done for first'.
    make: Leaving directory `/home/.../QtWorkspace/RemoteClient-build-desktop-Qt_4_8_1_in_PATH__System__Debug'
    23:39:32: The process "/usr/bin/make" exited normally.

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kenchan
      wrote on last edited by
      #16

      hmm not very useful since you are not rebuilding...
      now what does it look like when you do this...
      clean
      run qmake
      build or rebuild just to be sure :-)

      ohuohuoO 2 Replies Last reply
      0
      • K kenchan

        hmm not very useful since you are not rebuilding...
        now what does it look like when you do this...
        clean
        run qmake
        build or rebuild just to be sure :-)

        ohuohuoO Offline
        ohuohuoO Offline
        ohuohuo
        wrote on last edited by ohuohuo
        #17

        @kenchan yeah, I rebuilt that , but it's large file which part you think would be most interesting?
        output of just ran qmake:
        00:01:05: Running build steps for project RemoteClient...
        00:01:05: Starting: "/usr/bin/qmake-qt4" /home/.../QtWorkspace/RemoteClient/RemoteClient.pro -r -spec linux-g++ CONFIG+=debug CONFIG+=declarative_debug
        00:01:05: The process "/usr/bin/qmake-qt4" exited normally.

        K 1 Reply Last reply
        0
        • K kenchan

          hmm not very useful since you are not rebuilding...
          now what does it look like when you do this...
          clean
          run qmake
          build or rebuild just to be sure :-)

          ohuohuoO Offline
          ohuohuoO Offline
          ohuohuo
          wrote on last edited by
          #18

          @kenchan I looked at the output of ldd, it seems that this program does not depend on libMPCtrl.so and libPlayCtrl.so files. And after I changed to unix{
          LIBS += -L./lib/ -Wl,-rpath=./lib/,-rpath=./ -lhcnetsdk -lPlayCtrl -lMPCtrl
          }, I can neither find libMPCtrl.so nor libPlayCtrl.so.

          K 1 Reply Last reply
          0
          • ohuohuoO ohuohuo

            @kenchan yeah, I rebuilt that , but it's large file which part you think would be most interesting?
            output of just ran qmake:
            00:01:05: Running build steps for project RemoteClient...
            00:01:05: Starting: "/usr/bin/qmake-qt4" /home/.../QtWorkspace/RemoteClient/RemoteClient.pro -r -spec linux-g++ CONFIG+=debug CONFIG+=declarative_debug
            00:01:05: The process "/usr/bin/qmake-qt4" exited normally.

            K Offline
            K Offline
            kenchan
            wrote on last edited by
            #19

            @ohuohuo good point, i guess you mean it is a large project with many source files?
            OK how about cutting a bit that shows the last couple of compiled modules and then the linker stuff up to the end, or is that still too much?

            1 Reply Last reply
            0
            • K Offline
              K Offline
              kenchan
              wrote on last edited by
              #20

              so if you don't link to them it will not run, is that the problem?

              ohuohuoO 1 Reply Last reply
              0
              • ohuohuoO ohuohuo

                @kenchan I looked at the output of ldd, it seems that this program does not depend on libMPCtrl.so and libPlayCtrl.so files. And after I changed to unix{
                LIBS += -L./lib/ -Wl,-rpath=./lib/,-rpath=./ -lhcnetsdk -lPlayCtrl -lMPCtrl
                }, I can neither find libMPCtrl.so nor libPlayCtrl.so.

                K Offline
                K Offline
                KeithS
                wrote on last edited by
                #21

                @ohuohuo

                "it seems that this program does not depend on libMPCtrl.so and libPlayCtrl.so files"

                So maybe I'm missing something, but from what you have said it seems your app does not depend on the shared libraries hence that's why it doesn't try and load them? What exactly is the error message you are getting when you try and run the app?

                btw I think your LIBS line in the .pro file is not quite right:

                unix{
                LIBS += -L./lib/ -Wl,-rpath=./lib/,-rpath=./ -lhcnetsdk -lPlayCtrl -lMPCtrl
                }

                The rpath stuff does not belong here, it should be in QMAKE_LFLAGS e.g I have:

                QMAKE_LFLAGS += -rdynamic
                QMAKE_LFLAGS += '-Wl,-rpath,'$$ORIGIN/../lib',-z,origin'
                QMAKE_LFLAGS_RPATH=

                which makes the executable look in <executable_dir>../lib for the shared libs to be loaded at runtime. Then for 3rd party libs I use:

                LIBS += -L<path_to_lib> -l<lib_name>

                You don't need a trailing '/' after the -L path.

                ohuohuoO 1 Reply Last reply
                0
                • A Offline
                  A Offline
                  asanka424
                  wrote on last edited by
                  #22

                  If you don't get any compile errors or runtime errors and your only concern is those .so files are not being read while your program is in run, my guess is that your program is not using those library functions at all

                  ohuohuoO 1 Reply Last reply
                  0
                  • A asanka424

                    If you don't get any compile errors or runtime errors and your only concern is those .so files are not being read while your program is in run, my guess is that your program is not using those library functions at all

                    ohuohuoO Offline
                    ohuohuoO Offline
                    ohuohuo
                    wrote on last edited by
                    #23

                    @asanka424 exactly, so the question is how can I load these libs, I must use functions in them

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      asanka424
                      wrote on last edited by
                      #24

                      In your code do you call functions from that library?

                      ohuohuoO 1 Reply Last reply
                      0
                      • A asanka424

                        In your code do you call functions from that library?

                        ohuohuoO Offline
                        ohuohuoO Offline
                        ohuohuo
                        wrote on last edited by
                        #25

                        @asanka424 yeah, and when I call it, the SDK will show me an error "Fail to load Player SDK"

                        1 Reply Last reply
                        0
                        • A Offline
                          A Offline
                          asanka424
                          wrote on last edited by
                          #26

                          so when you start your executable it runs but when it reaches that particular call it will show an error? If that is the case, my guess is that your library needs some pluggins and it doesn't find those (or that) pluggin(s).

                          I didn't look at the library. Is it related to playing video? If so it probably relying on some codecs. (Just a guess)

                          ohuohuoO 1 Reply Last reply
                          0
                          • A asanka424

                            so when you start your executable it runs but when it reaches that particular call it will show an error? If that is the case, my guess is that your library needs some pluggins and it doesn't find those (or that) pluggin(s).

                            I didn't look at the library. Is it related to playing video? If so it probably relying on some codecs. (Just a guess)

                            ohuohuoO Offline
                            ohuohuoO Offline
                            ohuohuo
                            wrote on last edited by
                            #27

                            @asanka424 you know what, I have an example program, which provided by vender, it works fine! no any plugins, no other things, same libs. And I checked out its pro. file, they have same functionalities. while mine just doesn't work...

                            A 1 Reply Last reply
                            0
                            • ohuohuoO ohuohuo

                              @asanka424 you know what, I have an example program, which provided by vender, it works fine! no any plugins, no other things, same libs. And I checked out its pro. file, they have same functionalities. while mine just doesn't work...

                              A Offline
                              A Offline
                              asanka424
                              wrote on last edited by
                              #28

                              @ohuohuo Ok so this for me to understand your setup.

                              You have a code from a vendor you can build and run without any problem

                              When you code the same functionality in your code it compiles and runs but gives you errors while its running?

                              Am I correct?

                              ohuohuoO 1 Reply Last reply
                              0
                              • K kenchan

                                so if you don't link to them it will not run, is that the problem?

                                ohuohuoO Offline
                                ohuohuoO Offline
                                ohuohuo
                                wrote on last edited by
                                #29

                                @kenchan no, it will run nevertheless, but just gives me this error from SDK itself (not leads to a crash) "Failed to load Player SDK" when I call one of its functions in the missing lib. I guess calling other functions in the same lib will be the same result. functions in other libs, which are loaded like libhcnetsdk.so is good to call.

                                1 Reply Last reply
                                0
                                • A asanka424

                                  @ohuohuo Ok so this for me to understand your setup.

                                  You have a code from a vendor you can build and run without any problem

                                  When you code the same functionality in your code it compiles and runs but gives you errors while its running?

                                  Am I correct?

                                  ohuohuoO Offline
                                  ohuohuoO Offline
                                  ohuohuo
                                  wrote on last edited by ohuohuo
                                  #30

                                  @asanka424 exactly! well, I mean of course source code is not the same, but same functionalities and the input parameters to the function are correct.

                                  A 1 Reply Last reply
                                  0
                                  • K KeithS

                                    @ohuohuo

                                    "it seems that this program does not depend on libMPCtrl.so and libPlayCtrl.so files"

                                    So maybe I'm missing something, but from what you have said it seems your app does not depend on the shared libraries hence that's why it doesn't try and load them? What exactly is the error message you are getting when you try and run the app?

                                    btw I think your LIBS line in the .pro file is not quite right:

                                    unix{
                                    LIBS += -L./lib/ -Wl,-rpath=./lib/,-rpath=./ -lhcnetsdk -lPlayCtrl -lMPCtrl
                                    }

                                    The rpath stuff does not belong here, it should be in QMAKE_LFLAGS e.g I have:

                                    QMAKE_LFLAGS += -rdynamic
                                    QMAKE_LFLAGS += '-Wl,-rpath,'$$ORIGIN/../lib',-z,origin'
                                    QMAKE_LFLAGS_RPATH=

                                    which makes the executable look in <executable_dir>../lib for the shared libs to be loaded at runtime. Then for 3rd party libs I use:

                                    LIBS += -L<path_to_lib> -l<lib_name>

                                    You don't need a trailing '/' after the -L path.

                                    ohuohuoO Offline
                                    ohuohuoO Offline
                                    ohuohuo
                                    wrote on last edited by
                                    #31

                                    @KeithS Thanks much for your reply. But after I used QMAKE_LFLAGS instand of LIBS, a lot of undefined reference errors come out.

                                    K 1 Reply Last reply
                                    0
                                    • ohuohuoO ohuohuo

                                      @asanka424 exactly! well, I mean of course source code is not the same, but same functionalities and the input parameters to the function are correct.

                                      A Offline
                                      A Offline
                                      asanka424
                                      wrote on last edited by
                                      #32

                                      @ohuohuo in vendors .pro file does it set any rpaths? If your program directly uses any functions of those libraries, it won't compile. Is this a multimedia application?

                                      ohuohuoO 1 Reply Last reply
                                      0
                                      • ohuohuoO ohuohuo

                                        @KeithS Thanks much for your reply. But after I used QMAKE_LFLAGS instand of LIBS, a lot of undefined reference errors come out.

                                        K Offline
                                        K Offline
                                        KeithS
                                        wrote on last edited by
                                        #33

                                        @ohuohuo
                                        What errors do you get? It may be you have an error in your .pro file.

                                        1 Reply Last reply
                                        0
                                        • A asanka424

                                          @ohuohuo in vendors .pro file does it set any rpaths? If your program directly uses any functions of those libraries, it won't compile. Is this a multimedia application?

                                          ohuohuoO Offline
                                          ohuohuoO Offline
                                          ohuohuo
                                          wrote on last edited by
                                          #34

                                          @asanka424 yes. But why it won't compile? I have those dynamic libs, too. It is remote video application, it can connect to a remote device,which as server.

                                          this is the whole .pro file:

                                          TEMPLATE = app

                                          UI_DIR = obj/Gui
                                          MOC_DIR = obj/Moc
                                          OBJECTS_DIR = obj/Obj

                                          TARGET = ../lib/QtClientDemo
                                          QT += core
                                          gui
                                          opengl

                                          TRANSLATIONS = ../../translation/QtDemo_zh_CN.ts

                                          RESOURCES = ../../src/Player.qrc

                                          win32 {
                                          }

                                          unix {
                                          LIBS += -L../lib/ -Wl,-rpath=../lib/,-rpath=./ -lhcnetsdk -lPlayCtrl -lMPCtrl
                                          }

                                          HEADERS += ../../src/MainWindow/DeviceTree/DeviceAttr/deviceattr.h
                                          ... // I replaced a bunch of paths here with ellipsis
                                          ../../src/Public/DemoPublic.h

                                          SOURCES += ../../src/MainWindow/DeviceTree/DeviceAttr/deviceattr.cpp
                                          ... //I replaced a bunch of paths here with ellipsis
                                          ../../src/RealPlay/FramePlayWnd.cpp

                                          FORMS += ../../src/MainWindow/DeviceTree/DeviceAttr/deviceattr.ui
                                          ...//I replaced a bunch of paths here with ellipsis
                                          ../../src/RealPlay/FramePlayWnd.ui

                                          INCLUDEPATH += ../../src/MainWindow/DeviceTree/
                                          ...//I replaced a bunch of paths here with ellipsis
                                          ../../src/Public

                                          include(../../src/ParaConfig/configure_params/RemoteParams/RemoteParams.pri)
                                          ...//I replaced a bunch of paths here with ellipsis
                                          include(../../src/ParaConfig/configure_params/HardDiskParams/HardDiskParams.pri)

                                          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