cmake 7.3. compilation problems (os-x, macports gcc4.7, trilinos, omp.h)

515 views
Skip to first unread message

Denis Davydov

unread,
Mar 11, 2013, 7:20:48 PM3/11/13
to dea...@googlegroups.com
Dear all,

i'm trying to compile the recent version on mac with gcc4.7 (macports) and openmpi, OpenBlas, Lapack (all self compiled). 

my previous configuration was something like:
./configure \
 CC
=mpicc \
 CXX
=mpicxx \
 FC
=mpif90 \
 F77
=mpif77 \
 LDFLAGS
="-L/opt/openmpi/lib -L/opt/LAPACK-static/lib" \
 LIBS
="-lmpi -lmpi_cxx -lmpi_f77 -lmpi_f90" \
 
--enable-mpi \
 
--enable-threads \
 
--disable-shared \
 
--with-umfpack \
 
--with-blas=blas \
 
--with-lapack=lapack \
 
--with-trilinos=/opt/Trilinos \
 
--with-trilinos-include=/opt/Trilinos-static/include \
 
--with-trilinos-libs=/opt/Trilinos-static/lib



whereas with the cmake the closest i could think of is:

cmake -DDEAL_II_WITH_LAPACK=ON \
     
-DDEAL_II_WITH_TRILINOS=ON \
     
-DTRILINOS_DIR=/opt/Trilinos-static/ \
     
-DDEAL_II_WITH_MPI=ON \
     
-DDEAL_II_WITH_METIS=OFF \
     
-DDEAL_II_WITH_ZLIB=OFF \
     
-DLAPACK_FOUND=true \
             
-DLAPACK_LIBRARIES="-llapack" \
             
-DBUILD_SHARED_LIBS=OFF\
             
-DDEAL_II_WITH_THREADS=OFF \
             
-DLAPACK_LINKER_FLAGS="-L/opt/LAPACK-static/lib" \
     
-DDEAL_II_COMPONENT_DOCUMENTATION=ON \
     
-DCMAKE_INSTALL_PREFIX=/opt/deal.ii ../deal.II


I have a minor and a major issue, first, cmake find Clang 4.2.0 as a compiler, whereas i would really like to force it to use mpi wrappers (mpic, mpicxx). 
Not quite sure how to do it, I went through ReadMe couple of times but did not notice anything related to this. 

The more important issue is the compilation error:
/opt/Trilinos-static/lib/cmake/Trilinos/../../../include/Epetra_MpiComm.h:56:10: fatal error: 'omp.h' file not found



This one is a part of OpenMP library as far as i understand, however, i never said Trilinos to use OpenMP:
rm -f CMakeCache.txt && \
 cmake
\
 
-D CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE \
 
-D Trilinos_VERBOSE_CONFIGURE:BOOL=FALSE \
 
-D CMAKE_COLOR_MAKEFILE:BOOL=TRUE \
 
-D CMAKE_BUILD_TYPE:STRING=RELEASE \
 
-D CMAKE_INSTALL_PREFIX:PATH=/opt/Trilinos-static \
 
\
 
-D Trilinos_ENABLE_TESTS:BOOL=ON \
 
-D BUILD_SHARED_LIBS:BOOL=OFF \
 
-D TPL_FIND_SHARED_LIBS:BOOL=OFF \
 
-D Trilinos_LINK_SEARCH_START_STATIC:BOOL=ON \
 
-D Trilinos_ENABLE_OpenMP:BOOL=ON \
 
\
 
-D TPL_ENABLE_MPI:BOOL=ON \
 
-D MPI_BASE_DIR:PATH=/opt/openmpi/ \
 
-D CMAKE_CXX_COMPILER:FILEPATH=mpicxx \
 
-D CMAKE_C_COMPILER:FILEPATH=mpicc \
 
-D CMAKE_Fortran_COMPILER:FILEPATH=mpif90 \
 
-D Trilinos_EXTRA_LINK_FLAGS:STRING="-lgfortran" \
 
\
 
-D CMAKE_CXX_FLAGS:STRING="-g -O3 -funroll-loops -funroll-all-loops" \
 
-D CMAKE_C_FLAGS:STRING="-g -O3 -funroll-loops -funroll-all-loops" \
 
-D CMAKE_FORTRAN_FLAGS:STRING="-g -O5 -funroll-loops -funroll-all-loops -ffast-math" \
 
\
 
-D BLAS_LIBRARY_NAMES:STRING=blas \
 
-D BLAS_LIBRARY_DIRS:STRING=/opt/LAPACK-static/lib \
 
\
 
-D LAPACK_LIBRARY_NAMES:STRING=lapack \
 
-D LAPACK_LIBRARY_DIRS:STRING=/opt/LAPACK-static/lib \
 
\
 
-D Trilinos_ENABLE_ALL_PACKAGES:BOOL=FALSE \
 
-D Trilinos_ENABLE_ALL_OPTIONAL_PACKAGES:BOOL=FALSE \
 
-D Trilinos_ENABLE_Epetra:BOOL=ON \
 
-D Trilinos_ENABLE_EpetraExt:BOOL=ON \
 
-D Trilinos_ENABLE_Tpetra:BOOL=ON \
 
-D Trilinos_ENABLE_Jpetra:BOOL=ON \
 
-D Trilinos_ENABLE_Kokkos:BOOL=ON \
 
-D Trilinos_ENABLE_Sacado:BOOL=ON \
 
-D Trilinos_ENABLE_Stratimikos:BOOL=ON \
 
-D Trilinos_ENABLE_Amesos:BOOL=ON \
 
-D Trilinos_ENABLE_AztecOO:BOOL=ON \
 
-D Trilinos_ENABLE_Ifpack:BOOL=ON \
 
-D Trilinos_ENABLE_Teuchos:BOOL=ON \
 
-D Trilinos_ENABLE_ML:BOOL=ON \
 
-D Trilinos_ENABLE_Thyra:BOOL=ON \
 
-D Trilinos_ENABLE_TrilinosCouplings:BOOL=ON \
 
\
 
`pwd`/.. \
 
2>&1 | tee configure_trilinos_MPI.log


Interesting part is that i can build the previous version of Deal.ii with the configure script above without a problem. 
That brings me to the conclusion that i must have messed up something in cmake of Deal.ii rather than Trilinos. 

p/s/ i do not use OpenMP and don't have it compiled at the moment. 

Thank you in advance for your help,
Best regards,
Denis.
 

Matthias Maier

unread,
Mar 11, 2013, 8:18:03 PM3/11/13
to dea...@googlegroups.com

Am 12. Mär 2013, 00:20 schrieb Denis Davydov <davy...@gmail.com>:

> Dear all,
>
>
> I have a minor and a major issue, first, cmake find Clang 4.2.0 as a compiler,
> whereas i would really like to force it to use mpi wrappers (mpic, mpicxx).
> Not quite sure how to do it, I went through ReadMe couple of times but did not
> notice anything related to this.

Set the wrappers as the compiler to be used, either by environment

CC=mpicc CXX=mpicxx cmake <...>

or via cached variable:

cmake -DCMAKE_C_COMPILER="mpicc" -DCMAKE_CXX_COMPILER="mpicxx" <...>

Beware of the fact that you have to do this on a fresh build directory.

(I'll add this to the documentation.)

>
> The more important issue is the compilation error:
> /opt/Trilinos-static/lib/cmake/Trilinos/../../../include/Epetra_MpiComm.h:56:10
> : fatal error: 'omp.h' file not found
>

$TRILINOS/include/Epetra_config.h is responsible for defining EPETRA_HAVE_OMP.

Do you, by chance, accidentally pickup another Epetra_config.h (from a
different Trilinos installation) from another include directory?

You can find a list of the full includes in
$CMAKE_BUILD_DIR/source/base/CMakeFiles/obj_base.debug.dir/flags.make

Best,
Matthias

Denis Davydov

unread,
Mar 12, 2013, 5:15:58 AM3/12/13
to dea...@googlegroups.com
Hi Matthias,

Thanks for your answer. 
Interesting enough, as soon as I provide mpicxx and mpicc, i have problems compiling boost (provided with deal.ii):
[  3%] Building CXX object bundled/boost-1.49.0/libs/serialization/src/CMakeFiles/obj_boost_serialization.debug.dir/basic_text_oprimitive.cpp.o
[  3%] /var/folders/5k/sqpp24tx3ylds4fgm13pfht00000gn/T//ccwKjDR5.s:78:no such instruction: `vmovss %xmm0, -12(%rbp)'
/var/folders/5k/sqpp24tx3ylds4fgm13pfht00000gn/T//ccwKjDR5.s:79:no such instruction: `vmovss %xmm1, -16(%rbp)'
/var/folders/5k/sqpp24tx3ylds4fgm13pfht00000gn/T//ccwKjDR5.s:107:no such instruction: `vmovsd %xmm0, -16(%rbp)'
.....  (many more similar error lines)
could it be related to " -march=native"  which i have in CMAKE_CXX_FLAGS right now?
a college of mine found out that this flag cause a fail when trying to build deal.ii (without cmake, previous version) 
on os-x with gcc4.7 from macports. 

p/s/ i noticed that i have a wrong flag in Trilinos installation, i actually explicitly added OpenMP, 
therefore it fails when i try to compile deal.ii with clang. 

Denis Davydov

unread,
Mar 12, 2013, 8:45:33 AM3/12/13
to dea...@googlegroups.com
p/s/ i though cmake and build logs could help in finding out the source of the problem. So they are attached.
CMakeCache.txt
build_trilinos_atlas.log.txt
cmake_trilinos_atlas.log.txt
summary.log.txt

Matthias Maier

unread,
Mar 12, 2013, 9:01:34 AM3/12/13
to dea...@googlegroups.com
This is a known issue with >=gcc-4.6 from macports shipping with an
ancient assembler that doesn't know the AVX instruction set [1]

You can disable AVX support by setting

-DDEAL_II_HAVE_AVX=NO

If this doesn't help, try to disable platform introspection completely:

-DDEAL_II_ALLOW_PLATFORM_INTROSPECTION=NO

(and if it is not a fresh directory, nuke the cashed results: -U"DEAL_II_HAVE_*" )

[1] http://mac-os-forge.2317878.n4.nabble.com/gcc-as-AVX-binutils-and-MacOS-X-10-7-td144472.html

Denis Davydov

unread,
Mar 12, 2013, 10:41:40 AM3/12/13
to dea...@googlegroups.com
thanks a lot, Matthias. That solved the problem.

p/s/ for a record, here are my cmake's for static Trilinos and deal.ii (gcc4.7 and atlas from macports, self-compiled openmpi):

cmake -DDEAL_II_WITH_LAPACK=ON \
     
-DDEAL_II_WITH_TRILINOS=ON \
     
-DTRILINOS_DIR=/opt/Trilinos-static-atlas/ \
     
-DDEAL_II_WITH_METIS=OFF \
     
-DDEAL_II_WITH_ZLIB=OFF \
         
-DBUILD_SHARED_LIBS=OFF\
         
-DCMAKE_C_COMPILER="mpicc" \
         
-DDEAL_II_HAVE_AVX=NO \
         
-DDEAL_II_ALLOW_PLATFORM_INTROSPECTION=NO \
         
-DCMAKE_OSX_ARCHITECTURES=x86_64 \
         
-DCMAKE_CXX_COMPILER="mpicxx" \
         
-DCMAKE_PREFIX_PATH="/opt/openmpi/;/opt/local" \
     
-DDEAL_II_COMPONENT_DOCUMENTATION=ON \
     
-DCMAKE_INSTALL_PREFIX=/opt/deal.ii ../deal.II \
     
2>&1 | tee cmake_trilinos_atlas.log.txt


rm -f CMakeCache.txt && \
 cmake
\
 
-D CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE \
 
-D Trilinos_VERBOSE_CONFIGURE:BOOL=FALSE \
 
-D CMAKE_COLOR_MAKEFILE:BOOL=TRUE \
 
-D CMAKE_BUILD_TYPE:STRING=RELEASE \

 
-D CMAKE_INSTALL_PREFIX:PATH=/opt/Trilinos-static-atlas \

 
\
 
-D Trilinos_ENABLE_TESTS:BOOL=ON \
 
-D BUILD_SHARED_LIBS:BOOL=OFF \
 
-D TPL_FIND_SHARED_LIBS:BOOL=OFF \
 
-D Trilinos_LINK_SEARCH_START_STATIC:BOOL=ON \
 
-D Trilinos_ENABLE_OpenMP:BOOL=ON \
 
\
 
-D TPL_ENABLE_MPI:BOOL=ON \
 
-D MPI_BASE_DIR:PATH=/opt/openmpi/ \
 
-D CMAKE_CXX_COMPILER:FILEPATH=mpicxx \
 
-D CMAKE_C_COMPILER:FILEPATH=mpicc \
 
-D CMAKE_Fortran_COMPILER:FILEPATH=mpif90 \
 
-D Trilinos_EXTRA_LINK_FLAGS:STRING="-lgfortran" \
 
\
 
-D CMAKE_CXX_FLAGS:STRING="-g -O3 -funroll-loops -funroll-all-loops" \
 
-D CMAKE_C_FLAGS:STRING="-g -O3 -funroll-loops -funroll-all-loops" \
 
-D CMAKE_FORTRAN_FLAGS:STRING="-g -O5 -funroll-loops -funroll-all-loops -ffast-math" \
 
\

 
-D BLAS_LIBRARY_NAMES:STRING="cblas;f77blas;atlas" \
 
-D BLAS_LIBRARY_DIRS:PATH=/opt/local/lib \
 
\
 
-D LAPACK_LIBRARY_NAMES:STRING=lapack \
 
-D LAPACK_LIBRARY_DIRS:STRING=/opt/local/lib \

 
\
 
-D Trilinos_ENABLE_ALL_PACKAGES:BOOL=FALSE \
 
-D Trilinos_ENABLE_ALL_OPTIONAL_PACKAGES:BOOL=FALSE \
 
-D Trilinos_ENABLE_Epetra:BOOL=ON \
 
-D Trilinos_ENABLE_EpetraExt:BOOL=ON \
 
-D Trilinos_ENABLE_Tpetra:BOOL=ON \
 
-D Trilinos_ENABLE_Jpetra:BOOL=ON \
 
-D Trilinos_ENABLE_Kokkos:BOOL=ON \
 
-D Trilinos_ENABLE_Sacado:BOOL=ON \
 
-D Trilinos_ENABLE_Stratimikos:BOOL=ON \
 
-D Trilinos_ENABLE_Amesos:BOOL=ON \
 
-D Trilinos_ENABLE_AztecOO:BOOL=ON \
 
-D Trilinos_ENABLE_Ifpack:BOOL=ON \
 
-D Trilinos_ENABLE_Teuchos:BOOL=ON \
 
-D Trilinos_ENABLE_ML:BOOL=ON \
 
-D Trilinos_ENABLE_Thyra:BOOL=ON \
 
-D Trilinos_ENABLE_TrilinosCouplings:BOOL=ON \
 
\
 
`pwd`/.. \
 
2>&1 | tee configure_trilinos_MPI.log

Denis Davydov

unread,
Mar 13, 2013, 11:16:24 AM3/13/13
to dea...@googlegroups.com
Hi Matthias,

apparently, if i try to compile deal.ii dynamically i run into problems:

Linking CXX shared library libdeal_II.dylib
duplicate symbol
FunctionParserBase<double>::FunctionWrapper::~FunctionWrapper() in:
   
../bundled/functionparser/CMakeFiles/obj_functionparser.release.dir/fparser.cc.o
   
../bundled/functionparser/CMakeFiles/obj_functionparser.release.dir/fpoptimizer.cc.o

Any idea on what's wrong?
I'm absolutely puzzled and it does not tell me much information on where to look at.

Below are cmakes for deail.ii and trilinos i use (this time with self-compiled Blas and Lapack, but still of gcc4.7 from macports). 

cmake -DDEAL_II_WITH_LAPACK=ON \
     
-DDEAL_II_WITH_TRILINOS=ON \
     
-DTRILINOS_DIR=/opt/Trilinos/ \
     
\
     
-DBLAS_LIBRARIES=/opt/OpenBLAS/lib/libopenblas.dylib \
         
-DLAPACK_LIBRARIES=/opt/LAPACK/lib/liblapack.dylib \
         
\
     
-DDEAL_II_WITH_METIS=OFF \
     
-DDEAL_II_WITH_ZLIB=OFF \
         
-DBUILD_SHARED_LIBS=ON \

         
-DCMAKE_C_COMPILER="mpicc" \
         
-DDEAL_II_HAVE_AVX=NO \
         
-DDEAL_II_ALLOW_PLATFORM_INTROSPECTION=NO \
         
-DCMAKE_OSX_ARCHITECTURES=x86_64 \
         
-DCMAKE_CXX_COMPILER="mpicxx" \

         
-DCMAKE_PREFIX_PATH="/opt/openmpi/;/opt/OpenBLAS;/opt/LAPACK" \

     
-DDEAL_II_COMPONENT_DOCUMENTATION=ON \
     
-DCMAKE_INSTALL_PREFIX=/opt/deal.ii ../deal.II \
     
2>&1 | tee cmake_trilinos_atlas.log.txt
cmake \
 
-D CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE \
 
-D Trilinos_VERBOSE_CONFIGURE:BOOL=FALSE \
 
-D CMAKE_COLOR_MAKEFILE:BOOL=TRUE \
 
-D CMAKE_BUILD_TYPE:STRING=RELEASE \

 
-D CMAKE_INSTALL_PREFIX:PATH=/opt/Trilinos \
 
\
 
-D Trilinos_ENABLE_TESTS:BOOL=ON \
 
-D BUILD_SHARED_LIBS:BOOL=ON \

 
-D Trilinos_ENABLE_OpenMP:BOOL=ON \
 
\
 
-D TPL_ENABLE_MPI:BOOL=ON \
 
-D MPI_BASE_DIR:PATH=/opt/openmpi/ \
 
-D CMAKE_CXX_COMPILER:FILEPATH=mpicxx \
 
-D CMAKE_C_COMPILER:FILEPATH=mpicc \
 
-D CMAKE_Fortran_COMPILER:FILEPATH=mpif90 \

 
-D Trilinos_EXTRA_LINK_FLAGS:STRING="-L/opt/local/lib/gcc47/ -lgfortran" \

 
\
 
-D CMAKE_CXX_FLAGS:STRING="-g -O3 -funroll-loops -funroll-all-loops" \
 
-D CMAKE_C_FLAGS:STRING="-g -O3 -funroll-loops -funroll-all-loops" \
 
-D CMAKE_FORTRAN_FLAGS:STRING="-g -O5 -funroll-loops -funroll-all-loops -ffast-math" \
 
\

 
-D BLAS_LIBRARY_NAMES:STRING=openblas \
 
-D BLAS_LIBRARY_DIRS:STRING=/opt/OpenBLAS/lib \
 
\
 
-D LAPACK_LIBRARY_NAMES:STRING=lapack \
 
-D LAPACK_LIBRARY_DIRS:STRING=/opt/LAPACK/lib \

 
\
 
-D Trilinos_ENABLE_ALL_PACKAGES:BOOL=FALSE \
 
-D Trilinos_ENABLE_ALL_OPTIONAL_PACKAGES:BOOL=FALSE \
 
-D Trilinos_ENABLE_Epetra:BOOL=ON \
 
-D Trilinos_ENABLE_EpetraExt:BOOL=ON \
 
-D Trilinos_ENABLE_Tpetra:BOOL=ON \
 
-D Trilinos_ENABLE_Jpetra:BOOL=ON \
 
-D Trilinos_ENABLE_Kokkos:BOOL=ON \
 
-D Trilinos_ENABLE_Sacado:BOOL=ON \
 
-D Trilinos_ENABLE_Stratimikos:BOOL=ON \
 
-D Trilinos_ENABLE_Amesos:BOOL=ON \
 
-D Trilinos_ENABLE_AztecOO:BOOL=ON \
 
-D Trilinos_ENABLE_Ifpack:BOOL=ON \
 
-D Trilinos_ENABLE_Teuchos:BOOL=ON \
 
-D Trilinos_ENABLE_ML:BOOL=ON \
 
-D Trilinos_ENABLE_Thyra:BOOL=ON \
 
-D Trilinos_ENABLE_TrilinosCouplings:BOOL=ON \
 
\
 
`pwd`/.. \
 
2>&1 | tee configure_trilinos_MPI.log


Kind regards,
Denis.

On Tuesday, March 12, 2013 2:01:34 PM UTC+1, Matthias Maier wrote:

Matthias Maier

unread,
Mar 13, 2013, 11:51:45 AM3/13/13
to dea...@googlegroups.com, dealii-d...@googlegroups.com

Am 13. Mär 2013, 16:16 schrieb Denis Davydov <davy...@gmail.com>:

> Hi Matthias,
>
> apparently, if i try to compile deal.ii dynamically i run into
> problems:
>
> Linking CXX shared library libdeal_II.dylib
> duplicate symbol FunctionParserBase<double>::FunctionWrapper::~
> FunctionWrapper() in:
> ../bundled/functionparser/CMakeFiles/obj_functionparser.release.
> dir/fparser.cc.o
> ../bundled/functionparser/CMakeFiles/obj_functionparser.release.
> dir/fpoptimizer.cc.o
>
> Any idea on what's wrong?
> I'm absolutely puzzled and it does not tell me much information on
> where to look at.


I have bumped bundled fparser to v4.5.1 [1] which should resolve the
duplicate symbol problem in around 15 minutes.

@dealii-developers: I have some issues with the bundled functionparser
[2]. Does somebody wants to step up and tackle this problem? :-]

Best,
Matthias


[1] http://warp.povusers.org/FunctionParser/fparser.html

[2] https://code.google.com/p/dealii/issues/detail?id=5&thanks=5&ts=1363189485

Denis Davydov

unread,
Mar 13, 2013, 1:28:27 PM3/13/13
to dea...@googlegroups.com, dealii-d...@googlegroups.com
Thanks, compiles perfectly now! 
Reply all
Reply to author
Forward
0 new messages