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

Failure linking against OpenMP on macOS #91

Open
jvkersch opened this issue Dec 13, 2021 · 0 comments · Fixed by #92
Open

Failure linking against OpenMP on macOS #91

jvkersch opened this issue Dec 13, 2021 · 0 comments · Fixed by #92

Comments

@jvkersch
Copy link
Contributor

When using the CMake build scripts on macOS, FindOpenMP detects and enables OpenMP via the -Xclang -fopenmp flags, but this fails at linking time:

/opt/homebrew/Cellar/cmake/3.21.2/bin/cmake -E cmake_link_script CMakeFiles/test_verify_traces.dir/link.txt --verbose=1
/Library/Developer/CommandLineTools/usr/bin/cc  -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names -Xclang -fopenmp CMakeFiles/test_verify_traces.dir/tests/test_verify_traces.c.o -o test_verify_traces  libparasail.a /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/lib/libz.tbd
Undefined symbols for architecture arm64:
  "___kmpc_critical", referenced from:
      _.omp_outlined. in test_verify_traces.c.o
  "___kmpc_end_critical", referenced from:
      _.omp_outlined. in test_verify_traces.c.o
  "___kmpc_for_static_fini", referenced from:
      _.omp_outlined. in test_verify_traces.c.o
  "___kmpc_for_static_init_8", referenced from:
      _.omp_outlined. in test_verify_traces.c.o
  "___kmpc_fork_call", referenced from:
      _check_functions in test_verify_traces.c.o
ld: symbol(s) not found for architecture arm64

Apparently, Apple's clang has compiler support for OpenMP, but does not ship with the required libraries to actually provide the functionality (that's at least what I got from https://mac.r-project.org/openmp/).

Given that OpenMP support isn't strictly necessary for Parasail as a library, would it be possible to provide a build time flag to explicitly turn off OpenMP support? Something along the lines of

OPTION( WITH_OPENMP "Enable OpenMP (if supported by the compiler)" ON )
IF(WITH_OPENMP)
  INCLUDE( FindOpenMP )
ENDIF()

Compiler:

Apple clang version 12.0.5 (clang-1205.0.22.11)
Target: arm64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

This is on an Apple M1, with macOS 11.5.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant