lwang-astro / PeTar

PeTar is a high-performance N-body code for modelling the evolution of star clusters and tidal streams, including the effect of galactic potential, dynamics of binary and hierarchical system, single and binary stellar evolution.
MIT License
71 stars 19 forks source link

Error in make on a MacBook Pro M2 #53

Open marlito-gonaldo-byte opened 1 month ago

marlito-gonaldo-byte commented 1 month ago

Hello,

I am trying to install PeTar on my MacBook Pro M2 2022 (macOS Sonoma 14.4.1), but I am having issue when I try to 'make'.

I did : ./configure --with-fdps-prefix=$HOME/Desktop/PBH/code/FDPS-7.0b --with-sdar-prefix=$HOME/Desktop/PBH/code/SDAR-master/ --prefix=$HOME/Desktop/PBH/code/install --with-arch=arm64

Which seems to have worked just fine.

Then I tried to : make install but it couldn't find the mpi library so I specified the path : make CXXFLAGS="-I/opt/homebrew/Cellar/open-mpi/5.0.3_1/include" install And now I get a really long error message which comes down to :

ld: symbol(s) not found for architecture arm64
collect2: error: ld returned 1 exit status
make: *** [build/petar.mpi.omp] Error 1

(By the way I have another issue open about the usage of PeTar on a HPC, I have not yet be able to solve my issue and my slurm jobs are pending, in the mean time I would like to install it on my laptop)

lwang-astro commented 1 month ago

With only the message:

ld: symbol(s) not found for architecture arm64
collect2: error: ld returned 1 exit status
make: *** [build/petar.mpi.omp] Error 1

I cannot identify the detail of the problem. I guess that your MPI compiler environment is not properly setuped that petar code cannot link the mpi library correctly. But it is not necessary to use MPI in the macbook, since it is useful for many CPU cores. For laptop, OpenMP is enough, you can switch off MPI to avoid the compiling issue by adding the configure option with-mpi=no

marlito-gonaldo-byte commented 1 month ago

Thanks,

I did this : ./configure --with-fdps-prefix=$HOME/Desktop/PBH/code/FDPS-7.0b --with-sdar-prefix=$HOME/Desktop/PBH/code/SDAR-master/ --prefix=$HOME/Desktop/PBH/code/install --with-arch=arm64 --with-mpi=no

and now I get the following error :

make CXXFLAGS="-I/opt/homebrew/Cellar/open-mpi/5.0.3_1/include -fopenmp" install
/opt/homebrew/bin/g++-12 -I./src  -I/Users/maelgonin/Desktop/PBH/code/FDPS-7.0b/src -I/Users/maelgonin/Desktop/PBH/code/SDAR-master//src -g -O0 -fbounds-check -Wall -std=c++17 -D SANITY_CHECK_REALLOCATABLE_ARRAY -I/opt/homebrew/Cellar/open-mpi/5.0.3_1/include -fopenmp -D USE_QUAD -D SOFT_PERT -D AR_TTL -D AR_SLOWDOWN_TREE -D AR_SLOWDOWN_TIMESCALE -D CLUSTER_VELOCITY -D HARD_CHECK_ENERGY -D HARD_COUNT_NO_NEIGHBOR -D ADJUST_GROUP_PRINT -D TIDAL_TENSOR_3RD -D AR_DEBUG -D AR_DEBUG_DUMP -D AR_DEBUG_PRINT -D AR_WARN -D HARD_DEBUG -D HARD_DEBUG_PRINT -D ADJUST_GROUP_DEBUG -D HERMITE_DEBUG -D AR_COLLECT_DS_MODIFY_INFO -D STABLE_CHECK_DEBUG_PRINT -D ARTIFICIAL_PARTICLE_DEBUG -D ARTIFICIAL_PARTICLE_DEBUG_PRINT -D HARD_DEBUG_PRINT_TITLE -D STABLE_CHECK_DEBUG -o build/petar.hard.debug ./src/hard_debug.cxx
In file included from /Users/maelgonin/Desktop/PBH/code/FDPS-7.0b/src/particle_simulator.hpp:5,
                 from ./src/hard_debug.cxx:6:
/Users/maelgonin/Desktop/PBH/code/FDPS-7.0b/src/domain_info.hpp: In member function 'void ParticleSimulator::DomainInfo::decomposeDomainMultiStep2(bool)':
/Users/maelgonin/Desktop/PBH/code/FDPS-7.0b/src/domain_info.hpp:1137:24: warning: variable 'full_len_root_domain' set but not used [-Wunused-but-set-variable]
 1137 |             const auto full_len_root_domain = pos_root_domain_.high_ - pos_root_domain_.low_;
      |                        ^~~~~~~~~~~~~~~~~~~~
/Users/maelgonin/Desktop/PBH/code/FDPS-7.0b/src/domain_info.hpp:1138:24: warning: unused variable 'my_rank' [-Wunused-variable]
 1138 |             const auto my_rank = comm_info_.getRank();
      |                        ^~~~~~~
In file included from ./src/hard_debug.cxx:12:
./src/hard.hpp: In member function 'void HardIntegrator::driftClusterCMRecordGroupCMDataAndWriteBack(ParticleSimulator::F64)':
./src/hard.hpp:1121:39: error: 'H4_step_sum' was not declared in this scope
 1121 |                  <<"  H4_step_sum: "<<H4_step_sum
      |                                       ^~~~~~~~~~~
./src/hard.hpp:1122:43: error: 'ARC_substep_sum' was not declared in this scope
 1122 |                  <<"  ARC_substep_sum: "<<ARC_substep_sum
      |                                           ^~~~~~~~~~~~~~~
./src/hard.hpp:1123:45: error: 'ARC_tsyn_step_sum' was not declared in this scope
 1123 |                  <<"  ARC_tsyn_step_sum: "<<ARC_tsyn_step_sum
      |                                             ^~~~~~~~~~~~~~~~~
In file included from /Users/maelgonin/Desktop/PBH/code/FDPS-7.0b/src/ps_defs.hpp:2688,
                 from /Users/maelgonin/Desktop/PBH/code/FDPS-7.0b/src/particle_simulator.hpp:4:
/Users/maelgonin/Desktop/PBH/code/FDPS-7.0b/src/util.hpp: At global scope:
/Users/maelgonin/Desktop/PBH/code/FDPS-7.0b/src/util.hpp:614:16: warning: 'int ParticleSimulator::GetColorForCommSplit(int, const int*, int, int)' defined but not used [-Wunused-function]
  614 |     static int GetColorForCommSplit(const int my_rank_glb, const int * n_domain, const int dim, const int cid){
      |                ^~~~~~~~~~~~~~~~~~~~
make: *** [build/petar.hard.debug] Error 1