From 604fab75165829f49c1a46c55753d3e198e32f79 Mon Sep 17 00:00:00 2001 From: Charlotte Knight Date: Fri, 19 Dec 2025 17:25:49 +0000 Subject: [PATCH 1/5] fix executables --- Tutorial/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Tutorial/CMakeLists.txt b/Tutorial/CMakeLists.txt index 9cc7396..0032b7c 100755 --- a/Tutorial/CMakeLists.txt +++ b/Tutorial/CMakeLists.txt @@ -9,6 +9,10 @@ foreach(app ) add_executable(${app} ${app}.cpp) target_link_libraries(${app} MaCh3Tutorial::ValidationsUtils MaCh3Tutorial::SamplesTutorial) + set_target_properties(${app} PROPERTIES + BUILD_RPATH "${CMAKE_BINARY_DIR}/lib" + INSTALL_RPATH "@loader_path/../lib" + ) if(MaCh3Tutorial_PROFILING_ENABLED) target_link_libraries(${app} profiler # Add this line to link gperftools From 4e39cad8a2a9bd03d06594e2e85fab258b68dae7 Mon Sep 17 00:00:00 2001 From: Charlotte Knight Date: Mon, 22 Dec 2025 11:56:17 +0000 Subject: [PATCH 2/5] library paths via setup script instead of via cmake --- Tutorial/CMakeLists.txt | 4 -- cmake/Templates/setup.MaCh3Tutorial.sh.in | 51 ++++++++++++++++++++--- 2 files changed, 46 insertions(+), 9 deletions(-) diff --git a/Tutorial/CMakeLists.txt b/Tutorial/CMakeLists.txt index 0032b7c..9cc7396 100755 --- a/Tutorial/CMakeLists.txt +++ b/Tutorial/CMakeLists.txt @@ -9,10 +9,6 @@ foreach(app ) add_executable(${app} ${app}.cpp) target_link_libraries(${app} MaCh3Tutorial::ValidationsUtils MaCh3Tutorial::SamplesTutorial) - set_target_properties(${app} PROPERTIES - BUILD_RPATH "${CMAKE_BINARY_DIR}/lib" - INSTALL_RPATH "@loader_path/../lib" - ) if(MaCh3Tutorial_PROFILING_ENABLED) target_link_libraries(${app} profiler # Add this line to link gperftools diff --git a/cmake/Templates/setup.MaCh3Tutorial.sh.in b/cmake/Templates/setup.MaCh3Tutorial.sh.in index 150455c..db250e6 100755 --- a/cmake/Templates/setup.MaCh3Tutorial.sh.in +++ b/cmake/Templates/setup.MaCh3Tutorial.sh.in @@ -49,21 +49,62 @@ function add_to_LD_LIBRARY_PATH () { fi +if ! type add_to_DYLD_LIBRARY_PATH &> /dev/null; then + +function add_to_DYLD_LIBRARY_PATH () { + for d; do + + d=$(cd -- "$d" && { pwd -P || pwd; }) 2>/dev/null # canonicalize symbolic links + if [ -z "$d" ]; then continue; fi # skip nonexistent directory + + if [[ "$d" == "/usr/lib" ]] || [[ "$d" == "/usr/lib64" ]] || [[ "$d" == "/usr/local/lib" ]] || [[ "$d" == "/usr/local/lib64" ]]; then + case ":$DYLD_LIBRARY_PATH:" in + *":$d:"*) :;; + *) export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$d;; + esac + else + case ":$DYLD_LIBRARY_PATH:" in + *":$d:"*) :;; + *) export DYLD_LIBRARY_PATH=$d:$DYLD_LIBRARY_PATH;; + esac + fi + done +} + +fi + +if [ -n "$BASH_VERSION" ]; then + SCRIPT_PATH="${BASH_SOURCE[0]}" +elif [ -n "$ZSH_VERSION" ]; then + SCRIPT_PATH="${(%):-%x}" +else + echo "Unsupported shell" + return 1 +fi + #if it was sourced as . setup.sh then you can't scrub off the end... assume that #we are in the correct directory. -if ! echo "${BASH_SOURCE}" | grep "/" --silent; then +if ! echo "${SCRIPT_PATH}" | grep "/" --silent; then SETUPDIR=$(readlink -f ${PWD}/..) else - SETUPDIR=$(readlink -f ${BASH_SOURCE%/*}/..) + SETUPDIR=$(readlink -f ${SCRIPT_PATH%/*}/..) fi export MaCh3Tutorial_ROOT=${SETUPDIR} export MACH3=${SETUPDIR} add_to_PATH ${MaCh3Tutorial_ROOT}/CIValidations -add_to_LD_LIBRARY_PATH ${MaCh3Tutorial_ROOT}/lib -if [ -d "${MaCh3Tutorial_ROOT}/lib64" ]; then - add_to_LD_LIBRARY_PATH ${MaCh3Tutorial_ROOT}/lib64 + +if [[ "$(uname)" == "Darwin" ]]; then # macOS + add_to_DYLD_LIBRARY_PATH ${MaCh3Tutorial_ROOT}/lib + if [ -d "${MaCh3Tutorial_ROOT}/lib64" ]; then + add_to_DYLD_LIBRARY_PATH ${MaCh3Tutorial_ROOT}/lib64 + fi +else + add_to_LD_LIBRARY_PATH ${MaCh3Tutorial_ROOT}/lib + if [ -d "${MaCh3Tutorial_ROOT}/lib64" ]; then + add_to_LD_LIBRARY_PATH ${MaCh3Tutorial_ROOT}/lib64 + fi fi unset SETUPDIR From 61d2e698b47d3c028f12000a42d2375791b6aa98 Mon Sep 17 00:00:00 2001 From: Charlotte Knight Date: Mon, 22 Dec 2025 14:54:39 +0000 Subject: [PATCH 3/5] update README to include micromamba instructions --- README.md | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 57 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 81b00e4..6d07381 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ MaCh3 is predominantly C++ software, although some functionality is available th 2. [Sigma Variations](#sigma-variations) ## How to Start? -To compile simply +To compile try ```bash git clone https://github.com/mach3-software/MaCh3Tutorial.git mkdir build; @@ -51,11 +51,65 @@ then source bin/setup.MaCh3.sh source bin/setup.MaCh3Tutorial.sh ``` -alternatively you can use containers by + +If this does not work, check out the [Requirements](https://github.com/mach3-software/MaCh3/tree/Charlotte-Knight/tidy/MaCh3-on-Mac?tab=readme-ov-file#system-requirements) for MaCh3 in case you are missing something. + +One of the suggestions in [Requirements](https://github.com/mach3-software/MaCh3/tree/Charlotte-Knight/tidy/MaCh3-on-Mac?tab=readme-ov-file#system-requirements) is to use a conda/micromamba environment. You can install everything you need and build the tutorial using these commands: + +
+Click to see commands + +To install micromamba and the environment needed to build MaCh3: +``` +mkdir MaCh3Things && cd MaCh3Things + +echo "" | BIN_FOLDER=".micromamba" INIT_YES="n" CONDA_FORGE_YES="y" "${SHELL}" <(curl -L micro.mamba.pm/install.sh) + +cat > env.sh <<'EOF' +export MAMBA_ROOT_PREFIX="$(pwd)/.micromamba" +command="$(${MAMBA_ROOT_PREFIX}/micromamba shell hook -s posix)" +eval "$command" +EOF + +source env.sh + +micromamba env create -n MaCh3 -c conda-forge root cmake -y +micromamba activate MaCh3 +``` +and then to build MaCh3: +``` +git clone https://github.com/mach3-software/MaCh3Tutorial.git +cd MaCh3Tutorial + +mkdir build && cd build +cmake ../ +make -j8 +make install + +source bin/setup.MaCh3.sh +source bin/setup.MaCh3Tutorial.sh +``` + +> [!NOTE] +> To run the tutorial from a fresh terminal after this installation you must source and activate the relevant scripts and environments: +>``` +> cd MaCh3Things +> source env.sh # source micromamba +> micromamba activate MaCh3 +> +> cd MaCh3Tutorial/build +> source bin/setup.MaCh3.sh +> source bin/setup.MaCh3Tutorial.sh +>``` +
+ + +Alternatively you can use containers by ```bash docker pull ghcr.io/mach3-software/mach3tutorial:alma9latest ``` -To read more about how to use containers, check our wiki [here](https://github.com/mach3-software/MaCh3/wiki/12.-Containers) +To read more about how to use containers, check our wiki [here](https://github.com/mach3-software/MaCh3/wiki/12.-Containers). + ## How to run MCMC To run MCMC simply From 2326151bca1101b719f46fa1d4645086eec0cbc3 Mon Sep 17 00:00:00 2001 From: Charlotte Knight Date: Mon, 22 Dec 2025 14:57:14 +0000 Subject: [PATCH 4/5] readme formatting --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 6d07381..25cb11f 100644 --- a/README.md +++ b/README.md @@ -90,8 +90,7 @@ source bin/setup.MaCh3.sh source bin/setup.MaCh3Tutorial.sh ``` -> [!NOTE] -> To run the tutorial from a fresh terminal after this installation you must source and activate the relevant scripts and environments: +> **Note:** To run the tutorial from a fresh terminal after this installation you must source and activate the relevant scripts and environments: >``` > cd MaCh3Things > source env.sh # source micromamba From d450699926df83a0ee14af8c61896594db084d1f Mon Sep 17 00:00:00 2001 From: Charlotte Knight Date: Mon, 22 Dec 2025 15:40:54 +0000 Subject: [PATCH 5/5] hopefully fix linting --- README.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 25cb11f..4374a77 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ One of the suggestions in [Requirements](https://github.com/mach3-software/MaCh3 Click to see commands To install micromamba and the environment needed to build MaCh3: -``` +```bash mkdir MaCh3Things && cd MaCh3Things echo "" | BIN_FOLDER=".micromamba" INIT_YES="n" CONDA_FORGE_YES="y" "${SHELL}" <(curl -L micro.mamba.pm/install.sh) @@ -77,21 +77,21 @@ micromamba env create -n MaCh3 -c conda-forge root cmake -y micromamba activate MaCh3 ``` and then to build MaCh3: -``` +```bash git clone https://github.com/mach3-software/MaCh3Tutorial.git cd MaCh3Tutorial mkdir build && cd build cmake ../ make -j8 -make install +make install source bin/setup.MaCh3.sh source bin/setup.MaCh3Tutorial.sh ``` -> **Note:** To run the tutorial from a fresh terminal after this installation you must source and activate the relevant scripts and environments: ->``` +> **Note:** To run the tutorial from a fresh terminal after this installation you must source and activate the relevant scripts and environments: +>```bash > cd MaCh3Things > source env.sh # source micromamba > micromamba activate MaCh3 @@ -108,7 +108,6 @@ Alternatively you can use containers by docker pull ghcr.io/mach3-software/mach3tutorial:alma9latest ``` To read more about how to use containers, check our wiki [here](https://github.com/mach3-software/MaCh3/wiki/12.-Containers). - ## How to run MCMC To run MCMC simply