cb-geo/mpm

Fails to compile with the latest Eigen version on Stampede2

kks32 opened this issue · 2 comments

kks32 commented

Describe the bug
Eigen v3.4.0 causes multiple definition errors and fails to compile the MPM code.

To Reproduce
Steps to reproduce the behavior on Stampede2:

  1. Compile with the following commands:
cd $WORK
module load boost hdf5 qt5 vtk
export LD_LIBRARY_PATH=$SWR_LD_LIBRARY_PATH:$LD_LIBRARY_PATH
git clone https://gitlab.com/libeigen/eigen.git
cd $WORK && git clone https://github.com/KaHIP/KaHIP && \
   cd KaHIP && sh ./compile_withcmake.sh
cd $WORK && git clone https://github.com/cb-geo/mpm.git
git clone https://github.com/cb-geo/mpm-benchmarks.git benchmarks
export CC=icc
export CXX=icpc
cd mpm && mkdir build && cd build && cmake -DBOOST_ROOT=$TACC_BOOST_DIR -DBOOST_INCLUDE_DIRS=$TACC_BOOST_INC -DCMAKE_BUILD_TYPE=Release -DEIGEN3_INCLUDE_DIR=$WORK/eigen -DKAHIP_ROOT=$WORK/KaHIP ..
make -j8
  1. Produces this compilation error:
CMakeFiles/mpm.dir/src/hdf5_particle.cc.o: In function `Eigen::internal::lapacke_helpers::to_lapack(long)':
hdf5_particle.cc:(.text+0x0): multiple definition of `Eigen::internal::lapacke_helpers::to_lapack(long)'
CMakeFiles/mpm.dir/src/main.cc.o:main.cc:(.text+0xef0): first defined here
CMakeFiles/mpm.dir/src/io/io.cc.o: In function `Eigen::internal::lapacke_helpers::to_lapack(long)':
io.cc:(.text+0x6910): multiple definition of `Eigen::internal::lapacke_helpers::to_lapack(long)'
CMakeFiles/mpm.dir/src/main.cc.o:main.cc:(.text+0xef0): first defined here
CMakeFiles/mpm.dir/src/mpm.cc.o: In function `Eigen::internal::lapacke_helpers::to_lapack(long)':
mpm.cc:(.text+0xa80): multiple definition of `Eigen::internal::lapacke_helpers::to_lapack(long)'
CMakeFiles/mpm.dir/src/main.cc.o:main.cc:(.text+0xef0): first defined here

Hi, I would like to take this issue, but may I first make sure if this problem still exists?
According to this Stack Overflow question, this multiple definition problem is most likely because of the missing inline notation. In the meantime, I notice in this commit, which happened just two days ago, Eigen has added their inline notation EIGEN_ALWAYS_INLINE to to_lapack. I assume this has already been a fix to this problem.
I also tested on a Frontera node, the compilation went on fine.

kks32 commented

@EtoDemerzel0427 Thanks. Yes, it's an inline issue on Eigen. I'll will check the fix you show and confirm