<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - check-libomp fails on darwin"
   href="https://llvm.org/bugs/show_bug.cgi?id=26164">26164</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>check-libomp fails on darwin
          </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>Linux
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Runtime Library
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>hans@chromium.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>howarth.mailing.lists@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Blocks</th>
          <td>26059
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre><a href="http://lab.llvm.org:8011/builders/libomp-clang-x86_64-linux-debian/">http://lab.llvm.org:8011/builders/libomp-clang-x86_64-linux-debian/</a> has been
red for a while.
Is there a bot running them on Darwin?

Are these tests even known to be passing? This is preventing me from building
the 3.8 release on Darwin.

Can someone please help get these working, and ideally also try building the
3.8 branch? If we don't get this working soon I'll have to exclude the openmp
runtime from the release.



First problem:

********************
FAIL: libomp :: worksharing/sections/omp_sections_reduction.c (67 of 67)
[....]
Command 0: "/work/llvm/build.release/./bin/clang" "-fopenmp=libomp" "-I"
"/work/llvm/projects/openmp/runtime/test" "-I"
"/work/llvm/build.release/projects/openmp/runtime/src" "-L"
"/work/llvm/build.release/lib" "-Wl,-rpath,/work/llvm/build.release/lib"
"/work/llvm/projects/
openmp/runtime/test/worksharing/sections/omp_sections_reduction.c" "-o"
"/work/llvm/build.release/projects/openmp/runtime/test/worksharing/sections/Output/omp_sections_reduction.c.tmp"
"-lm"
Command 0 Result: 1
Command 0 Output:


Command 0 Stderr:
/work/llvm/projects/openmp/runtime/test/worksharing/sections/omp_sections_reduction.c:2:10:
fatal error: 'stdio.h' file not found
#include <stdio.h>
         ^
1 error generated.



When using recently-built Clang, -isysroot needs to be passed on recent
versions of Darwin. This can be done like so:

diff --git a/runtime/test/lit.cfg b/runtime/test/lit.cfg
index 2f258ef..e6d4467 100644
--- a/runtime/test/lit.cfg
+++ b/runtime/test/lit.cfg
@@ -2,6 +2,7 @@
 # Configuration file for the 'lit' test runner.

 import os
+import subprocess
 import lit.formats

 # Tell pylint that we know config and lit_config exist somewhere.
@@ -57,6 +58,16 @@ if config.operating_system == 'Darwin':
     if config.using_hwloc:
         config.test_cflags += " -Wl,-rpath," + config.hwloc_library_dir

+# Find the SDK on Darwin
+if config.operating_system == 'Darwin':
+  cmd = subprocess.Popen(['xcrun', '--show-sdk-path'],
+                         stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+  out, err = cmd.communicate()
+  out = out.strip()
+  res = cmd.wait()
+  if res == 0 and out:
+    config.test_cflags += " -isysroot " + out
+
 # substitutions
 config.substitutions.append(("%libomp-compile-and-run", \
     "%clang %cflags %s -o %t -lm && %t"))




With that applied, the tests now fail or hang instead:

For example:
********************
FAIL: libomp :: worksharing/single/omp_single_private.c (57 of 67)
******************** TEST 'libomp :: worksharing/single/omp_single_private.c'
FAILED ********************
Script:
--
/work/llvm/build.release/./bin/clang -fopenmp=libomp -I
/work/llvm/projects/openmp/runtime/test -I
/work/llvm/build.release/projects/openmp/runtime/src -L
/work/llvm/build.release/lib  -Wl,-rpath,/work/llvm/build.release/lib -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk
/work/llvm/projects/openmp/runtime/test/worksharing/single/omp_single_private.c
-o
/work/llvm/build.release/projects/openmp/runtime/test/worksharing/single/Output/omp_single_private.c.tmp
-lm &&
/work/llvm/build.release/projects/openmp/runtime/test/worksharing/single/Output/omp_single_private.c.tmp
--
Exit Code: -10

Command Output (stdout):
--
Command 0: "/work/llvm/build.release/./bin/clang" "-fopenmp=libomp" "-I"
"/work/llvm/projects/openmp/runtime/test" "-I"
"/work/llvm/build.release/projects/openmp/runtime/src" "-L"
"/work/llvm/build.release/lib" "-Wl,-rpath,/work/llvm/build.release/lib"
"-isysroot"
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk"
"/work/llvm/projects/openmp/runtime/test/worksharing/single/omp_single_private.c"
"-o"
"/work/llvm/build.release/projects/openmp/runtime/test/worksharing/single/Output/omp_single_private.c.tmp"
"-lm"
Command 0 Result: 0
Command 0 Output:


Command 0 Stderr:


Command 1:
"/work/llvm/build.release/projects/openmp/runtime/test/worksharing/single/Output/omp_single_private.c.tmp"
Command 1 Result: -10



And omp_threadprivate_for.c just hangs.</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>