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

    <tr>
        <th>Summary</th>
        <td>
            Openmp programs do not work without the user setting environment variables or magic linker flags
        </td>
    </tr>

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

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

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

<pre>
    `clang -fopenmp foo.c && ./a.out`
> error while loading shared libraries: libomp.so: cannot open shared object file: No such file or directory

This is the onboarding experience for people using openmp, marketed as a user friendly language for parallel programming. They take a hello world, compile it, and get a message that essentially reads "error, openmp is not available".

I'm tired of telling users this is intentional. That it's not something they've done wrong. We, their compiler developers, deliberately chose this behaviour.

This was fixed in January 2022 and then broken in March 2023, discussion is in https://reviews.llvm.org/D118493. Intentionally. We've added an FAQ entry saying that we know programs don't work at https://openmp.llvm.org/SupportAndFAQ.html#q-what-are-the-llvm-components-used-in-offloading-and-how-are-they-found

It' s actually worse that it initially sounds because in the situation where you have some library called libomp.so or libomptarget.so installed into the system directory the dynamic loader will try to use that instead - since we decided to prevent the executable finding the right library and Linux goes off filenames.

The reasoning in that review remains in place. Fedora systems do not want openmp programs to be executable without the developer learning about --runpath. That's at odds with the "user friendly" design goal of openmp but fine, let Fedora be broken, it's what they want.

I wish to resolve this issue by reinstating D118493. That'll fix the new user experience and mean that programs built with one version of openmp will run with the same version, which is fortunate given our reluctance to maintain constant ABIs.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxkVUuP2zgT_DXypSFBpmdsz8GHSfIZSPA9EHwB9twSWyJ3KFJLtqzRv180Jc8je7FB8dVVXVXElGzviS7F45fi8dsOJzYhXn4E_9VQYoqdJad3TdDLpTjWrUPfQ9mFkfwwQhdC1UKhjoU6QlWoK1Zh4uJYF_W3on4uDv8CijFEmI11BC6gtr6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