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

Broken support of OpenMP with GFortran #5255

Open
jbloino opened this issue Sep 17, 2024 · 0 comments
Open

Broken support of OpenMP with GFortran #5255

jbloino opened this issue Sep 17, 2024 · 0 comments
Labels

Comments

@jbloino
Copy link
Contributor

jbloino commented Sep 17, 2024

Xmake Version

2.9.5

Operating System Version and Architecture

macOS Sonoma 14.6.1, Linux debian testing kernel 6.9.10

Describe Bug

gfortran fails to link the OpenMP library at the final compilation stage, with all references to OpenMP primitives unresolved.
This problem was confirmed on mac OS X arm64 and Linux AMD 64.

Expected Behavior

The compilation should work

Project Configuration

xmake.lua

add_rules("mode.debug", "mode.release")
add_requires("openmp")

target("test_omp")
    set_kind("binary")
    add_packages("openmp")
    add_files("test_openmp.f90")

test_openmp.f90

program test_openmp
    integer, external :: omp_get_num_threads

    !$omp parallel
    print '("Number of threads: ",i0)', omp_get_num_threads()
    !$omp end parallel

end program test_openmp

Additional Information and Error Logs

It seems that the problem is in the use of result.fcldflags = "-fopenmp" on l.77.
Replacing it with result.ldflags = "-fopenmp" fixes the problem (the "shared" case was not tested).

@jbloino jbloino added the bug label Sep 17, 2024
@jbloino jbloino changed the title Broken support of OpenMP with Broken support of OpenMP with GFortran Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant