Opened 3 years ago

Closed 3 years ago

#63024 closed defect (fixed)

clang-12 does not support OpenMP

Reported by: szhorvat (Szabolcs Horvát) Owned by: ken-cunningham-webuse
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: kencu (Ken), jeremyhu (Jeremy Huddleston Sequoia)
Port: clang-12

Description

It seems that unlike clang-11, the clang-12 port does not support OpenMP. One of the main reasons I sometimes use Clang from MacPorts instead of Apple Clang is to get OpenMP support.

Is there any chance to restore this functionality, or am I stuck with clang-11?

I am using macOS 10.14.

Change History (4)

comment:1 Changed 3 years ago by kencu (Ken)

The clang-12 port for various reasons was a rewrite, but nothing should have changed with respect to openmp.

please show us an example of how you find it not working, and we'll see what the fix is.

comment:2 Changed 3 years ago by szhorvat (Szabolcs Horvát)

It turns out I made a mistake.

The accurate statement is that OpenMP does not work unless libomp is manually installed. Earlier Clang versions in MacPorts has libomp as a dependency.

You can try to compile a trivial C program (e.g. int main() { }) as

clang-mp-12 x.c -fopenmp

The compiler output is:

ld: warning: directory not found for option '-L/opt/local/lib/libomp'
ld: library not found for -lomp
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Note that not everyone may see this directly. Some people may just want to compile a package that relies on OpenMP instead of using it directly themselves. E.g. CMake will just say that "OpenMP was not found".

Ideally, the dependence on the libomp port would be retained.

comment:3 Changed 3 years ago by kencu (Ken)

of course, simple oversight on the rewrite perhaps. I'll check for the dep and add it if needed.

Originally I was thinking to build libomp with everything else clang-12 builds rather than have this separate libomp port, but in the end I changed it back to using the libomp port. I'm still not 100% sure that is the best idea....but testing is hard

For example, does clang-3.7 really work properly with libomp from the llvm-12 tree??

Do all ports need to use only one openmp library?

Last edited 3 years ago by kencu (Ken) (previous) (diff)

comment:4 Changed 3 years ago by ken-cunningham-webuse

Owner: set to ken-cunningham-webuse
Resolution: fixed
Status: newclosed

In c3567344673bb79e833ad7d7865708e8c95e2a81/macports-ports (master):

clang-12: tweak depends

closes: #63024

Note: See TracTickets for help on using tickets.