<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - 'clang -fopenmp' complains about missing '-lomp', missing headers"
   href="https://bugs.llvm.org/show_bug.cgi?id=36675">36675</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>'clang -fopenmp' complains about missing '-lomp', missing headers
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>OpenMP
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Clang Compiler Support
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>kevinushey@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>On macOS, using the binaries available from
<a href="http://releases.llvm.org/download.html">http://releases.llvm.org/download.html</a>, attempts to (naively?) compile a
program using OpenMP fail:

   kevin@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@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@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@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.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>