Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Build error: ld: library not found for -llibopencv_dnn.3.3.1.dylib

I'm working in ‘macOS Sierra’ and I'm attempting to run a make file and when I try I get the following: ld: library not found for -llibopencv_dnn.3.3.1.dylib clang: error: linker command failed with exit code 1 (use -v to see invocation)

Compile output log error: ++++++++++++++++++++++++++++++++ 11:27:44: Running steps for project Hello_OpenCV... 11:27:44: Configuration unchanged, skipping qmake step. 11:27:44: Starting: "/usr/bin/make" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -stdlib=libc++ -headerpad_max_install_names -arch x86_64 -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -mmacosx-version-min=10.10 -Wl,-rpath,@executable_path/Frameworks -o Hello_OpenCV main.o -L/usr/local/lib -llibopencv_dnn.3.3.1.dylib -llibopencv_ml.3.3.1.dylib -llibopencv_objdetect.3.3.1.dylib -llibopencv_shape.3.3.1.dylib -llibopencv_stitching.3.3.1.dylib -llibopencv_superres.3.3.1.dylib -llibopencv_videostab.3.3.1.dylib -llibopencv_calib3d.3.3.1.dylib -llibopencv_features2d.3.3.1.dylib -llibopencv_highgui.3.3.1.dylib -llibopencv_videoio.3.3.1.dylib -llibopencv_imgcodecs.3.3.1.dylib -llibopencv_video.3.3.1.dylib -llibopencv_photo.3.3.1.dylib -llibopencv_imgproc.3.3.1.dylib -llibopencv_flann.3.3.1.dylib -llibopencv_core.3.3.1.dylib

ld: library not found for -llibopencv_dnn.3.3.1.dylib clang: error: linker command failed with exit code 1 (use -v to see invocation) make: * [Hello_OpenCV] Error 1 11:27:44: The process "/usr/bin/make" exited with code 2. Error while building/deploying project Hello_OpenCV (kit: Desktop Qt 5.9.0 clang 64bit) When executing step "Make" 11:27:44: Elapsed time: 00:00.

++++++++++++++++++++++++++++++++ Working envoiremente: - macOS Sierra Ver. 10.12.6 - Qt Creator 4.4.1, based on Qt 5.9.2 (Clang 7.0(Apple), 64 bit) - OpenCV VERSION 3.3.1

Program Hello_OpenVC: ++++++++++++++++++++++++++++++++ Hello_OpenVC.pro ++++++++++++++++++++++++++++++++ TEMPLATE = app CONFIG += console c++11 CONFIG -= app_bundle CONFIG -= qt

SOURCES += main.cpp

QT_CONFIG -= no-pkg-config
CONFIG += link_pkgconfig
PKGCONFIG += opencv

++++++++++++++++++++++++++++++++ main.cpp ++++++++++++++++++++++++++++++++

include <iostream>

include <opencv2 opencv.hpp="">

using namespace std;

int main() { std::cout << "OpenCV VERSION" << CV_VERSION << std::endl; return 0; } ++++++++++++++++++++++++++++++++ Build Settings Enviroment variables: ++++++++++++++++++++++++++++++++ Apple_PubSub_Socket_Render = /private/tmp/com.apple.launchd.6V8CzKSzls/Render DISPLAY = /private/tmp/com.apple.launchd.Kuk2K8D3kC/org.macosforge.xquartz:0 HOME = /Users/joseperes LOGNAME = joseperes PATH = /Users/joseperes/Qt/5.9/clang_64/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin PKG_CONFIG_PATH = /usr/local/lib/pkgconfig QTDIR = /Users/joseperes/Qt/5.9/clang_64 SHELL = /bin/bash SSH_AUTH_SOCK = /private/tmp/com.apple.launchd.LVsFKHmOhI/Listeners TMPDIR = /var/folders/8x/hbqg3dj50zd4brm_0flwfqxr0000gn/T/ USER = joseperes XPC_FLAGS = 0x0 XPC_SERVICE_NAME = org.qt-project.qtcreator.27672 __CF_USER_TEXT_ENCODING = 0x1F5:0x0:0xA

++++++++++++++++++++++++++++++++ On terminal, just to check Build Enviroment variables: ++++++++++++++++++++++++++++++++

imac:/~: which pkg-config /usr/local/bin/pkg-config

imac:/~: find /usr/local -name "opencv.pc" /usr/local/lib/pkgconfig/opencv.pc

imac:/~: Pkg-config --cflags opencv -I/usr/local/include/opencv -I/usr/local/include

imac:/~: pkg-config --libs opencv
-L/usr/local/lib -llibopencv_dnn.3.3.1.dylib 
-llibopencv_ml.3.3.1.dylib 
-llibopencv_objdetect.3.3.1.dylib 
-llibopencv_shape.3.3.1.dylib 
-llibopencv_stitching.3.3.1.dylib 
-llibopencv_superres.3.3.1.dylib 
-llibopencv_videostab.3.3.1.dylib 
-llibopencv_calib3d.3.3.1.dylib 
-llibopencv_features2d.3.3.1.dylib 
-llibopencv_highgui.3.3.1.dylib 
-llibopencv_videoio.3.3.1.dylib 
-llibopencv_imgcodecs.3.3.1.dylib 
-llibopencv_video.3.3.1.dylib 
-llibopencv_photo.3.3.1.dylib 
-llibopencv_imgproc.3.3.1.dylib 
-llibopencv_flann.3.3.1.dylib 
-llibopencv_core.3.3.1.dylib