Skip to content

libomp header file conflicts with gcc openmp compilation #112107

@FilipeMaia

Description

@FilipeMaia

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

HOMEBREW_VERSION: 3.6.3
ORIGIN: https://github.com/Homebrew/brew
HEAD: d5b6b068c15a8df60f0f5e34a4ca80dcf82c48e3
Last commit: 5 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 3d00b39d454e973773f178f5541b1f651912fa65
Core tap last commit: 30 hours ago
Core tap branch: master
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.IKLaHGlLyB/org.xquartz:0
HOMEBREW_MAKE_JOBS: 10
Homebrew Ruby: 2.6.8 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: 10-core 64-bit arm_firestorm_icestorm
Clang: 13.0.0 build 1300
Git: 2.32.0 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 7.77.0 => /usr/bin/curl
macOS: 12.0.1-arm64
CLT: 13.2.0.0.1.1638488800
Xcode: N/A
Rosetta 2: false

$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: A newer Command Line Tools release is available.
Update them from Software Update in System Preferences or run:
  softwareupdate --all --install --force

If that doesn't show you any updates, run:
  sudo rm -rf /Library/Developer/CommandLineTools
  sudo xcode-select --install

Alternatively, manually download them from:
  https://developer.apple.com/download/all/.
You should download the Command Line Tools for Xcode 13.4.


Warning: Some installed kegs have no formulae!
This means they were either deleted or installed manually.
You should find replacements for the following formulae:
  szip

Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected dylibs:
  /usr/local/lib/libspimage.1.dylib

Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected header files:
  /usr/local/include/spimage.h
  /usr/local/include/spimage/colormap.h
  /usr/local/include/spimage/cuda_util.h
  /usr/local/include/spimage/fft.h
  /usr/local/include/spimage/find_center.h
  /usr/local/include/spimage/hashtable.h
  /usr/local/include/spimage/image.h
  /usr/local/include/spimage/image_filter.h
  /usr/local/include/spimage/image_filter_cuda.h
  /usr/local/include/spimage/image_io.h
  /usr/local/include/spimage/image_noise.h
  /usr/local/include/spimage/image_sphere.h
  /usr/local/include/spimage/image_util.h
  /usr/local/include/spimage/interpolation_kernels.h
  /usr/local/include/spimage/linear_alg.h
  /usr/local/include/spimage/list.h
  /usr/local/include/spimage/map.h
  /usr/local/include/spimage/mem_util.h
  /usr/local/include/spimage/phasing.h
  /usr/local/include/spimage/prtf.h
  /usr/local/include/spimage/sperror.h
  /usr/local/include/spimage/statistics.h
  /usr/local/include/spimage/support_update.h
  /usr/local/include/spimage/time_util.h

Verification

  • I ran brew update and am still able to reproduce my issue.
  • I have resolved all warnings from brew doctor and that did not fix my problem.

What were you trying to do (and why)?

To be able to compile OpenMP programs with both clang and gcc on a system with libomp installed.

What happened (include all command output)?

libomp installs omp.h in /opt/homebrew/include/omp.h
When compiling an OpenMP program which includes omp.h with gcc and using other header files in /opt/homebrew/include/ gcc will use libomp's header file as it takes priority over gcc's built-in omp.h file.
But that header file is incompatible with gcc's libgomp resulting in a broken program.

You the same issue in this bug report for the libomp RPM package for Fedora.

I also came across this issue here.

What did you expect to happen?

The omp.h from libomp should not be used when compiling OpenMP code with gcc.

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

Here's a small example of the problem: https://gist.github.com/biochem-fan/31864239460769d2a4a3585e4959d298

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugReproducible Homebrew/homebrew-core bugoutdatedPR was locked due to age

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions