First time here? Checkout the FAQ!
x
0 votes
by (640 points)
edited by
Hi,

I need to compile openCARP on a machine with Apple M1 chip. I followed the instruction in one of the previous answers ( https://opencarp.org/q2a/189/compiling-opencarp-on-an-apple-m1-machine?show=189#q189 ), but I still have errors. Here I report what I get:

The commands I provided are

cmake -S. -B_build -DDLOPEN=ON -DCMAKE_BUILD_TYPE=Release -D CMAKE_C_COMPILER=llvm-gcc -D CMAKE_CXX_COMPILER=llvm-g++

cmake --build _build

with last part of the output (just before the error)

[ 80%] Building CXX object CMakeFiles/opencarp-bin.dir/simulator/main.cc.o

[ 80%] Linking CXX executable bin/openCARP

ld: library not found for -lLIB_gfortran-NOTFOUND

clang: error: linker command failed with exit code 1 (use -v to see invocation)

gmake[2]: *** [CMakeFiles/opencarp-bin.dir/build.make:124: bin/openCARP] Error 1

gmake[1]: *** [CMakeFiles/Makefile2:336: CMakeFiles/opencarp-bin.dir/all] Error 2

gmake: *** [Makefile:156: all] Error 2

From the output of ccmake _build I found I miss other dependencies I do not know how to link:                                                      

 LIB_emutls_w  LIB_emutls_w-NOTFOUND  

[...]

LIB_gfortran      LIB_gfortran-NOTFOUND

[...]

LIB_quadmath   LIB_quadmath-NOTFOUND                                                                                                

Thank you in advance,

Edoardo

1 Answer

+1 vote
by (640 points)
edited by
Ok, I thought I found a workaround. I don't know if it is "best practice".

I just added to the PATH the outputs of

find /opt/ -iname '*libraryname*'

with libraryname={emutls,gfortran,quadmath}

Many possible paths where given, I added the ones similar to /opt/homebrew/lib/gcc/current (unfortunately I could not find any of the libraries in paths relative to llvm). Then I gave the usual commands to compile through cmake and it worked.

It is also important to add the line

export DYLD_LIBRARY_PATH=/path/to/these/libraries

to $HOME/.zshrc

in order not to have further issues when running openCARP and be sure that everything is dynamically linked fine.

Let me know if something more "canonical" exists.
by (150 points)
Hi,

I have the same issue with installing openCARP on mac M1.  I couldn't solve the problem with the suggested solution.

I appreciate any help or suggestion.

FYI,

> cmake -S. -B_build -DDLOPEN=ON -DCMAKE_BUILD_TYPE=Release -D CMAKE_C_COMPILER=llvm-gcc -D CMAKE_CXX_COMPILER=llvm-g++

> cmake --build _build
 
--------------------------------------------------------------------------------------------------------
Error:
--------------------------------------------------------------------------------------------------------
[ 81%] Built target simulator
[ 81%] Building CXX object CMakeFiles/opencarp-bin.dir/simulator/main.cc.o
[ 82%] Linking CXX executable bin/openCARP
ld: library not found for -lLIB_gfortran-NOTFOUND
clang: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[2]: *** [CMakeFiles/opencarp-bin.dir/build.make:125: bin/openCARP] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:301: CMakeFiles/opencarp-bin.dir/all] Error 2
gmake: *** [Makefile:156: all] Error 2

--------------------------------------------------------------------------------------------------------
~.zshrc :
--------------------------------------------------------------------------------------------------------
eval "$(/opt/homebrew/bin/brew shellenv)"
# Set PATH, MANPATH, etc., for Homebrew.
export PATH="/opt/homebrew/opt/make/libexec/gnubin:$PATH"
export PATH="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/:$PATH"

alias python=/usr/bin/python3
export PETSC_DIR=/Users/fchegini/opt
export PATH="/opt/petsc/bin:$PATH"


# export LDFLAGS="-L/opt/homebrew/Cellar/gcc/12.2.0/lib/gcc/current"
export LDFLAGS="-L/opt/homebrew/opt/llvm/lib"
export PATH="/opt/homebrew/bin:/opt/homebrew/sbin:/opt/homebrew/opt/llvm/bin:$PATH"
export CPPFLAGS="-I/opt/homebrew/opt/llvm/include"
export PATH=$HOME/openCARP/_build/bin:$PATH
export DYLD_LIBRARY_PATH=/opt/homebrew/lib/gcc/current

--------------------------------------------------------------------------------------------------------
what I have /opt/homebrew/lib/gcc/current
--------------------------------------------------------------------------------------------------------

drwxr-xr-x  37 fchegini  admin      1184 Sep 27 22:40 .
drwxr-xr-x   4 fchegini  admin       128 Aug 19 10:33 ..
drwxr-xr-x   3 fchegini  admin        96 Aug 19 10:33 gcc
-rw-r--r--   1 fchegini  admin    111760 Sep 27 22:40 libatomic.1.dylib
-rw-r--r--   1 fchegini  admin    259304 Aug 19 10:33 libatomic.a
lrwxr-xr-x   1 fchegini  admin        17 Aug 19 10:33 libatomic.dylib -> libatomic.1.dylib
-rw-r--r--   1 fchegini  admin   2003960 Aug 19 10:33 libcc1.0.so
lrwxr-xr-x   1 fchegini  admin        11 Aug 19 10:33 libcc1.so -> libcc1.0.so
-rw-r--r--   1 fchegini  admin    157600 Sep 27 22:40 libgcc_s.1.1.dylib
-rw-r--r--   1 fchegini  admin   1857536 Sep 27 22:40 libgfortran.5.dylib
-rw-r--r--   1 fchegini  admin   9086152 Aug 19 10:33 libgfortran.a
lrwxr-xr-x   1 fchegini  admin        19 Aug 19 10:33 libgfortran.dylib -> libgfortran.5.dylib
-rw-r--r--   1 fchegini  admin       195 Aug 19 10:33 libgfortran.spec
-rw-r--r--   1 fchegini  admin    413552 Sep 27 22:40 libgomp.1.dylib
-rw-r--r--   1 fchegini  admin   1802336 Aug 19 10:33 libgomp.a
lrwxr-xr-x   1 fchegini  admin        15 Aug 19 10:33 libgomp.dylib -> libgomp.1.dylib
-rw-r--r--   1 fchegini  admin       169 Aug 19 10:33 libgomp.spec
-rw-r--r--   1 fchegini  admin    268352 Sep 27 22:40 libitm.1.dylib
-rw-r--r--   1 fchegini  admin   1514248 Aug 19 10:33 libitm.a
lrwxr-xr-x   1 fchegini  admin        14 Aug 19 10:33 libitm.dylib -> libitm.1.dylib
-rw-r--r--   1 fchegini  admin       162 Aug 19 10:33 libitm.spec
-rw-r--r--   1 fchegini  admin    165232 Sep 27 22:40 libobjc-gnu.4.dylib
-rw-r--r--   1 fchegini  admin    470536 Aug 19 10:33 libobjc-gnu.a
lrwxr-xr-x   1 fchegini  admin        19 Aug 19 10:33 libobjc-gnu.dylib -> libobjc-gnu.4.dylib
-rw-r--r--   1 fchegini  admin    351792 Sep 27 22:40 libquadmath.0.dylib
-rw-r--r--   1 fchegini  admin   1191256 Aug 19 10:33 libquadmath.a
lrwxr-xr-x   1 fchegini  admin        19 Aug 19 10:33 libquadmath.dylib -> libquadmath.0.dylib
-rw-r--r--   1 fchegini  admin     57328 Sep 27 22:40 libssp.0.dylib
-rw-r--r--   1 fchegini  admin     61792 Aug 19 10:33 libssp.a
lrwxr-xr-x   1 fchegini  admin        14 Aug 19 10:33 libssp.dylib -> libssp.0.dylib
-rw-r--r--   1 fchegini  admin      2280 Aug 19 10:33 libssp_nonshared.a
-rw-r--r--   1 fchegini  admin   3458144 Sep 27 22:40 libstdc++.6.dylib
-rw-r--r--   1 fchegini  admin      2419 Sep 27 22:40 libstdc++.6.dylib-gdb.py
-rw-r--r--   1 fchegini  admin  22951080 Aug 19 10:33 libstdc++.a
lrwxr-xr-x   1 fchegini  admin        17 Aug 19 10:33 libstdc++.dylib -> libstdc++.6.dylib
-rw-r--r--   1 fchegini  admin   5061744 Aug 19 10:33 libstdc++fs.a
-rw-r--r--   1 fchegini  admin    992032 Aug 19 10:33 libsupc++.a
by (640 points)
Hi,
Have you checked, from the openCARP _build folder, that `ccmake .` outputs that everything is set up properly? In particular check for the LIB_gfortran entry, modify it and press c to restart the configuration phase of cmake. Try to do the same also for emutls and quadmath.
Alternatively, you could just purge your _build folder, update all the paths as indicated and then start again the configuration from scratch and try to compile openCARP if configuration goes smoothly

Best,
Edoardo
by (150 points)
Hi Edoardo,
Thanks, you are right, by  removing _build and manually adding some of the settings in ccmake,  I was able to compile openCARP smoothly.  

However, I am struggling to install carputils,  was wondering if you install carputil on M1 machine by following
https://opencarp.org/q2a/189/compiling-opencarp-on-an-apple-m1-machine?show=189#q189)?
by (640 points)
No, I did not try to install carputils on M1. The carputils installation I use is on a Linux machine. You can open a new question with your error for carputils
Welcome to openCARP Q&A. Ask questions and receive answers from other members of the community. For best support, please use appropriate TAGS!
architecture, carputils, documentation, experiments, installation-containers-packages, limpet, slimfem, website, governance
MathJax.Hub.Config({ tex2jax: { inlineMath: [ ['$','$'], ["\\(","\\)"] ], config: ["MMLorHTML.js"], jax: ["input/TeX"], processEscapes: true } }); MathJax.Hub.Config({ "HTML-CSS": { linebreaks: { automatic: true } } });
...