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

    <tr>
        <th>Summary</th>
        <td>
            Cannot ship openmp (libomp.dylib) on a sandboxed macOS app
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    My application runs fine with XCode and a self linked version of libomp.dylib (openmp) 17.0.6.
However, as soon as I enable the Sandbox on my macOS application the application throws (most likely because shared memory is unavailable).

Here is the exact error:
```
OMP: Error #179: Function Can't open TEMP failed:
OMP: System error #1: Operation not permitted
Assertion failure at kmp_runtime.cpp(6891): temp_reg_status_file_name.
OMP: Error #13: Assertion failure at kmp_runtime.cpp(6891).
```

Referencing this part of the code: https://github.com/llvm/llvm-project/blob/llvmorg-17.0.6/openmp/runtime/src/kmp_runtime.cpp#L6884-L6906

Has anyone tried shipping openmp with sandbox enabled and has found a workaround for this?

<img width="571" alt="image" src="https://github.com/llvm/llvm-project/assets/3169217/3c27dd91-cb22-427a-91f2-6de75356d803">


</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVE1vtDYQ_jXmMloEA8vHgUO6CWqlN8qrpofeImPPLm6MTW2z--6_rwy7baK2h0gIMx_MPPN4Zrj36mSIOrb_ie0fE76E0bpuONs_k8HKa_d8BT7PWgkelDXgFuPhqAzBRYURfj9YScCNBA6e9BG0Mu8k4UzOR3cbNYOd5lRetRqAYWNnMtPMsIW8TrO0Sln2yLKHn-2FzuQYHoB78NaaeP4CZPigCcJI8MqNHOwPsAamK0xcvLx-whZ9PsvOXnzMOVkfQKt30lcYSPDFE_iRO5Iw0WTdFZSHxfAzVzqmY9jeYN3AkaPoEjPQDy4CkHPWseJmZ1V2e1bx5fk7Kx7gKfoAwyKv2yj3ixErs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