Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CMake] Add hack to find LLVM's OpenMP with GCC #984

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rengolin
Copy link
Contributor

This should replace #960.

It worked on my Ubuntu for both Clang and GCC.

@dbabokin please check that this works for you, too.

Fixes #959.

# On Fedora, it's at the same place as others, so we don't need to look elsewhere
# On Ubuntu, it's in /usr/lib/llvm-${version}, so find_package finds GOMP for GCC instead.
execute_process (
COMMAND bash -c "for lib in $(clang -lomp -### 2>&1); do echo $lib | grep -o \"\\/.*llvm.*\\w\"; done"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seem to not work as expected.

I tired running for lib in $(clang -lomp -### 2>&1); do echo $lib | grep -o \"\\/.*llvm.*\\w\"; done on both Ubuntu 22.04 and 24.04. I'm trying in docker: docker run -it ubuntu:22.04 /bin/bash. The only thing I do is apt update; apt install clang libomp-dev

On Ubuntu 22.04, I see that clang -lomp -### has "-L/usr/lib/llvm-14/bin/../lib" in it's output, but grep still doesn't catch it. On Ubuntu 24.04 there are no directories with llvm in it in clang's output.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for checking!

My idea here is that, if libomp is in a "standard" directory (ex. /lib64), we don't need to add the extra library path. But if it's in an "LLVM specific" directory, we do. So, if clang adds any "LLVM specific" directory, we do, too.

So, even if the command line above doesn't find anything, it's still possible that we can continue to build with GCC as hoped.

@rengolin rengolin added enhancement New feature or request stability Improves stability and allows forward progress low-priority Things that go in the back burner labels Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request low-priority Things that go in the back burner stability Improves stability and allows forward progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build issues on Ubuntu 24.04 - incorrect openmp linkage in CMake
2 participants