Error while launching cs under MacOS

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
konst
Posts: 30
Joined: Sun Sep 17, 2017 7:41 pm

Error while launching cs under MacOS

Post by konst »

Hello,

I had a problem launching code_saturne from master branch under MacOS. Some problems I have resolved but can not resolve this problem:

Code: Select all

konst@Konstantins-MacBook-Pro 20240105-1434 % ./run_solver
dyld[56974]: symbol not found in flat namespace '_cs_glob_ale'
I am using Mac with M1 processor.

Do you have any clues where I can take a look to resolve this issue

Thanks in advance,
Konstantin
Yvan Fournier
Posts: 4186
Joined: Mon Feb 20, 2012 3:25 pm

Re: Error while launching cs under MacOS

Post by Yvan Fournier »

Hello,

In the src/base/cs_ale.c file, there is a "_cs_glob_ale_data" structure, and a "cs_glob_ale" pointer pointing to that, but no variable named "_cs_glob_ale".

You can try renaming "_cs_glob_ale_data" as "_cs_glob_ale_data_s" for example in that whole file, in case the Mac OS linker does strange things with symbol names, but first try seeing what "ldd cs_solver" reports in your run directory.

Also, did you start with a clean build directory ? There might be issues with traces of previous attempts. What problems did you need to resolve ? We do not seem to have many users on Mac, and the Mac linker logic seems to change all the time (and has caused us issues in the past).

Best regards,

Yvan
konst
Posts: 30
Joined: Sun Sep 17, 2017 7:41 pm

Re: Error while launching cs under MacOS

Post by konst »

Dear Yvan,

Thanks for reply I will try to do this procedure. I have clean the build directory before compiling.

Best regards,
Konstantin
konst
Posts: 30
Joined: Sun Sep 17, 2017 7:41 pm

Re: Error while launching cs under MacOS

Post by konst »

I have figured out that this is appeared because I was using libraries hdf5 and med compiled on mac computer using different version of the compiler. I have recompiled hdf5 and med and everything works without errors.

Thanks for help.
StandardRANSUser001
Posts: 33
Joined: Tue Apr 09, 2024 3:26 am

Re: Error while launching cs under MacOS

Post by StandardRANSUser001 »

Hi Konstantin and Yvon,

I am also trying to install CS8.2 on an M1 Mac.

The issue I am facing is coming from the src/base/cs_math.cpp library. The compiler highlights an error as follows:

EXAMPLE/code_saturne/code_saturne-8.2.0/src/base/cs_math.cpp:238:22: error: expected ';' at end of declaration
238 | constexpr cs_real_t c_1ov6 = 1./6.;
| ^
| ;
EXAMPLE/code_saturne/code_saturne-8.2.0/src/base/cs_math.cpp:240:12: error: expected ';' after expression
240 | cs_real_t e, e1, e2, e3;
| ^
| ;
EXAMPLE/code_saturne/code_saturne-8.2.0/src/base/cs_math.cpp:240:14: error: use of undeclared identifier 'e'
240 | cs_real_t e, e1, e2, e3;
^
There are quite a few errors in this library, and I think that it might be a CPP compiler issue. In my setup file, some of my compilers have been installed with homebrew. Is this okay?

#--------------------------------------------------------
# Optional architecture Name (installation subdirectory)
#--------------------------------------------------------
use_arch no
arch Darwin_arm64
#
#--------------------------------------------------------
# C compiler and optional MPI wrapper
#--------------------------------------------------------
compC /usr/bin/cc
mpiCompC /opt/homebrew/bin/mpicc
#
#--------------------------------------------------------
# Fortran compiler
#--------------------------------------------------------
compF /opt/homebrew/bin/gfortran
#
#--------------------------------------------------------
# C++ compiler and MPI wrapper for optional packages
#
# Required only for static builds using the MED library
# or for build of optional modules such as MEDCoupling
# support.
#--------------------------------------------------------
compCxx /usr/bin/c++
mpiCompCxx /opt/homebrew/bin/mpicxx
#
#--------------------------------------------------------
# Python interpreter.
#--------------------------------------------------------
python /usr/local/bin/python3


When I check them with (e.g. mpicxx --version, mpicc --version), I receive a notification that it is part of the developer tools package.

Apple clang version 16.0.0 (clang-1600.0.26.4)
Target: arm64-apple-darwin24.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

When I type mpicxx --show for example:
>> clang++ -I/opt/homebrew/Cellar/open-mpi/5.0.1/include -L/opt/homebrew/Cellar/open-mpi/5.0.1/lib -lmpi

Finally, there are two issues that I am facing with the install_saturne.py script that I would like to report. Firstly, is the link to the MED library. The link to the Salome repo doesn't work, and I am using the alternative link (included in the install_saturne.py script). However, the download freezes, and I had to download this via the browser. The second issue is the ParMetis library, as this link is down, and I cannot install this library through the install_saturne.py script. This error also exists in the CS 8.3 installation as well.

Any assistance would be greatly appreciated. :)

Best regards,
Sean Hanrahan
Yvan Fournier
Posts: 4186
Joined: Mon Feb 20, 2012 3:25 pm

Re: Error while launching cs under MacOS

Post by Yvan Fournier »

Hello,

Regarding the compilation issues, this might be an issue with your compiler installation. Could you try installing without MPI wrappers to see if the issue is related to the MPI wrapper options or the compiler itself ?

I regularly build the code with various clang++ versions (clang 18 on one computer, and older versions on others) and have not encountered this.

Also, when things fail, I recommend switching to the lower level install procedure (you can use the command indicated at the top of config.log as a starting point and adjust it).

Not sure why there was an issue downloading MED.

Regarding ParMetis, their old website seems abandoned, and ParMetis is now on GitHub, but with no production release yet. Its build procedure is a bit different, and its licence is still not really open source. So I'll probably remove it from our installer and keep PT-Scotch only (it is already the default when both are available, so in most installs with both, ParMetis is actually not used unless chosen explicitly in the setup). If you really need it, I can add that I managed to install the GitHub version from source, so it is possible, and it seems to work, but I have run very few tests, only on a laptop. Given the alternatives, this is not a priority.

Best regards,

Yvan
StandardRANSUser001
Posts: 33
Joined: Tue Apr 09, 2024 3:26 am

Re: Error while launching cs under MacOS

Post by StandardRANSUser001 »

Hi Yvon,

Thanks for your help with this.

If I understand this correctly, part of this issue may be because MPI is not included in the developer-tools package that comes with terminal. MPI needs to be installed with homebrew, and the interactions between packages may be causing this issue.

My first installation worked(without MPI), and this was a compiler issue. Just to help everybody else out, you need to make sure that there are no interferences between compilers in homebrew and developer-tools. I have gone exclusively with the homebrew options.

Install 1 (No MPI):
./configure --prefix=USERDIR/code_saturne/8.2.0/code_saturne-8.2.0/arch/Darwin_arm64 --without-hdf5 --without-cgns --without-med --without-metis --without-scotch --disable-mpi-io PYTHON=/usr/local/bin/python3 --disable-static CC=/opt/homebrew/Cellar/gcc/14.2.0_1/bin/aarch64-apple-darwin24-gcc-14 CXX=/opt/homebrew/Cellar/gcc/14.2.0_1/bin/aarch64-apple-darwin24-c++-14 FC=/opt/homebrew/Cellar/gcc/14.2.0_1/bin/aarch64-apple-darwin24-gfortran-14

I am not sure if I am using ParMETIS at the moment. I was trying to install it, as it was an option in the script. I am sure if you removed it for the installation script, it would probably make it easier for most users.

I will update the scripts once I have tried installing again with MPI and the packages.

Best regards,
Sean Hanrahan
StandardRANSUser001
Posts: 33
Joined: Tue Apr 09, 2024 3:26 am

Re: Error while launching cs under MacOS

Post by StandardRANSUser001 »

Install 2 (HDF5, CGNS, MED, Scotch, no MPI):

Step 1: To avoid incompatibilities, make sure to start with
>>brew reinstall llvm
At the end of the install, there are a series of system flags available (some of which avoid the system clashes).
Make sure to add to the zshrc file by typing:
vi ~/.zshrc
export LDFLAGS="-L/opt/homebrew/opt/llvm/lib/unwind -lunwind"

Step 2:
Update all compliers in the setup script to be the homebrew compilers....

Step 3:
run the install_saturne.py script

Step 4:
There is a permissions error in the med installation.
>> cd med-5.0.0
>>chmod -R 775 ./

Step 5:
Rerun install_saturne.py
You may encounter an error because of the previous make (install one). Navigate to the build files and type
>> make distclean
Then rerun install_saturne.py

Step 6:
The MPI packages are the issue here. Install code saturne manually.
>>cd code_saturne.8.2.0
>> ./configure --prefix=/USERDIR/code_saturne/8.2.0/code_saturne-8.2.0/arch/Darwin_arm64 --with-hdf5=/USERDIR/code_saturne/8.2.0/hdf5-1.12.3/arch/Darwin_arm64 --with-cgns=/USERDIR/code_saturne/8.2.0/cgns-4.4.0/arch/Darwin_arm64 --with-med=/USERDIR/code_saturne/8.2.0/med-5.0.0/arch/Darwin_arm64 --without-metis --with-scotch=/USERDIR/code_saturne/8.2.0/scotch-7.0.4/arch/Darwin_arm64 PYTHON=/usr/local/bin/python3 --disable-static --disable-mpi-oi CC=/opt/homebrew/Cellar/gcc/14.2.0_1/bin/aarch64-apple-darwin24-gcc-14 CXX=/opt/homebrew/Cellar/gcc/14.2.0_1/bin/aarch64-apple-darwin24-c++-14 FC=/opt/homebrew/Cellar/gcc/14.2.0_1/bin/aarch64-apple-darwin24-gfortran-14
StandardRANSUser001
Posts: 33
Joined: Tue Apr 09, 2024 3:26 am

Re: Error while launching cs under MacOS

Post by StandardRANSUser001 »

Hi Yvon,

I am not sure what to do now - how should I go about installing code saturne with MPI?

Best regards,
Sean Hanrahan
StandardRANSUser001
Posts: 33
Joined: Tue Apr 09, 2024 3:26 am

Re: Error while launching cs under MacOS

Post by StandardRANSUser001 »

Hi Yvon,

In addition to my previous comment, I have found an additional issue when launching the case.

Hopefuly you have seen this before in a previous installation?

Best regards,
Sean Hanrahan

The error I received is:
dyld[97804]: Library not loaded: @rpath/libple.dylib.2
Referenced from: USERDIR/CS_cases/0x08/0x08_comp_ebrsm/RESU/20250120-1649/cs_solver
Reason: tried: ':USERDIR/code_saturne/8.2.0/code_saturne-8.2.0/arch/Darwin_arm64/lib:USERDIR/code_saturne/8.2.0/cgns-4.4.0/arch/Darwin_arm64/lib:USERDIR/code_saturne/8.2.0/med-5.0.0/arch/Darwin_arm64/lib:USERDIR/code_saturne/8.2.0/hdf5-1.12.3/arch/Darwin_arm64/lib:USERDIR/code_saturne/8.2.0/scotch-7.0.4/arch/Darwin_arm64/lib:/opt/homebrew/opt/llvm/lib:/opt/homebrew/opt/llvm/lib:/opt/homebrew/Cellar/gcc/14.2.0_1/lib/gcc/current/gcc/aarch64-apple-darwin24/14:/opt/homebrew/Cellar/gcc/14.2.0_1/lib/gcc/current/gcc:/opt/homebrew/Cellar/gcc/14.2.0_1/lib/gcc/current/libple.dylib.2' (no such file), 'USERDIR/CS_cases/0x08/0x08_comp_ebrsm/RESU/20250120-1649/libple.dylib.2' (no such file), '/opt/homebrew/Cellar/gcc/14.2.0_1/lib/gcc/current/gcc/aarch64-apple-darwin24/14/libple.dylib.2' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/Cellar/gcc/14.2.0_1/lib/gcc/current/gcc/aarch64-apple-darwin24/14/libple.dylib.2' (no such file), '/opt/homebrew/Cellar/gcc/14.2.0_1/lib/gcc/current/gcc/libple.dylib.2' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/Cellar/gcc/14.2.0_1/lib/gcc/current/gcc/libple.dylib.2' (no such file), '/opt/homebrew/Cellar/gcc/14.2.0_1/lib/gcc/current/libple.dylib.2' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/Cellar/gcc/14.2.0_1/lib/gcc/current/libple.dylib.2' (no such file), ':USERDIR/code_saturne/8.2.0/code_saturne-8.2.0/arch/Darwin_arm64/lib:USERDIR/code_saturne/8.2.0/cgns-4.4.0/arch/Darwin_arm64/lib:USERDIR/code_saturne/8.2.0/med-5.0.0/arch/Darwin_arm64/lib:USERDIR/code_saturne/8.2.0/hdf5-1.12.3/arch/Darwin_arm64/lib:USERDIR/code_saturne/8.2.0/scotch-7.0.4/arch/Darwin_arm64/lib:/opt/homebrew/opt/llvm/lib:/opt/homebrew/opt/llvm/lib:/opt/homebrew/Cellar/gcc/14.2.0_1/lib/gcc/current/gcc/aarch64-apple-darwin24/14:/opt/homebrew/Cellar/gcc/14.2.0_1/lib/gcc/current/gcc:/opt/homebrew/Cellar/gcc/14.2.0_1/lib/gcc/current/libple.dylib.2' (no such file), 'USERDIR/CS_cases/0x08/0x08_comp_ebrsm/RESU/20250120-1649/libple.dylib.2' (no such file), '/opt/homebrew/Cellar/gcc/14.2.0_1/lib/gcc/current/gcc/aarch64-apple-darwin24/14/libple.dylib.2' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/Cellar/gcc/14.2.0_1/lib/gcc/current/gcc/aarch64-apple-darwin24/14/libple.dylib.2' (no such file), '/opt/homebrew/Cellar/gcc/14.2.0_1/lib/gcc/current/gcc/libple.dylib.2' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/Cellar/gcc/14.2.0_1/lib/gcc/current/gcc/libple.dylib.2' (no such file), '/opt/homebrew/Cellar/gcc/14.2.0_1/lib/gcc/current/libple.dylib.2' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/Cellar/gcc/14.2.0_1/lib/gcc/current/libple.dylib.2' (no such file), '/usr/local/lib/libple.dylib.2' (no such file), '/usr/lib/libple.dylib.2' (no such file, not in dyld cache)
solver script exited with status 134.
Post Reply