Linking error while compiling opencv with cuda on high sierra - macos

I am getting a linking error while compiling opencv with cuda on Mac OS X high Sierra (10.13.6).
Error message:
[ 21%] Linking CXX shared library ../../lib/libopencv_cudev.dylib
ld: warning: directory not found for option '-L/Users/unknownn/opencv/-Wl,-rpath,/usr/local/cuda'
ld: warning: directory not found for option '-L-Wl,-rpath,/usr/local/cuda'
ld: library not found for -llib
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [lib/libopencv_cudev.4.0.1.dylib] Error 1
make[1]: *** [modules/cudev/CMakeFiles/opencv_cudev.dir/all] Error 2
make: *** [all] Error 2
I have already tried pretty much every cuda (9, 9.2, 10) and opencv (3.4, 4.0.1) version. Also I am aware that every cuda version requires a specific Xcode version.
I have also tried various cmake versions
I checked for the correct cuda paths in ccmake.
I dont know why the ld warnings appear since /usr/local/cuda exist.
What is -llib?

I had the same problem as well, what's interesting is that the problem does not appear to be with OpenCV, but with cmake.
The FindCUDA that comes with cmake seems to be broken, producing that strange -llib. You can see it during the cmake run as well as:
Extra dependencies: cudart_static lib nppc nppial nppicc nppicom nppidei nppif nppig nppim nppist nppisu nppitc npps cublas cufft -L/usr/local/cuda/lib -L-Wl,-rpath,/usr/local/cuda
(Note the second element "lib", the last two -L... elements will cause problem when you do make install as well)
However, the opencv source package comes with FindCUDA.cmake files that seem to work.
Assuming:
cmake is in /usr/local/share/cmake
opencv source is in ~/opencv
Do the following first:
mv /usr/local/share/cmake/Modules/FindCUDA* /tmp # Or some other back up location
cp -r ~/opencv/cmake/FindCUDA* /usr/local/share/cmake/Modules
Then run your build steps as before (cmake ..., make ..., make install), and hopefully it will work this time (it did for me).
As far as I can tell, cmake has deprecated FindCUDA.cmake, so I'm guessing it won't get fixed any time soon.

Answer by Jack Leow was very usefull, but I had to make farther investigation, because indeed his solution doesn't work any more.
Finally I have found this answer on opencv github by alalek. If in short, he proposes to add following cmake definition:
-DOPENCV_CUDA_FORCE_BUILTIN_CMAKE_MODULE=ON
This solution works to me.
P.S.: Currently I managed to solve few more issues on my way to get awesome opencv build. But currently build is in progress (44%) hope it will be finished in next half an hour, haha!

sorry, although this workaround worked once with opencv-3.4.9 / XCode8.2 (Clang 8) / CMake 3.12, now the switching of the FindCUDA files does not work anymore with the combination
opencv-3.4.9 / XCode9.2 (Clang 9) / CMake 3.16 with the following error:
CMake Error at /Applications/CMake.app/Contents/share/cmake3.16/Modules/FindCUDA.cmake:416 (file):
file failed to open for writing (Permission denied):
/Users/filippo/opencv- 3.4.9/modules/core/CMakeFiles/cuda_compile.dir/src/cuda/cuda_compile_genera ted_gpu_mat.cu.o.depend
Call Stack (most recent call first):
/Applications/CMake.app/Contents/share/cmake-3.16/Modules/FindCUDA.cmake:1363 (cuda_include_nvcc_dependencies)
/Applications/CMake.app/Contents/share/cmake-3.16/Modules/FindCUDA.cmake:1650 (CUDA_WRAP_SRCS)
/Applications/CMake.app/Contents/share/cmake-3.16/Modules/FindCUDA.cmake:1663 (cuda_compile_base)
cmake/OpenCVDetectCUDA.cmake:262 (CUDA_COMPILE)
cmake/OpenCVUtils.cmake:1513 (ocv_cuda_compile)
cmake/OpenCVModule.cmake:927 (ocv_add_library)
cmake/OpenCVModule.cmake:848 (_ocv_create_module)
modules/core/CMakeLists.txt:81 (ocv_create_module)
I had to update XCode to the 9.2 because I had a "nullability" compiling error in the building opencv-3.4.9 probably caused by Clang.

Related

Issues building ivtools

I'm trying to install the ivtools vector graphics editor (http://ivtools.sourceforge.net/ivtools/index.html) on macOS big sur. I'm trying to build it from source and I keep running into the issue below
ld: library not found for -lIV
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I'm not entirely sure what the -lIV library is and can't find anything easily online. If anyone has done this before on macOS I'd appreciate some pointers.
Thanks!
Not finding the libIV library probably means this library was not successfully built. If it had built successfully you would see these files:
./src/IV-common/DARWIN/libIV-common.dylib
./src/IV-common/DARWIN/libIV-common.2.0.4.dylib
./src/IV/DARWIN/libIV.2.0.4.dylib
./src/IV/DARWIN/libIV.dylib
If you can locate the error message in building libIV I can probably be of more help.

Where is the intel sgx psw and making intel sgx work with ubunut 18.04

I've tried following the intel instructions to install sgx, but it requires the sgx_linux_x64_psw_.bin file, which i cannot find anywhere. I've got the driver installer (sgx_linux_x64_driver_1.35.bin) and the sdk installer(sgx_linux_x64_sdk_2.10.100.2.bin), intel seems not to have a psw for linux? If so, how do i properly work with sgx? I tried simply executing the driver and sdk .bin files, but the sample code in the sdk would not compile (after make SGX_MODE=SIM), even after setting the sgxsdk directory to /opt/intel/sgxsdk. I'd get the following compile error:
/usr/bin/ld: warning: libsgx_uae_service_sim.so, needed by /opt/intel/sgxsdk/lib64/libsgx_urts_sim.so, not found (try using -rpath or -rpath-link)
/opt/intel/sgxsdk/lib64/libsgx_urts_sim.so: undefined reference to `get_launch_token'
collect2: error: ld returned 1 exit status
Makefile:235: recipe for target 'app' failed
make[1]: * [app] Error 1
make[1]: Leaving directory '/opt/intel/sgxsdk/SampleCode/SampleEnclave'
Makefile:180: recipe for target 'all' failed
make: * [all] Error 2
Any help with either issue would be much appreciated!
So at least in my case, it seems the issue was that I was A, using a virtual machine, which can ONLY run in simulation mode, so getting a fully working version of sgx is impossible. Secondly, I was using an outdated installation guide, for anyone else trying to use this stuff, make sure to get the installation guide from the intel download page along with the version you are downloading.
download source code from https://github.com/intel/linux-sgx, compile according to the instructions and then install psw.

Configuring wxWidgets for OS X 10.10

I am trying to build a program that relies on wxWidgets to run properly. I have the latest version of Xcode installed. I have tried building wxWidgets (both wxWidgets-3.0.2 and wxWidgets-2.9.4, the version originally used by the main program). However, in both cases, running the makefile for the main program gives the following error:
make: /Users/path to wxWidgets/wxWidgets-2.9.4/build-cocoa-release/utils/wxrc/wxrc: No such file or directory
As I understand it, I need to build wxrc to get my main program to build properly (I have tried this, but apparently some header files are missing). Is there any way to configure wxWidgets before this step that will automatically build wxrc as well? Or is that something I need to build separately? If it is separate, how would that be done?
I've pasted the code I originally used to configure wxWidgets below, with line breaks to make it easier to read:
../configure --with-osx_cocoa --with-macosx-version-min=10.7
--with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk
--prefix="$(pwd)" --with-opengl CC=clang CXX=clang++ CXXFLAGS="-stdlib=libc++ -std=c++11"
OBJCXXFLAGS="-stdlib=libc++ -std=c++11" LDFLAGS=-stdlib=libc++
There is one error while building wxWidgets:
../src/osx/cocoa/utils.mm:250:28: error: cannot initialize a parameter of type 'id' with an lvalue of type
'wxNSAppController *'
[NSApp setDelegate:appcontroller];
When I go into the samples directory and enter "make", I get: ld: library not found for -lwx_osx_cocoau_xrc-2.9 clang: error: linker command failed with exit code 1 (use -v to see invocation) When entering "make" in demos, I get: ld: library not found for -lwx_osx_cocoau_core-2.9 clang: error: linker command failed with exit code 1 (use -v to see invocation)
If I missed any steps I should have taken before these (something with Xcode maybe?) please let me know. Thank you very much in advance.
Similar question. I have sugested a workaround proposed on a forum as follows: you can use --with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/".

Installing openmpi on OS/X: clang error: library -lgomp not found

I'm aiming to install openmpi 1.6.5 on my Macbook Pro, mountainlion 10.8.5, by following the straightforward guidelines at:
https://wiki.helsinki.fi/display/HUGG/Installing+Open+MPI+on+Mac+OS+X
While configuring with
./configure --prefix=/usr/local/bin F77=gfortran FC=gfortran
is successful, "make all" fails with:
clang: warning: argument unused during compilation: '-fopenmp'
CXXLD vtfilter
ld: library not found for -lgomp
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[7]: *** [vtfilter] Error 1
As a complete newbie, I'm stuck on this error... I read about it error here:
Error enabling openmp - "ld: library not found for -lgomp" and Clang errors
(sorry for the new thread on possibly the same issue--this website's instructions guided me to not post a new question as an answer to an old thread...)
I'm not sure if these fixes apply here (?)-- I've tried the ordering within $PATH, which had no effect. Does this look like I have an issue with my compilers? If there is more useful information I can post, please let me know.
Thank you for your time and help!
It would be much easier if you simply disable building of the bundled VampirTrace library:
$ ./configure --enable-contrib-no-build=vt ...
If you still need to trace and profile your MPI applications, you could download VampirTrace and build it separately.

library not found for -lQt5Concurrent

I'm a complete newb when it comes to compiled languages, I'm a web developer. But I need to build a C++ library.
I'm using OSX 10.9 with homebrew. The library's dependancies are Qt5, openCV, openBR... I managed to get that all running. Installed Qt5.2 beta from the official page, I built openCV and openBR myself from sources.
Now this final application throws this, when I try to make it:
ld: library not found for -lQt5Concurrent
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [libfacedet.dylib] Error 1
make[1]: *** [CMakeFiles/facedet.dir/all] Error 2
make: *** [all] Error 2
What the hell is lQt5Concurrent? There's no such lib installed on my system. I tried to find it, the only files that have concurrent in their name are header files in Qt's directory
/Users/ellmo/Qt5.2.0/5.2.0-beta1/clang_64/lib/QtConcurrent.framework/Versions/5/Headers/qtconcurrent_global.h
/Users/ellmo/Qt5.2.0/5.2.0-beta1/clang_64/lib/QtConcurrent.framework/Versions/5/Headers/qtconcurrentcompilertest.h
/Users/ellmo/Qt5.2.0/5.2.0-beta1/clang_64/lib/QtConcurrent.framework/Versions/5/Headers/qtconcurrentexception.h
/Users/ellmo/Qt5.2.0/5.2.0-beta1/clang_64/lib/QtConcurrent.framework/Versions/5/Headers/qtconcurrentfilter.h
/Users/ellmo/Qt5.2.0/5.2.0-beta1/clang_64/lib/QtConcurrent.framework/Versions/5/Headers/qtconcurrentfilterkernel.h
/Users/ellmo/Qt5.2.0/5.2.0-beta1/clang_64/lib/QtConcurrent.framework/Versions/5/Headers/qtconcurrentfunctionwrappers.h
/Users/ellmo/Qt5.2.0/5.2.0-beta1/clang_64/lib/QtConcurrent.framework/Versions/5/Headers/qtconcurrentiteratekernel.h
/Users/ellmo/Qt5.2.0/5.2.0-beta1/clang_64/lib/QtConcurrent.framework/Versions/5/Headers/qtconcurrentmap.h
/Users/ellmo/Qt5.2.0/5.2.0-beta1/clang_64/lib/QtConcurrent.framework/Versions/5/Headers/qtconcurrentmapkernel.h
/Users/ellmo/Qt5.2.0/5.2.0-beta1/clang_64/lib/QtConcurrent.framework/Versions/5/Headers/qtconcurrentmedian.h
/Users/ellmo/Qt5.2.0/5.2.0-beta1/clang_64/lib/QtConcurrent.framework/Versions/5/Headers/qtconcurrentreducekernel.h
/Users/ellmo/Qt5.2.0/5.2.0-beta1/clang_64/lib/QtConcurrent.framework/Versions/5/Headers/qtconcurrentrun.h
/Users/ellmo/Qt5.2.0/5.2.0-beta1/clang_64/lib/QtConcurrent.framework/Versions/5/Headers/qtconcurrentrunbase.h
/Users/ellmo/Qt5.2.0/5.2.0-beta1/clang_64/lib/QtConcurrent.framework/Versions/5/Headers/qtconcurrentstoredfunctioncall.h
/Users/ellmo/Qt5.2.0/5.2.0-beta1/clang_64/lib/QtConcurrent.framework/Versions/5/Headers/qtconcurrentthreadengine.h
/Users/ellmo/Qt5.2.0/5.2.0-beta1/clang_64/lib/QtConcurrent.framework/Versions/5/Headers/qtconcurrentversion.h
I have no idea how to get the proper Qt5 devlibs and where to link them.
The author of the application in question cannot help me, as he has no experience with OSX. He said he built this with no problem on Ubuntu.
I also don't think I can show you much of the code, as the application is proprietary.
Please help.
A suggestion from http://qt-project.org/forums/viewthread/22998
In your .pro file, add: LIBS += -lQt5Concurrent
There are a few other suggestions at that link as well, but I believe the one I mention is all I had to do.

Resources