[llvm-bugs] [Bug 36675] New: 'clang -fopenmp' complains about missing '-lomp', missing headers

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Mar 9 09:38:38 PST 2018


https://bugs.llvm.org/show_bug.cgi?id=36675

            Bug ID: 36675
           Summary: 'clang -fopenmp' complains about missing '-lomp',
                    missing headers
           Product: OpenMP
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Clang Compiler Support
          Assignee: unassignedclangbugs at nondot.org
          Reporter: kevinushey at gmail.com
                CC: llvm-bugs at lists.llvm.org

On macOS, using the binaries available from
http://releases.llvm.org/download.html, attempts to (naively?) compile a
program using OpenMP fail:

   kevin at cdrv:~/scratch
   $ ~/Desktop/clang+llvm-6.0.0-x86_64-apple-darwin/bin/clang -fopenmp
omp_hello.c
   ld: library not found for -lomp
   clang-6.0: error: linker command failed with exit code 1 (use -v to see
invocation)

This is in spite of the fact that LLVM ships 'libomp.dylib':

   kevin at cdrv:~/Desktop/clang+llvm-6.0.0-x86_64-apple-darwin
   $ find . -name "libomp.dylib"
   ./lib/libomp.dylib

Could / should clang append the library path containing 'libomp.dylib' when
compiling with OpenMP support?

I see similar behavior on other platforms where clang is distributed; e.g. on
my Ubuntu 16.04 VM with clang 3.8.0-2ubuntu4 I see:

   kevin at ubuntu:~/scratch
   $ clang -fopenmp omp_hello.c 
   omp_hello.c:1:10: fatal error: 'omp.h' file not found
   #include <omp.h>
            ^
   1 error generated.

   kevin at ubuntu:~/scratch
   $ clang -I/usr/lib/gcc/x86_64-linux-gnu/5/include -fopenmp omp_hello.c 
   /usr/bin/ld: cannot find -lomp
   clang: error: linker command failed with exit code 1 (use -v to see
invocation)

It would be nice if attempts to use '-fopenmp' with clang would 'just work'
without extra fussing with the include + library paths, as it does with gcc.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180309/cbcc0d84/attachment.html>


More information about the llvm-bugs mailing list