fiedl / hole-ice-scripts

Example scripts for the hole-ice extension of clsim in the IceCube simulation framework.
0 stars 0 forks source link

Build icetray on M1 Mac #1

Open fiedl opened 2 years ago

fiedl commented 2 years ago

I'm trying to build and run the icetray framework on an M1 Mac.

Framework Repository: https://github.com/icecube/icetray Framework Documentation: https://docs.icecube.aq/icetray/main/

macOS Guide: https://github.com/icecube/icetray/blob/main/cmake/resources/docs/supported_platforms/osx.rst https://docs.icecube.aq/icetray/main/projects/cmake/supported_platforms/osx.html

fiedl commented 2 years ago

Following the guide did not work.

https://icecube-spno.slack.com/archives/C02KQL9KN/p1660132490666279

Hi, I’m trying to build icetray on an M1 Mac.

I’ve followed the step-by-step guide at https://docs.icecube.aq/icetray/main/projects/cmake/supported_platforms/osx.html, but I’m running into troubles with boost.

[2022-08-10 13:49:47] fiedl@faustaff-010-020-007-137 ~/icecube/icetray-build
▶ cmake -D CMAKE_BUILD_TYPE=Debug -D SYSTEM_PACKAGES=true ~/icecube/icetray
...
-- python
-- +  version: 3.9.13
-- +   binary: /Users/fiedl/py3/bin/python3.9
-- + includes: /opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9
-- +     libs: /opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/lib/libpython3.9.dylib
-- +    numpy: /opt/homebrew/lib/python3.9/site-packages/numpy/core/include
-- +    scipy: FOUND
--
-- Boost
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
CMake Error at /opt/homebrew/Cellar/cmake/3.24.0/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Boost (missing: python) (found version "1.79.0")
Call Stack (most recent call first):
  /opt/homebrew/Cellar/cmake/3.24.0/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  /opt/homebrew/Cellar/cmake/3.24.0/share/cmake/Modules/FindBoost.cmake:2376 (find_package_handle_standard_args)
  cmake/tools/boost.cmake:57 (find_package)
  cmake/tools.cmake:71 (include)
  CMakeLists.txt:108 (include)

I’ve installed boost-python3 via brew bundle and I’ve double-checked that it’s there.

fiedl commented 2 years ago

https://icecube-spno.slack.com/archives/C02KQL9KN/p1660132680833889?thread_ts=1660132490.666279&cid=C02KQL9KN

The problem we saw was that homebrew installed python3.9, but boost_python3 linked against python 3.10.

👍

fiedl commented 2 years ago

Fix:

[2022-08-10 11:16:50] fiedl@fiedl-mbp ~/icecube
▶ git clone git@github.com:icecube/icetray.git

[2022-08-10 11:44:58] fiedl@fiedl-mbp ~/icecube/icetray main 6ce97c3a7
▶ brew bundle

[2022-08-10 13:59:36] fiedl@fiedl-mbp ~/icecube/icetray main 6ce97c3a7
▶ brew unlink python@3.9
▶ brew link python@3.10
▶ python3 --version
Python 3.10.6

[2022-08-10 13:31:06] fiedl@fiedl-mbp ~/icecube/icetray main 6ce97c3a7
▶ python3 -m venv --system-site-packages ${HOME}/py3/
▶ source ${HOME}/py3/bin/activate

# https://github.com/freqtrade/freqtrade/issues/4162
[2022-08-10 13:44:03] fiedl@fiedl-mbp ~/icecube/icetray main 6ce97c3a7
▶ export HDF5_DIR=/opt/homebrew/

[2022-08-10 13:35:40] fiedl@fiedl-mbp ~/icecube/icetray main 6ce97c3a7
▶ python3 -m pip install --upgrade pip
▶ python3 -m pip install -r requirements.txt

[2022-08-10 11:43:32] fiedl@fiedl-mbp ~/icecube/icetray-build
▶ cmake -D CMAKE_BUILD_TYPE=Debug -D SYSTEM_PACKAGES=true ~/icecube/icetray
...
-- python
-- +  version: 3.10.6
-- +   binary: /Users/fiedl/py3/bin/python3.10
-- + includes: /opt/homebrew/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/include/python3.10
-- +     libs: /opt/homebrew/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/lib/libpython3.10.dylib
-- +    numpy: /opt/homebrew/lib/python3.10/site-packages/numpy/core/include
-- +    scipy: FOUND
--
-- Boost
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Found Boost: /opt/homebrew/include (found version "1.79.0") found components: system thread date_time filesystem program_options regex iostreams python310 chrono atomic
fiedl commented 2 years ago
fiedl commented 2 years ago

This fetches the I3_TESTDATA

[2022-08-11 18:06:22] fiedl@faustaff-010-020-007-137 ~/icecube/icetray-build
▶ make rsync
fiedl commented 2 years ago

It seems, I'm missing opencl locally (#8), which is not supported by icetray on M1 architectures, yet.

See: https://github.com/icecube/icetray/blob/main/cmake/tools/opencl.cmake

Disabling OpenCL on Apple Silicon

This install method can still be used to successfully build steamshovel.