<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/56821>56821</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [openmp] 12 tests are failing w/ standalone build if libomp-14.x is installed system-wide
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            openmp
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          mgorny
      </td>
    </tr>
</table>

<pre>
    It seems that there is some leakage of system libraries into the test suite. If libomp-14.0.6 is installed system-wide, running `check-openmp` from a standalone build of libomp-15.x (tip of `release/15.x` branch) yields the following test failures:

```
Failed Tests (12):
  libomp :: affinity/kmp-affinity-reset.c
  libomp :: api/omp_in_explicit_task.c
  libomp :: ompt/parallel/nested_thread_num.c
  libomp :: ompt/parallel/normal.c
  libomp :: ompt/parallel/not_enough_threads.c
  libomp :: ompt/tasks/serialized.c
  libomp :: ompt/tasks/taskloop_dispatch.c
  libomp :: ompt/teams/distribute_dispatch.c
  libomp :: ompt/worksharing/for/loop_dispatch.c
  libomp :: ompt/worksharing/sections_dispatch.c
  libomp :: tasking/hidden_helper_task/single_helper_thread.c
  libomp :: teams/teams-distr-on-host.c
```

openmp was configured with the following cmake flags:
```
cmake
 -C /tmp/portage/sys-libs/libomp-15.0.0.9999/work/openmp_build-abi_x86_64.amd64/gentoo_common_config.cmake
 -G Ninja
 -DCMAKE_INSTALL_PREFIX=/usr
 -DOPENMP_LIBDIR_SUFFIX=64
 -DLIBOMP_USE_HWLOC=yes
 -DLIBOMP_OMPT_SUPPORT=yes
 -DOPENMP_ENABLE_LIBOMPTARGET=yes
 -DLIBOMP_INSTALL_ALIASES=OFF
 -DLIBOMP_COPY_EXPORTS=OFF
 -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=yes
 -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=yes
 -DOPENMP_LLVM_LIT_EXECUTABLE=/usr/bin/lit
 -DOPENMP_LIT_ARGS="-vv;-j;12"
 -DOPENMP_TEST_C_COMPILER=/usr/lib/ccache/bin/x86_64-pc-linux-gnu-clang
 -DOPENMP_TEST_CXX_COMPILER=/usr/lib/ccache/bin/x86_64-pc-linux-gnu-clang++
 -DCMAKE_BUILD_TYPE=RelWithDebInfo
 -DCMAKE_TOOLCHAIN_FILE=/tmp/portage/sys-libs/libomp-15.0.0.9999/work/openmp_build-abi_x86_64.amd64/gentoo_toolchain.cmake
 /tmp/portage/sys-libs/libomp-15.0.0.9999/work/openmp
```

Full build and test log: 
[sys-libs:libomp-15.0.0.9999:20220730-183131.log](https://github.com/llvm/llvm-project/files/9227107/sys-libs.libomp-15.0.0.9999.20220730-183131.log)

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy1Vtty4jgQ_Rp4UdllbHDggQdzy7iWAMVlJ_OkEraMFWTJZclJ2K_fljEkELKZ1O5ysZF1us_pRt3SVsaHfqiRojRTSKdEw4UWFDGFlMwo4pTsyY4imSB1UJpmiLNtQQpGFWJCSwNHmipwUTJNbRQmBiGz3Gq1bcf2jScmlCac07j2Yb2wmDbcISpKIZjYoYbvRCmN9pbMqchyGKKkkBkiCAxFTLgUFG1LxmMj5OS_Y7-ihtvVLDdPwaigIFeB54mZM15AqojShttDB0Z5rCq5ieRcvhjeSnhCGC8Lqhpe0HBGDed09Z36Uw0ngIIA1mChDGvLBa9nE1SLQuaJFyCSJEwwfQApe5B6GlpAQ7UdfWKUM8DDA8wEpq85ZxHTWBO1_8wCfmowyUlh0svhpwB9NMY6LSiJsSizb5jKIiP8O3iNqZDlLq3p1Be2JhIFd0ULRjj7i8a_aWDuXMocx0zlREfpV3aUZMYO4Lpg21LT37V8kcVepbC8xQ5GiSzg-h3mS3tFI82kUF9amwCPJimLYypwSnlOi-q_N35gjtPzwyrZn7qqY6_uVpUBSworleq87q5W9vF6rDz0QhSKpEjYDkoiRi9Mp1c1E2VkD2NOdu8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