Created attachment 186994 [details] OpenMP C test file Trying to compile C code that utilizes OpenMP with Clang on FreeBSD 11.1 results in some compiler/linker errors: Trying to compile with: clang -o openmp_test openmp_test.c -fopenmp openmp_test.c:1:10: fatal error: 'omp.h' file not found It is located in /usr/local/include (openmp package) though Trying again to compile with: clang -o openmp_test openmp_test.c -fopenmp -I/usr/local/include /usr/bin/ld: cannot find -lomp It is located in /usr/local/lib (openmp package) Finally, it compiles with: clang -o openmp_test openmp_test.c -fopenmp -I/usr/local/include -L/usr/local/lib Shouldn't it add the right search paths for OpenMP from the get-go when issuing -fopenmp?
As long as libomp is in ports, you will have to manually add -I${LOCALBASE}/include to CFLAGS, and -L${LOCALBASE}/lib to LDFLAGS. This is how it has always been with ports. There are some preliminary plans for adding openmp to the base system, but this has the disadvantage that it can't be updated that easily anymore.
Meanwhile, perhaps, Uses/compiler.mk can be taught to use the base clang with the right options, when compiler:openmp is among ${USES} -- instead of insisting on gcc?
(In reply to Mikhail Teterin from comment #2) That would be bug 210337. USES=compiler:openmp cannot use Clang in base on FreeBSD 10.* because -fopenmp is ignored there, cannot use Clang from devel/llvm60 on FreeBSD 10.* because OPENMP is unconditionally disabled in the port, cannot use Clang on non-x86 where LLVM openmp isn't supported (on FreeBSD) and Clang cannot use libgomp (from lang/gcc*). And lang/gcc* is often required by USES=fortran consumers directly or via libgcc_s pollution.
libomp.so is part of base since 11.3/12.1, so -fopenmp should work without having to specify -I/-L flags. *** This bug has been marked as a duplicate of bug 236062 ***