Linking Dlib to QT application
-
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.
-
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/ -
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.
@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?).
-
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/@mrjj said in Linking Dlib to QT application:
I am using QT IDE only not XCode.
I used CMake to compile the libdlib.a . -
@mrjj said in Linking Dlib to QT application:
I am using QT IDE only not XCode.
I used CMake to compile the libdlib.a . -
@mrjj I used the documentation to install QT, I didn't choose any compiler there. Did I do anything wrong?
-
@Arqam
I dont think so but its easy to test.
Make default GUI app (via menu) and see if it runs. -
@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@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-swifand if "reveal in log" tell more, post it here ?
-
@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-swifand if "reveal in log" tell more, post it here ?
@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?
-
Hi,
Might be a silly question but are you sure that all your dependencies are built for 64bit ?
-
@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 consolenm --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.txtMac 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...
-
@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 consolenm --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.txtMac 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...
-
Hi,
Might be a silly question but are you sure that all your dependencies are built for 64bit ?
-
@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-swifand if "reveal in log" tell more, post it here ?
-
@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.