Error building O2Physics

Dear experts,

I struggle to rebuild the O2Physics software on my local machine with M1 chip.
Previously I was using macOS Monterey together with Xcode 13.2, python3.9 in an conda environment.

In the process of trying to solve the building issues I updated to macOS Ventura, using python3.11, and removed Xcode but only installed Command line tools using xcode-select --install and deinstalled the conda environment and package manager.

When trying to build the software now, I am able to build all packages until O2. Here I receive the following error message:

ld: warning: ignoring file /usr/local/lib/libomp.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture arm64:
  "___kmpc_critical", referenced from:
      o2::itsmft::Clusterer::ClustererThread::finishChip(o2::itsmft::ChipPixelData*, std::__1::vector<o2::itsmft::CompClusterExt, std::__1::allocator<o2::itsmft::CompClusterExt>>*, std::__1::vector<unsigned char, std::__1::allocator<unsigned char>>*, o2::dataformats::ConstMCTruthContainerView<o2::MCCompLabel> const*, o2::dataformats::MCTruthContainer<o2::MCCompLabel>*) in Clusterer.cxx.o
  "___kmpc_dispatch_init_4", referenced from:
      _.omp_outlined. in Clusterer.cxx.o
      _.omp_outlined. in RawPixelDecoder.cxx.o
      _.omp_outlined..69 in RawPixelDecoder.cxx.o
      _.omp_outlined..150 in RawPixelDecoder.cxx.o
      _.omp_outlined..153 in RawPixelDecoder.cxx.o
  "___kmpc_dispatch_next_4", referenced from:
      _.omp_outlined. in Clusterer.cxx.o
      _.omp_outlined. in RawPixelDecoder.cxx.o
      _.omp_outlined..69 in RawPixelDecoder.cxx.o
      _.omp_outlined..150 in RawPixelDecoder.cxx.o
      _.omp_outlined..153 in RawPixelDecoder.cxx.o
  "___kmpc_end_critical", referenced from:
      o2::itsmft::Clusterer::ClustererThread::finishChip(o2::itsmft::ChipPixelData*, std::__1::vector<o2::itsmft::CompClusterExt, std::__1::allocator<o2::itsmft::CompClusterExt>>*, std::__1::vector<unsigned char, std::__1::allocator<unsigned char>>*, o2::dataformats::ConstMCTruthContainerView<o2::MCCompLabel> const*, o2::dataformats::MCTruthContainer<o2::MCCompLabel>*) in Clusterer.cxx.o
  "___kmpc_end_reduce_nowait", referenced from:
      _.omp_outlined..69 in RawPixelDecoder.cxx.o
      _.omp_outlined..153 in RawPixelDecoder.cxx.o
  "___kmpc_fork_call", referenced from:
      o2::itsmft::Clusterer::process(int, o2::itsmft::PixelReader&, std::__1::vector<o2::itsmft::CompClusterExt, std::__1::allocator<o2::itsmft::CompClusterExt>>*, std::__1::vector<unsigned char, std::__1::allocator<unsigned char>>*, std::__1::vector<o2::itsmft::ROFRecord, std::__1::allocator<o2::itsmft::ROFRecord>>*, o2::dataformats::MCTruthContainer<o2::MCCompLabel>*) in Clusterer.cxx.o
      o2::itsmft::RawPixelDecoder<o2::itsmft::ChipMappingITS>::decodeNextTrigger() in RawPixelDecoder.cxx.o
      o2::itsmft::RawPixelDecoder<o2::itsmft::ChipMappingMFT>::decodeNextTrigger() in RawPixelDecoder.cxx.o
  "___kmpc_global_thread_num", referenced from:
      o2::itsmft::Clusterer::process(int, o2::itsmft::PixelReader&, std::__1::vector<o2::itsmft::CompClusterExt, std::__1::allocator<o2::itsmft::CompClusterExt>>*, std::__1::vector<unsigned char, std::__1::allocator<unsigned char>>*, std::__1::vector<o2::itsmft::ROFRecord, std::__1::allocator<o2::itsmft::ROFRecord>>*, o2::dataformats::MCTruthContainer<o2::MCCompLabel>*) in Clusterer.cxx.o
      o2::itsmft::Clusterer::ClustererThread::finishChip(o2::itsmft::ChipPixelData*, std::__1::vector<o2::itsmft::CompClusterExt, std::__1::allocator<o2::itsmft::CompClusterExt>>*, std::__1::vector<unsigned char, std::__1::allocator<unsigned char>>*, o2::dataformats::ConstMCTruthContainerView<o2::MCCompLabel> const*, o2::dataformats::MCTruthContainer<o2::MCCompLabel>*) in Clusterer.cxx.o
      o2::itsmft::RawPixelDecoder<o2::itsmft::ChipMappingITS>::decodeNextTrigger() in RawPixelDecoder.cxx.o
      o2::itsmft::RawPixelDecoder<o2::itsmft::ChipMappingMFT>::decodeNextTrigger() in RawPixelDecoder.cxx.o
  "___kmpc_push_num_threads", referenced from:
      o2::itsmft::Clusterer::process(int, o2::itsmft::PixelReader&, std::__1::vector<o2::itsmft::CompClusterExt, std::__1::allocator<o2::itsmft::CompClusterExt>>*, std::__1::vector<unsigned char, std::__1::allocator<unsigned char>>*, std::__1::vector<o2::itsmft::ROFRecord, std::__1::allocator<o2::itsmft::ROFRecord>>*, o2::dataformats::MCTruthContainer<o2::MCCompLabel>*) in Clusterer.cxx.o
      o2::itsmft::RawPixelDecoder<o2::itsmft::ChipMappingITS>::decodeNextTrigger() in RawPixelDecoder.cxx.o
      o2::itsmft::RawPixelDecoder<o2::itsmft::ChipMappingMFT>::decodeNextTrigger() in RawPixelDecoder.cxx.o
  "___kmpc_reduce_nowait", referenced from:
      _.omp_outlined..69 in RawPixelDecoder.cxx.o
      _.omp_outlined..153 in RawPixelDecoder.cxx.o
  "_omp_get_thread_num", referenced from:
      _.omp_outlined. in Clusterer.cxx.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

(The full log can be found here: CERNBox)

To my current understanding, I would assume the issue lies in the command line tools version.

package-id: com.apple.pkg.CLTools_Executables
version: 14.3.0.0.1.1679647830

Using an older version (14.2) of the command line tools did not work either. (A colleague also uses the up to date version of it and builds without problems)

I would be happy about any suggestions.

Kind regards,
Florian

Hi Florian,

Did you copy a brew installation from an Intel Mac to your current M1 Mac?

Some of the stuff installed by Homebrew is for the x86_64 architecture – in this case, it’s libomp. This won’t work on your aarch64 M1 Mac.

I suggest you completely uninstall Homebrew (along with everything it installed in /usr/local) from your system and reinstall it according to the tutorial:

https://alice-doc.github.io/alice-analysis-tutorial/building/prereq-macos.html

1 Like

Hey Timo,

Thank you for pointing out.
Yes I have copied homebrew between an intel and M1 machine.
I knew about the problem that homebrew is now installed in a different location than it used to be.

I tried to uninstall homebrew and reinstall it. However this did not resolve the issue by itself since the libomp library remained in the directory of /usr/local/lib. I guess uninstalling homebrew did not touch this directory and the libraries inside it. So after manually removing the files related to libomp the build succeeded.

Thank you very much.
Kind regards, Florian