SCOREC / core

parallel finite element unstructured meshes
Other
179 stars 63 forks source link

Compilation issues on Ubuntu 22.04 #396

Closed vikaskurapati closed 11 months ago

vikaskurapati commented 11 months ago

Hi,

I am facing an issue with compilation/installation of core on my local machine. I got errors due to warnings earlier and then I removed '-Werrors' from core/cmake/bob.cmake. Now I encounter the following error:

/usr/bin/ld: ../apf/libapf.a(apfGeometry.cc.o): undefined reference to symbol 'acos@@GLIBC_2.2.5' /usr/bin/ld: /lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make[2]: [test/CMakeFiles/verify.dir/build.make:112: test/verify] Error 1 make[1]: [CMakeFiles/Makefile2:1119: test/CMakeFiles/verify.dir/all] Error 2 make: *** [Makefile:146: all] Error 2

It seems to be some issue with linking the math library.

I tried to sort that out with 'target_link_libraries(core INTERFACE ${MATH_LIBRARY})' in CMakeLists.txt. But that just gives a lot of undefined references error.

Could you please help me figure this out?

cwsmith commented 11 months ago

Hmmm. What compiler and version of the compiler are you using?

vikaskurapati commented 11 months ago

gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0.

cwsmith commented 11 months ago

Great. Thanks. I'm pretty sure we have built with GCC > 11 before. What was your cmake configure command?

vikaskurapati commented 11 months ago

I tried a bunch and after a lot of googling and tries, I stand currently at this:

CC=mpicc CXX=mpicc FC=mpif90 cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$HOME -DCMAKE_CFLAGS="-lm" -DCMAKE_EXE_LINKER_FLAGS="-dynamic -lm"

cwsmith commented 11 months ago

OK. Thanks.

You can revert the edit to cmake/bob.cmake and suppress warnings/errors with -DSCOREC_CXX_WARNINGS=off passed to the cmake configure command. Ideally, we can fix those warnings though.

cwsmith commented 11 months ago

I just built with GCC 13.1.1 20230429 using the following commands without any obvious issues. Can you try these?

git clone git@github.com:SCOREC/core.git
cmake -S core -B buildCore -DCMAKE_CXX_COMPILER=mpicxx -DCMAKE_C_COMPILER=mpicc
cmake --build buildCore -j8

A build with optimizations enabled also succeeds without issues:

git clone git@github.com:SCOREC/core.git
cmake -S core -B buildCoreOpt -DCMAKE_CXX_COMPILER=mpicxx -DCMAKE_C_COMPILER=mpicc -DSCOREC_CXX_OPTIMIZE=ON
cmake --build buildCoreOpt -j8
vikaskurapati commented 11 months ago

Hi,

thank you very much! This works. However, when I try to do 'make install' with this, the following error comes up

CMake Error at test/cmake_install.cmake:1684 (file): file INSTALL cannot find "/media/vikaskurapati/external/4th_Semester/core/pumi-meshes/pipe/pipe.dmg": No such file or directory. Call Stack (most recent call first): cmake_install.cmake:92 (include)

cwsmith commented 11 months ago

Great!

Ahh, so it is trying to install input files for testing from the pumi-meshes submodule.

Try the following:

git clone --recursive git@github.com:SCOREC/core.git
cmake -S core -B buildCore -DCMAKE_CXX_COMPILER=mpicxx -DCMAKE_C_COMPILER=mpicc -DCMAKE_INSTALL_PREFIX=$PWD/buildCore/install
cmake --build buildCore -j8 --target install

This adds --recursive to download the submodule, adds -DCMAKE_INSTALL_PREFIX=$PWD/buildCore/install to specify where the installed files should go, and --target install to run the install after building.

vikaskurapati commented 11 months ago

It works now! Thank you very much!