amusecode / amuse

Astrophysical Multipurpose Software Environment. This is the main repository for AMUSE
http://www.amusecode.org
Apache License 2.0
155 stars 98 forks source link

problem installing/running PeTar using AMUSE #1055

Closed marlito-gonaldo-byte closed 4 months ago

marlito-gonaldo-byte commented 4 months ago

I am trying to install PeTar code through AMUSE in order to use the amuse-interface PeTar python scripts. I am on a MacBook Pro M2 2022, I created a virtual environment for AMUSE installation, and was able to install most of the AMUSE code, see issue #1050. On my 1st try I used make petar.code and got this error :

clang: error: unsupported option '-fopenmp'
make[1]: *** [interface.o] Error 1

Then I did brew install llvm libomp in order to solve this library missing error. I set up the PATH in my .zprofile as follow :

export PATH=/opt/homebrew/bin:$PATH
export PATH="/Applications/Sublime Text.app/Contents/SharedSupport/bin:$PATH"
export PATH="/opt/homebrew/bin/python3.9:$PATH"
export PATH="/opt/homebrew/bin/mpiexec:$PATH"
export PATH="/opt/homebrew/opt/llvm/bin:$PATH"

export CC=/opt/homebrew/opt/llvm/bin/clang++

export LD_LIBRARY_PATH=/opt/homebrew/lib/:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/opt/homebrew/opt/llvm/lib/:$LD_LIBRARY_PATH

export LDFLAGS="-L/opt/homebrew/opt/libomp/lib"
export CPPFLAGS="-I/opt/homebrew/opt/libomp/include"

export LDFLAGS="-L/opt/homebrew/opt/llvm/lib"
export CPPFLAGS="-I/opt/homebrew/opt/llvm/include"

alias gcc=gcc-12 g++=g++-12

export PYENV_ROOT="$HOME/.pyenv"
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"

and got the following config file config.txt

when I make petar.code I get this error :

ld: library not found for -lstopcondmpi
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

when I make install petar.code I get this error :

/opt/homebrew/opt/llvm/bin/clang -g -O2 -fno-common -Wno-implicit-function-declaration -O2 -I/opt/homebrew/opt/llvm/include  -c -o g6lib.o g6lib.c
g6lib.c:112:8: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]

As you can see here I added -Wno-implicit-function-declaration to CLFLAGS in an attempt to solve the error, following https://www.redhat.com/en/blog/new-warnings-and-errors-clang-16 I have error with CUDA too for Sapporo 2 but it was expected since I am on a MacBook Pro M2.

LourensVeen commented 4 months ago

Clang is more strict than GCC, and unfortunately not all community codes in AMUSE work with it, so we're currently not supporting clang.

Could you try to use GCC instead? It comes with OpenMP included I think (it's not just the library, you need a compiler that supports it as well, hence -fopenmp rather than -lopenmpi), and it should accept the missing type specifier in g6lib.

The stopcondmpi library is part of the AMUSE framework, so if it's not found then there's another issue there. Let's swap compilers first though.

marlito-gonaldo-byte commented 4 months ago

I swapped the compiler and still have the same error

marlito-gonaldo-byte commented 4 months ago

Okay never mind I did a make distclean =>./configure => pip install -e . => make petar.code and it worked

I am closing the issue