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

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.

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.

LLVM runs into a linker error after upgrade

I have a Haskell stack project where I have been using the llvm-hs library for building a compiler which emits LLVM IR. I had been working with LLVM version 8.0.0 so far. Recently due to a Python upgrade in my system the LLVM version got bumped to 8.0.1.
When I attempt to do stack build I get the following error -
ld: warning: directory not found for option '-L/usr/local/Cellar/llvm-8/8.0.0/lib/llvm-8/lib'
ld: library not found for -lLLVM-8
clang: error: linker command failed with exit code 1 (use -v to see invocation)
`gcc' failed in phase `Linker'. (Exit code: 1)
It seems from the above that ld is looking for -L/usr/local/Cellar/llvm-8/8.0.0/lib/llvm-8/lib whereas on my system I currently have the version for 8.0.1. How do I point ld to the correct path?
I am running MacOS Mojave. stack version 2.3.1. Thanks
I was capable of solving this by adding the following to my .bash_profile
export LIBRARY_PATH="$LIBRARY_PATH:/usr/local/Cellar/llvm-8/8.0.1/lib/llvm-8/lib"
Hope this helps if someone ran into the same problem.

Linking error while compiling opencv with cuda on high sierra

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.

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

Getting “ld: library not found for -llibopencv_dnn.3.3.1.dylib:
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.
Do you actually have OpenCV installed on your system? If you run the following command, do you get any output?
find / -name "*libopencv*" 2>/dev/null
If not, you probably need to ensure you install it first. Follow instructions such as the ones found here.
If the above does return something (example: /path/to/lib/libopencv_dnn.3.3.1dylib), then try adding -L/path/to/lib into your compile line
It looks like you're including the entire suite of OpenCV modules, some of which are very feature-specific and likely not needed if you have a simple application. The DNN module in particular is not included in binary form with OpenCV (see this page on the matter). If you're sure you need it, you need to compile it yourself.
If you aren't doing any machine learning, you likely don't need the library and you can remove -llibopencv_dnn.3.3.1.dylib from your compile line.

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/".

Resources