Closed dmwesterhoff closed 8 years ago
Believe to have tracked down the issue, it was due to a cocoapods flag that was using DEBUG=1 as a preprocessor macro
When I compiles the project, I also face the problem. Anyone knows how to deal with the problem?
ld: warning: ignoring file /Users/willard/codes/swift/dlib_app/face-landmarking-ios/DisplayLiveSamples/lib/libdlib.a, missing required architecture i386 in file /Users/willard/codes/swift/dlib_app/face-landmarking-ios/DisplayLiveSamples/lib/libdlib.a (2 slices)
Undefined symbols for architecture i386:
"_USER_ERROR__missing_dlib_all_source_cpp_file__OR__inconsistent_use_of_DEBUG_or_ENABLE_ASSERTS_preprocessor_directives_", referenced from:
__GLOBAL__sub_I_DlibWrapper.mm in DlibWrapper.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Don't use the simulator :) The camera won't work anyway. This error just means that the Dlib library is not compiled for the simulator (i386).
I encountered the same issue when I build dlib
from source and drag the static library into my xcode project. I finally managed to fix this error and I think it is good to have a step by step approach here for those who are not familier with compilation/linking. See here for instructions of building dlib
for iOS
.
The origin of this linking error comes from dlib/threads/threads_kernel_shared.h
. It's good to have a look on the comments in it. To fix the bug, do as following:
Build Settings > Apple LLVM - Custom Compiler Flags > Other C Flags
and enter -DDLIB_JPEG_SUPPORT -DDLIB_NO_GUI_SUPPORT -DNDEBUG -DDLIB_USE_BLAS -DDLIB_USE_LAPACK
dlib
static library.libdlib.a
compiled, drag it into your xcode project.Build Settings
in your xcode project and search for Preprocessor Macros
.
libdlib.a
.Preprocessor Macros
in your xcode project as DLIB_JPEG_SUPPORT DLIB_NO_GUI_SUPPORT NDEBUG DLIB_USE_BLAS DLIB_USE_LAPACK
if you follow step 1.-D
is removed for each flags.For me what ended up solving the issue was building Dlib under Release mode, by specifying it in the scheme. Thanks a lot for all the help!
@dboyliao Hi,
I did add for both Custom Compiler Flag as well as Preprocessor Macros.
But am still getting the same "_USER_ERROR__missing_dlib_all_source_cpp_file__OR__inconsistent_use_of_DEBUG_or_ENABLE_ASSERTS_preprocessor_directives_", referenced from:
error.
I just added one line : #include <dlib/image_processing.h>
to check for dlib. And this line gave me the error.
The error still continued in my case, until I realized that I had made a silly mistake. I had added the preprocessor macros but only on debug mode, I fixed it by making sure that it was inputed on both Debug and Release.
Same here
I am facing same issue tried all solution's above but I have stuck for flag -std=c++11, when I set it in build setting in my xcode project I get the more errors and I cannot build library without that flag because it is mandatory there. So its like blocker , I am trying to build 19.4 dlib version. Any help will be appreciated.
Same here: that nasty bugger did not want to go...
Finally I realised that it is also possible to use dlib without using cmake, as mentioned under chapter Compiling C++ Examples Without CMake. I added /all/source.cpp to my project and removed libdlib.a. Of course, I also had to add the correct path to the Header Search path (1 for dlib itself and one for libjpeg)
Hope this helps anyone!
Hi, wondering if you can speak or provide guidance to this specific link time issue I'm having
_USER_ERROR__missing_dlib_all_source_cpp_fileORinconsistent_use_of_DEBUG_or_ENABLE_ASSERTS_preprocessor_directives
This happened when I tried to port the libdlib.a and wrapper classes to my project- I have attempted to change all build settings in my project to look like the example project. Any ideas?