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

flang is missing OpenMP omp_lib.mod #201635

Open
scivision opened this issue Dec 18, 2024 · 1 comment
Open

flang is missing OpenMP omp_lib.mod #201635

scivision opened this issue Dec 18, 2024 · 1 comment
Labels
bug Reproducible Homebrew/homebrew-core bug

Comments

@scivision
Copy link

scivision commented Dec 18, 2024

brew gist-logs <formula> link OR brew config AND brew doctor output

HOMEBREW_VERSION: 4.4.12
ORIGIN: https://github.com/Homebrew/brew
HEAD: 3001afe88112c13b5aafdd92e097680897060881
Last commit: 3 days ago
Branch: stable
Core tap JSON: 18 Dec 14:11 UTC
Core cask tap JSON: 18 Dec 14:11 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.CjoOMKE3LL/org.xquartz:0
HOMEBREW_EDITOR: nano
HOMEBREW_MAKE_JOBS: 8
Homebrew Ruby: 3.3.6 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.6/bin/ruby
CPU: octa-core 64-bit arm_blizzard_avalanche
Clang: 16.0.0 build 1600
Git: 2.47.1 => /opt/homebrew/bin/git
Curl: 8.7.1 => /usr/bin/curl
macOS: 15.2-arm64
CLT: 16.2.0.0.1.1733547573
Xcode: 16.2
Rosetta 2: false
Your system is ready to brew.


### Verification

- [X] My `brew doctor` output says `Your system is ready to brew.` and am still able to reproduce my issue.
- [X] I ran `brew update` and am still able to reproduce my issue.
- [X] I have resolved all warnings from `brew doctor` and that did not fix my problem.
- [X] I searched for recent similar issues at https://github.com/Homebrew/homebrew-core/issues?q=is%3Aissue and found no duplicates.

### What were you trying to do (and why)?

Compile a trivial OpenMP program.

```fortran
program a

use omp_lib, only: omp_get_num_procs

print *, omp_get_num_procs()

end program

What happened (include all command output)?

error: Cannot read module file for module 'omp_lib': Source file 'omp_lib.mod' was not found

What did you expect to happen?

Expected file "omp_lib.mod" to be present under "/opt/homebrew/Cellar/flang/19.1.5/include/flang/" so that OpenMP Fortran program builds.

It could be that OpenMP isn't built for LLVM in the flang formula. Reference: llvm/llvm-project#90543

Step-by-step reproduction instructions (by running brew commands)

brew install flang

flang-new -fopenmp omp.f90 

Where omp.f90 is the source code above.

An equivalent C++ program builds successfully by:

brew install clang libomp

r=$(brew --prefix)/opt

$r/llvm/bin/clang++ -I$r/libomp/include omp.cpp -L$r/libomp/lib -lomp
#include <omp.h>
#include <iostream>
int main(){
std::cout << omp_get_num_procs() << "\n";
return 0;
}```
@scivision scivision added the bug Reproducible Homebrew/homebrew-core bug label Dec 18, 2024
@carlocab
Copy link
Member

It could be that OpenMP isn't built for LLVM in the flang formula. Reference: llvm/llvm-project#90543

This is correct. Pull requests to fix this welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Reproducible Homebrew/homebrew-core bug
Projects
None yet
Development

No branches or pull requests

2 participants