# Error building O2Physics

**URL:** <https://alice-talk.web.cern.ch/t/error-building-o2physics/1455>\
**Category:** O2 Analysis\
**Tags:** build\
**Created:** [May 30, 2023, 1:18pm UTC](https://alice-talk.web.cern.ch/t/error-building-o2physics/1455 "2023-05-30T13:18:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![feisenhu](https://alice-talk.web.cern.ch/letter_avatar_proxy/v4/letter/f/85f322/32.png) [@feisenhu](https://alice-talk.web.cern.ch/u/feisenhu)\
**Post date:** [May 30, 2023, 1:18pm UTC](https://alice-talk.web.cern.ch/t/error-building-o2physics/1455/1 "2023-05-30T13:18:21Z")

</div>

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:

```auto
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](https://cernbox.cern.ch/s/Q146wLQbYyMsj2i))

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

```auto
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

---

<div class="post-metadata">

**Author:** ![twilken](https://alice-talk.web.cern.ch/letter_avatar_proxy/v4/letter/t/e9c0ed/32.png) [@twilken](https://alice-talk.web.cern.ch/u/twilken)\
**Post date:** [May 30, 2023, 3:41pm UTC](https://alice-talk.web.cern.ch/t/error-building-o2physics/1455/2 "2023-05-30T15:41:51Z")

</div>

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](https://alice-doc.github.io/alice-analysis-tutorial/building/prereq-macos.html)

---

<div class="post-metadata">

**Author:** ![feisenhu](https://alice-talk.web.cern.ch/letter_avatar_proxy/v4/letter/f/85f322/32.png) [@feisenhu](https://alice-talk.web.cern.ch/u/feisenhu)\
**Post date:** [May 31, 2023, 8:54am UTC](https://alice-talk.web.cern.ch/t/error-building-o2physics/1455/3 "2023-05-31T08:54:34Z")

</div>

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
