# Compiling parallel version on macOS 10.13

**URL:** <https://community.freefem.org/t/compiling-parallel-version-on-macos-10-13/310>\
**Category:** FreeFEM installation\
**Created:** [March 24, 2020, 5:25pm UTC](https://community.freefem.org/t/compiling-parallel-version-on-macos-10-13/310 "2020-03-24T17:25:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lcirrottola](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/lcirrottola/32/106_2.png) [@lcirrottola](https://community.freefem.org/u/lcirrottola)\
**Post date:** [March 24, 2020, 5:25pm UTC](https://community.freefem.org/t/compiling-parallel-version-on-macos-10-13/310/1 "2020-03-24T17:25:37Z")

</div>

Hello,  
I am compiling FreeFem++ on macOS 10.13 (HighSierra) with all library dependencies from brew. The compiler is gcc-9, the MPI library is openmpi 4.0.2 (from brew again).

I am sticking to the documentation [Installation guide](https://doc.freefem.org/introduction/installation.html#compilation-on-osx-10-13) and I am using a very minimalistic configuration:

> ./configure --enable-download \  
> –enable-m64 \  
> –enable-optim \  
> –with-mpi=mpic++ \  
> CC=gcc-9 F77=gfortran-9 FC=gfortran-9

(with that mpi compiler wrappers using the same gcc version)

Anyway, when compilation gets to the mpi part, undefined symbols are found and it stops (I post here just the beginning of the error message)

> Making all in mpi  
> depbase=`echo parallelempi.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;  
> /usr/local/bin/mpic++ -DHAVE\_CONFIG\_H -I. -I…/… -I./…/fflib -I./…/Graphics -I./…/femlib /usr/local/bin/g+±9 -I/usr/local/Cellar/open-mpi/4.0.2/include -I/usr/local/opt/szip/include -I/usr/local/Cellar/hdf5/1.10.5\_1/include -I/usr/local/ff-petsc/real/include -DPARALLELE -g -m64 -fPIC -DNDEBUG -O3 -std=c++11 -DBAMG\_LONG\_LONG -DNCHECKPTR -fPIC -MT parallelempi.o -MD -MP -MF $depbase.Tpo -c -o parallelempi.o parallelempi.cpp &&  
> mv -f $depbase.Tpo $depbase.Po  
> …/…/config.status --file=ff-mpirun:ff-mpirun.in  
> config.status: creating ff-mpirun  
> chmod a+x ff-mpirun  
> g+±9: warning: /usr/local/bin/g+±9: linker input file unused because linking not done  
> /usr/local/bin/mpic++ -DPARALLELE -g -m64 -fPIC -DNDEBUG -O3 -std=c++11 -DBAMG\_LONG\_LONG -DNCHECKPTR -fPIC -o FreeFem+±mpi ffapi.o …/Graphics/sansrgraph.o …/lglib/mymain.o …/lglib/lg.tab.o parallelempi.o …/fflib/libff.a -Wl,-rpath,/usr/local/ff-petsc/real/lib -L/usr/local/ff-petsc/real/lib -lumfpack -lklu -lcholmod -lbtf -lccolamd -lcolamd -lcamd -lamd -lsuitesparseconfig -larpack -llapack -framework Accelerate -L/usr/local/opt/libevent/lib -L/usr/local/Cellar/open-mpi/4.0.2/lib -lmpi -lm -lcblas -L/usr/local/Cellar/gcc/9.2.0\_3/lib/gcc/9/gcc/x86\_64-apple-darwin17/9.2.0 -L/usr/local/Cellar/gcc/9.2.0\_3/lib/gcc/9/gcc/x86\_64-apple-darwin17/9.2.0/…/…/… -lgfortran -lquadmath -lm -L/usr/local/opt/szip/lib -L/usr/local/Cellar/hdf5/1.10.5\_1/lib -lm -ldl -lz -lsz -lhdf5 -lhdf5\_hl  
> Undefined symbols for architecture x86\_64:  
> “ShowType(std::basic\_ostream\<char, std::char\_traits \>&)”, referenced from:  
> OneOperator0::E\_F0\_F::operator basicForEachType const\*() const in parallelempi.o  
> EConstant\<fMPI\<ompi\_op\_t\*, 4\> \>::operator basicForEachType const\*() const in parallelempi.o  
> EConstant\<fMPI\<ompi\_communicator\_t\*, 1\>_\>::operator basicForEachType const_() const in parallelempi.o  
> EConstant::operator basicForEachType const\*() const in parallelempi.o  
> basicForEachType\* atype() in parallelempi.o  
> basicForEachType\* atype\<void\*\>() in parallelempi.o  
> basicForEachType\* atype\<fMPI\<ompi\_communicator\_t\*, 1\>\*\>() in parallelempi.o  
> …

Does anybody have a clue on what is going wrong?  
Thank you in advance,

Luca

P.S. Please ask me if the full output of configure or make can be useful, I cannot attach it as new user.

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [March 25, 2020, 12:57pm UTC](https://community.freefem.org/t/compiling-parallel-version-on-macos-10-13/310/2 "2020-03-25T12:57:16Z")

</div>

There is probably some mix up between `libc++` and `libstdc++`. What is your underlying C++ compiler? `mpic++ -show` will return `clang++` I’m guessing.

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [March 25, 2020, 7:43pm UTC](https://community.freefem.org/t/compiling-parallel-version-on-macos-10-13/310/3 "2020-03-25T19:43:10Z")

</div>

Sorry, I missed the obvious missing `CXX=g++-9` flag. That should fix things.

---

<div class="post-metadata">

**Author:** ![lcirrottola](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/lcirrottola/32/106_2.png) [@lcirrottola](https://community.freefem.org/u/lcirrottola)\
**Post date:** [March 26, 2020, 8:59pm UTC](https://community.freefem.org/t/compiling-parallel-version-on-macos-10-13/310/4 "2020-03-26T20:59:22Z")

</div>

Solved with this, thanks.  
Plus, I had to cleanly set `CXX=g++` (with `g++` aliasing `g++-9` or its path `/usr/local/bin/g++-9`) without hyphens or slashes to prevent `configure` from putting the compiler itself in `ff_MPI_INCLUDE` when parsing the output of `mpic++ -show`, thus messing up the compilation later on.
