Opened 7 years ago

Closed 7 years ago

#56292 closed enhancement (fixed)

fix ccpnmr package so that it actually builds again

Reported by: jwhowarth Owned by: kencu (Ken)
Priority: Normal Milestone:
Component: ports Version:
Keywords: haspatch maintainer Cc:
Port: ccpnmr

Description

The ccpnmr package has been broken for almost a year now and every attempt to fix it has failed. The attached Portfile diff and revised patch eliminates these build failures by blacklisting the cc, clang and all clang-macports compilers without working -fopenmp support. The revised patch eliminates the explicit passing of -lgomp (which is inappropriate for libomp) and insures that the -fopenmp flag is passed for linkages so that the openmp library is automatically added to the linkage.

Attachments (3)

ccpnmr.patch (5.8 KB) - added by jwhowarth 7 years ago.
revised patch to avoid explicit passing named openmp library and to rely on -fopenmp flag to handle this for us.
Portfile.diff (635 bytes) - added by jwhowarth 7 years ago.
Corrected Portfile.diff
omp_hello.c (1.1 KB) - added by jwhowarth 7 years ago.
simple c test case for -fopenmp support

Download all attachments as: .zip

Change History (13)

Changed 7 years ago by jwhowarth

Attachment: ccpnmr.patch added

revised patch to avoid explicit passing named openmp library and to rely on -fopenmp flag to handle this for us.

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

macports-clang.3.7, 3.8, and 3.9 support openmp as well.

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

comment:2 Changed 7 years ago by mf2k (Frank Schima)

Keywords: haspatch maintainer added; science removed
Type: updateenhancement

comment:3 in reply to:  1 Changed 7 years ago by jwhowarth

Replying to kencu:

macports-clang.3.7, 3.8, and 3.9 support openmp as well.

You are mistaken. Prior to llvm.org switching the -fopenmp default behavior to -fopenmp=libomp, it was set to -fopenmp=libgomp which was a rather bogus hack in that it actually only produces serial code. There hasn't been and won't ever be any openmp code generation in llvm for the libgomp openmp library. Only with llvm.org's 4.0 release was the libomp support mature enough to switch -fopenmp's default to -fopenmp=libomp. In prior releases, one had to explicitly pass -fopenmp=libomp to use the WIP version of libomp.

Version 1, edited 7 years ago by jwhowarth (previous) (next) (diff)

Changed 7 years ago by jwhowarth

Attachment: Portfile.diff added

Corrected Portfile.diff

comment:4 in reply to:  description ; Changed 7 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to jwhowarth:

The ccpnmr package has been broken for almost a year now and every attempt to fix it has failed.

Which attempts to fix it are you referring to? The last commit to the port that fixed anything was r144223 over 2 years ago.

The attached Portfile diff and revised patch eliminates these build failures by blacklisting the cc, clang and all clang-macports compilers without working -fopenmp support.

I see you've blacklisted all versions of clang provided by Xcode. Are you certain that none of them support -fopenmp?

comment:5 in reply to:  4 Changed 7 years ago by jwhowarth

Replying to ryandesign:

Replying to jwhowarth:

The ccpnmr package has been broken for almost a year now and every attempt to fix it has failed.

Which attempts to fix it are you referring to? The last commit to the port that fixed anything was r144223 over 2 years ago.

I was looking at the bulk commits for compilers.setup

https://github.com/macports/macports-ports/commit/907a4a8117d60463b70f5c3da327f4b7e8d34946#diff-9829349dfd70fc6e907badaaa36d2d45

The attached Portfile diff and revised patch eliminates these build failures by blacklisting the cc, clang and all clang-macports compilers without working -fopenmp support.

I see you've blacklisted all versions of clang provided by Xcode. Are you certain that none of them support -fopenmp?

Apple clang has never supported -fopenmp. Don't expect them to ever support openmp as it represents a competing technology to their blocks technology introduced with Grand Central Dispatch. If you try to compile any openmp code with the -fopenmp flag in Apple clang, you will get the errors...

clang: error: unsupported option '-fopenmp'
clang: error: unsupported option '-fopenmp'
Last edited 7 years ago by jwhowarth (previous) (diff)

Changed 7 years ago by jwhowarth

Attachment: omp_hello.c added

simple c test case for -fopenmp support

comment:6 Changed 7 years ago by jwhowarth

Note that you can use the attached omp_hello.c c example to verify this against Apple clang.

$ clang -fopenmp omp_hello.c
clang: error: unsupported option '-fopenmp'
clang: error: unsupported option '-fopenmp'

whereas

$ clang-mp-5.0 -fopenmp omp_hello.c
$ ./a.out
Hello World from thread = 3
Hello World from thread = 4
Hello World from thread = 2
Hello World from thread = 1
Hello World from thread = 5
Hello World from thread = 6
Hello World from thread = 7
Hello World from thread = 0
Number of threads = 8
Last edited 7 years ago by jwhowarth (previous) (diff)

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

This looks pretty good to me. I'll make up a PR for it.

comment:8 Changed 7 years ago by kencu (Ken)

OK, Jack, the PR is building. If it goes on through, we can commit it <https://github.com/macports/macports-ports/pull/1580>.

Ken

comment:9 Changed 7 years ago by kencu (Ken)

although macports-clang-3.7 does support openmp, it does so only with the variant applied. 3.8 and later support it by default. So the blacklisting of up to and including 3.7 seems appropriate.

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

comment:10 Changed 7 years ago by kencu (Ken)

Owner: set to kencu
Resolution: fixed
Status: newclosed

In 7fc418caab060eb8067f1359e91565f75aafb22d/macports-ports:

ccpnmr: repair openmp to fix compilation

closes: #56292
closes: #53953

Note: See TracTickets for help on using tickets.