root-project / root

The official repository for ROOT: analyzing, storing and visualizing big data, scientifically
https://root.cern
Other
2.63k stars 1.26k forks source link

Can't compile old versions in macOS arm64 #10370

Closed apereiroc closed 2 years ago

apereiroc commented 2 years ago

Hi,

I need to install ROOT 6.16 in my laptop (macOS Monterey M1 chip), but it's becoming so difficult due to the installation of TBB, and it also cannot detect the arm architecture (so when I configure the cmake building, I get Targeting X86).

Regarding the TBB issue, this is the output

-- TBB download command succeeded.  See also /Users/apereiro/root-histfact-test/new_build/TBB-prefix/src/TBB-stamp/TBB-download-*.log
[  0%] No update step for 'TBB'
[  0%] No patch step for 'TBB'
[  0%] No configure step for 'TBB'
[  0%] Performing build step for 'TBB'
CMake Error at /Users/apereiro/root-histfact-test/new_build/TBB-prefix/src/TBB-stamp/TBB-build-RelWithDebInfo.cmake:49 (message):
  Command failed: 2

   'make' 'compiler=clang' 'CXXFLAGS= -mno-rtm -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk' 'CPLUS=/Library/Developer/CommandLineTools/usr/bin/c++' 'CONLY=/Library/Developer/CommandLineTools/usr/bin/cc'

  See also

    /Users/apereiro/root-histfact-test/new_build/TBB-prefix/src/TBB-stamp/TBB-build-*.log

I have been following this pull request made by Axel and I made the same changes from the commits, but it's not sufficient to fix the whole problem.

Also I tried to configure with -Dbuiltin_tbb=OFF since I have the latest tbb from homebrew, but I get

-- Found TBB: /opt/homebrew
CMake Error at cmake/modules/SearchInstalledSoftware.cmake:1159 (if):
  if given arguments:

    "VERSION_LESS" "2018"

Can you point me to a solution, or propagate the patches you have been developing to older versions like this one?

Thanks

hahnjo commented 2 years ago

Hi @apereiroc, support for Apple Silicon, ie macOS arm64, was added with quite a number of changes over the last year(s). Moreover newer versions of macOS usually require slight changes to the build system or code. Backporting all of this to 6.16 won't be possible I fear. Is there no possibility to work with a more recent version of ROOT which is known to work with macOS arm64? If not, a different approach might be to download the binaries for x86 and run them via Rosetta 2, even though I don't know if that will work and how well...

apereiroc commented 2 years ago

Hi @hahnjo nope, I need this version since we have private patches at LHCb for RooStats/HistFactory and the last one works for 6.16.

I hadn't thought about Rosetta 2, maybe that's an option. Although as you say I have no idea how it will work

hahnjo commented 2 years ago

I'm closing this since we (as the ROOT team) won't backport support for macOS arm64 to 6.16. Regarding the TBB problem, I think you are affected by https://github.com/root-project/root/issues/8260. If you really need to use oneTBB, you might need to tweak SearchInstalledSoftware.cmake to work with it.