I'm having trouble compiling (portmaster) ImageMagick6-nox11-6.9.10.14_1,1 and ImageMagick7-nox11-7.0.8.14_1, v6 fails with "/usr/bin/ld: cannot find -lomp" In both cases, the OPENMP option is NOT selected. (#223518) In ImageMagick6 the fail is libtool: link: cc -shared -fPIC -DPIC coders/.libs/coders_dng_la-dng.o -Wl,-rpath -Wl,/var/ports/usr/ports/graphics/ImageMagick6-nox11/work/ImageMagick-6.9.10-14/magick/.libs -Wl,-rpath -Wl,/usr/local/lib -Wl,-rpath -Wl,/usr/local/lib magick/.libs/libMagickCore-6.so -lpthread -L/usr/local/lib -lfreetype -llqr-1 -lglib-2.0 -lintl -lfftw3 -lxml2 -llzma -lbz2 -lz /usr/local/lib/libltdl.so -lm -lraw_r -llcms2 -Oz -march=barcelona -mtune=barcelona -march=amdfam10 -fstack-protector -pthread -fstack-protector -fopenmp -pthread -fopenmp -Wl,-soname -Wl,dng.so -Wl,-version-script -Wl,coders/.libs/dng.so-ver -o coders/.libs/dng.so /usr/bin/ld: cannot find -lomp cc: error: linker command failed with exit code 1 (use -v to see invocation) gmake[2]: *** [Makefile:5688: coders/dng.la] Error 1 gmake[2]: *** Waiting for unfinished jobs.... and in ImageMagick7 it is 10 -fstack-protector -pthread -fstack-protector -pthread -Wl,-soname -Wl,dpx.so -Wl,-version-script -Wl,coders/.libs/dpx.so-ver -o coders/.libs/dpx.so /usr/bin/ld: cannot find -lomp cc: error: linker command failed with exit code 1 (use -v to see invocation) gmake[2]: *** [Makefile:6385: coders/dng.la] Error 1 gmake[2]: *** Waiting for unfinished jobs.... FreeBSD 11.2-RELEASE-p6 #0 r341740
does not seem to be related to threads, tried all four permutations of THREADS and OPENMP to no avail.
On this jail, the service that calls ImageMagick is www/nextcloud. I can disable ImageMagick in the nextcloud config to get past the bug. It is suboptimal, but works.
c++ --version FreeBSD clang version 6.0.0 (tags/RELEASE_600/final 326565) (based on LLVM 6.0.0) Target: x86_64-unknown-freebsd11.2 Thread model: posix InstalledDir: /usr/bin
Confirm the bug. Please, change the Importance to Affects Everyone. It can't find /usr/local/llvm60/lib/ /usr/local/llvm70/lib/ /usr/local/llvm-devel/lib/ libomp.so properly, although it is in ldconfig path!! But other ports having OpenMP option enabled find it properly. Obviously, it local ImageMagick script failure.
Obviously, it's local ImageMagick script failure for clang (llvm) -fopenmp parameter . What-so-ever OpenMP is checked or unchecked in options (make config) - it fails with built-in clang 7.0.1 for FBSD latest, 'cause there is no such lib for built-in llvm (clang), see bug #222858 . When GCC (GCC8) is used to compile, it succeeds with OpenMP option unchecked and checked. When not built-in clang is used (llvm/clang 6) it succeeds. ImageMagic needs more intellectual script detecting availability of -lomp at config stage and auto-disable it, whether it's unavailable (what-so-ever it's enabled by `make config`).
ImageMagic needs more intellectual script detecting availability of -lomp at config stage and auto-disable it, whether it's unavailable (what-so-ever it's enabled by `make config`). OR Requiring as dependency extra LLVM OpenMP supporting port installed for clang compiler.
Better approach could be so: for `make config` ---OpenMP--- ( ) Compile with the latest (not -devel) GCC (*) Compile with the latest (not -devel) LLVM --- for ImageMagick configuration script try to `pkg ins ` latest compiler, whether it's been not installed yet (as we all know the very long compilation process for hours of such huge ports like GCC & LLVM), if fails, try to compile it from ports and continue compil. of ImageMagick. I'm very newbie and can not create such patch myself. N.B. It's very good practice for any port: at first, try to meet dependencies with `pkg ins ...` (for huge ports at least). Thank you for development.
(In reply to gessel from comment #1) You may try to install devel/openmp to use with built-in llvm , but in my case it led to other failure for - ImageMagick6 (6.9.10.16,1): libtool: link: /usr/local/bin/nm -B coders/.libs/aai_la-aai.o ... > coders/.libs/aai.exp eval: 1: Syntax error: "|" unexpected
I also encountered an issue (unable to find -lomp) attempting to build (via poudriere) with OPENMP option set. Upon reviewing the Makefile, it appears that USES+= compiler:openmp is set, which, from reading Mk/Uses/compiler.mk, it appears should toggle gcc to be used. Nonetheless, it appeared from my build log that clang was being used. Clang/llvm (6.0.1, in base; 7 merges in direct support, but that's not what we have currently) wants the omp library, which is a separate install, whereas gcc uses -lgomp, which is part of the gcc install. Changing the graphics/ImageMagick6 makefile to include USE_GCC=any instead of USES+=compiler:openmp successfully worked around this problem and built cleanly. I also attempted using clang while adding "LIB_DEPENDS+=libomp.so:devel/openmp", which failed, with the error Mikhail noted. The output actually had "| |" as part of one of the build commands (a pipe to empty whitespace to another pipe). This is possibly a separate issue related to building with clang that should be tracked down, but forcing gcc as above works.
I also encountered this error in poudriere on 11.2-RELEASE and 12.0-RELEASE: /usr/bin/ld: cannot find -lomp cc: error: linker command failed with exit code 1 (use -v to see invocation) As @nhoyle suggested, I used: USE_GCC=gcc8 since I have the port built.
Just out of curiosity, I've compared ImageMagick6's Makefile vs ImageMagick7's, the only significant difference I see is: USES= compiler:c++11-lang in the ImageMagick6's while ImageMagick7 doesn't have it. When omitting that usage in ImageMagick6, ImageMagick6 failed to 'fetch' while ImageMagick7 builds OK.
Both versions of the port/package are being produced successfully on the package building cluster (FreeBSD:12:amd64/latest), as of August 25, 2019 ImageMagick6-nox11-6.9.10.57,1.txz ImageMagick7-nox11-7.0.8.57_1.txz We need: - Confirmation this issue is still present with the latest port/package versions - System/environment information (as attachments, uname -a, pkg version -v, /etc/make.conf contents) - Build logs exhibiting the failure (as attachments) - To understand/identify the conditions under which this issue is present
Created attachment 207038 [details] Build log /usr/bin/ld: error: unable to find library -lomp
Created attachment 207039 [details] `uname -a` and `/etc/make.conf`
Issue still persists on my machine with Freebsd 12.0-RELEASE and ports updated as of 2019-08-29, with openmp/threads set or unset. Using poudriere to build the pkg, so I'm not sure how helpful my host configuration is.
Can't reproduce this on either 12.2-RELEASE (Poudriere) or 13-STABLE (not using Poudriere) so I'm closing this bug report. Please reopen if it presists.
*** Bug 232124 has been marked as a duplicate of this bug. ***