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. Linking Dlib to QT application
Forum Updated to NodeBB v4.3 + New Features

Linking Dlib to QT application

Scheduled Pinned Locked Moved Unsolved General and Desktop
16 Posts 6 Posters 6.7k Views 3 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.
  • A Offline
    A Offline
    Arqam
    wrote on last edited by Arqam
    #1

    Okay, I have spent more than 2 days just in this but still not able to figure out how its to be done.

    I have to link Dlib to my QT project. My .pro file is like this : https://pastebin.com/uiDsd3NA

    In this if I add dlib code then I get :-1: error: linker command failed with exit code 1 (use -v to see invocation) error and :-1: error: [QTDlibXMLGenerator.app/Contents/MacOS/QTDlibXMLGenerator] Error 1 .

    When I did normal inclusion of the external library it gave me linker error, which I resolved by adding source.cpp file in the SOURCES, then I started getting error related to X11 library and its development package, which I resolved using few extra lines in my .pro file as you can see (related to X11).

    And now finally this is the present condition, i.e. the error messages that I showed.

    timdayT 1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi
      Did you compile the libdlib.a yourself ?

      also QTDlibXMLGenerator is the Qt app (?), so it fails with error 1 in the linking phase?

      Also what version of Xcode ?

      seems 8 should be used ?
      https://www.learnopencv.com/install-dlib-on-macos/

      A 1 Reply Last reply
      0
      • A Arqam

        Okay, I have spent more than 2 days just in this but still not able to figure out how its to be done.

        I have to link Dlib to my QT project. My .pro file is like this : https://pastebin.com/uiDsd3NA

        In this if I add dlib code then I get :-1: error: linker command failed with exit code 1 (use -v to see invocation) error and :-1: error: [QTDlibXMLGenerator.app/Contents/MacOS/QTDlibXMLGenerator] Error 1 .

        When I did normal inclusion of the external library it gave me linker error, which I resolved by adding source.cpp file in the SOURCES, then I started getting error related to X11 library and its development package, which I resolved using few extra lines in my .pro file as you can see (related to X11).

        And now finally this is the present condition, i.e. the error messages that I showed.

        timdayT Offline
        timdayT Offline
        timday
        wrote on last edited by timday
        #3

        @Arqam (Came here from your link in https://forum.qt.io/topic/82293/installation-size-macos ); sorry no idea I've never used dlib. I'd hope you could get some more detailed information about why the linker command is failing (undefined symbols? files not found?).

        1 Reply Last reply
        2
        • mrjjM mrjj

          Hi
          Did you compile the libdlib.a yourself ?

          also QTDlibXMLGenerator is the Qt app (?), so it fails with error 1 in the linking phase?

          Also what version of Xcode ?

          seems 8 should be used ?
          https://www.learnopencv.com/install-dlib-on-macos/

          A Offline
          A Offline
          Arqam
          wrote on last edited by
          #4

          @mrjj said in Linking Dlib to QT application:

          https://www.learnopencv.com/install-dlib-on-macos/

          I am using QT IDE only not XCode.
          I used CMake to compile the libdlib.a .

          mrjjM 1 Reply Last reply
          0
          • A Arqam

            @mrjj said in Linking Dlib to QT application:

            https://www.learnopencv.com/install-dlib-on-macos/

            I am using QT IDE only not XCode.
            I used CMake to compile the libdlib.a .

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @Arqam
            Ok. as long as you use same compiler for both lib and app.

            A 1 Reply Last reply
            0
            • mrjjM mrjj

              @Arqam
              Ok. as long as you use same compiler for both lib and app.

              A Offline
              A Offline
              Arqam
              wrote on last edited by
              #6

              @mrjj I used the documentation to install QT, I didn't choose any compiler there. Did I do anything wrong?

              mrjjM 1 Reply Last reply
              0
              • A Arqam

                @mrjj I used the documentation to install QT, I didn't choose any compiler there. Did I do anything wrong?

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @Arqam
                I dont think so but its easy to test.
                Make default GUI app (via menu) and see if it runs.

                A 1 Reply Last reply
                1
                • mrjjM mrjj

                  @Arqam
                  I dont think so but its easy to test.
                  Make default GUI app (via menu) and see if it runs.

                  A Offline
                  A Offline
                  Arqam
                  wrote on last edited by
                  #8

                  @mrjj I am able to run the default app which shows the window, I am also able to run openCV code by linking my openCV library.
                  But Dlib its throwing errors in the build

                  mrjjM 1 Reply Last reply
                  0
                  • A Arqam

                    @mrjj I am able to run the default app which shows the window, I am also able to run openCV code by linking my openCV library.
                    But Dlib its throwing errors in the build

                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    @Arqam
                    Then it sounds like all is ok compiler wise.
                    Ccan you please try this
                    https://stackoverflow.com/questions/43795385/linker-command-failed-with-exit-code-1-use-v-to-see-invocation-xcode-8-swif

                    and if "reveal in log" tell more, post it here ?

                    A 2 Replies Last reply
                    0
                    • mrjjM mrjj

                      @Arqam
                      Then it sounds like all is ok compiler wise.
                      Ccan you please try this
                      https://stackoverflow.com/questions/43795385/linker-command-failed-with-exit-code-1-use-v-to-see-invocation-xcode-8-swif

                      and if "reveal in log" tell more, post it here ?

                      A Offline
                      A Offline
                      Arqam
                      wrote on last edited by
                      #10

                      @mrjj I am getting this error :

                      ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [XMLGenerator.app/Contents/MacOS/XMLGenerator] Error 1 01:18:21: The process "/usr/bin/make" exited with code 2. Error while building/deploying project XMLGenerator (kit: Desktop Qt 5.9.1 clang 64bit2) When executing step "Make"

                      The full terminal output with warnings : https://pastebin.com/azpD6Byh

                      Anything that I did wrong?

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

                        Hi,

                        Might be a silly question but are you sure that all your dependencies are built for 64bit ?

                        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
                        1
                        • P Offline
                          P Offline
                          patrik08
                          wrote on last edited by patrik08
                          #12

                          @Arqam said in Linking Dlib to QT application:

                          ld: symbol(s) not found for architecture x86_64 clang: error: linker

                          If you get error on type:

                          ld: symbol(s) not found for architecture x86_64 clang: error: linker
                          

                          By my experience ist tipical that one or more function wo you use from the lib ist not inside... or not avaiable...
                          Use console

                          nm --help libname.a  /// or waht else
                          

                          after you have all result from class & function inside the lib
                          typical resul: https://raw.githubusercontent.com/pehohlva/QCLD2/master/google_bridge/function.nm.txt

                          Mac architecture is very powerfull and give you all waht you need..
                          example .. today i discovery how to convert translate.tr file from qt to po . and back . and after translate online in many language... funny qt

                          && qmake file on mac is better give the full path..
                          LIBS += -L/usr/local/opt/curl/lib -lcurl
                          is not like cmake that you say:

                          find_package(Boost COMPONENTS system thread REQUIRED)
                          find_package(CURL REQUIRED)
                          

                          and all is run...

                          A 1 Reply Last reply
                          0
                          • P patrik08

                            @Arqam said in Linking Dlib to QT application:

                            ld: symbol(s) not found for architecture x86_64 clang: error: linker

                            If you get error on type:

                            ld: symbol(s) not found for architecture x86_64 clang: error: linker
                            

                            By my experience ist tipical that one or more function wo you use from the lib ist not inside... or not avaiable...
                            Use console

                            nm --help libname.a  /// or waht else
                            

                            after you have all result from class & function inside the lib
                            typical resul: https://raw.githubusercontent.com/pehohlva/QCLD2/master/google_bridge/function.nm.txt

                            Mac architecture is very powerfull and give you all waht you need..
                            example .. today i discovery how to convert translate.tr file from qt to po . and back . and after translate online in many language... funny qt

                            && qmake file on mac is better give the full path..
                            LIBS += -L/usr/local/opt/curl/lib -lcurl
                            is not like cmake that you say:

                            find_package(Boost COMPONENTS system thread REQUIRED)
                            find_package(CURL REQUIRED)
                            

                            and all is run...

                            A Offline
                            A Offline
                            Arqam
                            wrote on last edited by
                            #13
                            This post is deleted!
                            1 Reply Last reply
                            0
                            • SGaistS SGaist

                              Hi,

                              Might be a silly question but are you sure that all your dependencies are built for 64bit ?

                              A Offline
                              A Offline
                              Arqam
                              wrote on last edited by
                              #14

                              @SGaist I just included the library, I didn't see any dependecies that I had to handle.

                              My current .pro file is this : https://pastebin.com/5W6a0v9g

                              1 Reply Last reply
                              0
                              • mrjjM mrjj

                                @Arqam
                                Then it sounds like all is ok compiler wise.
                                Ccan you please try this
                                https://stackoverflow.com/questions/43795385/linker-command-failed-with-exit-code-1-use-v-to-see-invocation-xcode-8-swif

                                and if "reveal in log" tell more, post it here ?

                                A Offline
                                A Offline
                                Arqam
                                wrote on last edited by
                                #15

                                @mrjj Also I saw just now, QT is compiled using qMake and dlib is compiled using CMake.

                                jsulmJ 1 Reply Last reply
                                0
                                • A Arqam

                                  @mrjj Also I saw just now, QT is compiled using qMake and dlib is compiled using CMake.

                                  jsulmJ Online
                                  jsulmJ Online
                                  jsulm
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #16

                                  @Arqam said in Linking Dlib to QT application:

                                  QT is compiled using qMake and dlib is compiled using CMake

                                  this doesn't matter, what matters is the compiler used to build them.

                                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                                  1 Reply Last reply
                                  2

                                  • Login

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