Channelflow 2.0

Error adding symbols: DSO missing from command line

Hi, I need help with installation. I get the following error during the “make” stage. I have tried to link the libm library with -DCMAKE_C_FLAGS but can’t make it go past the following stage.

[ 35%] Built target chflow
Scanning dependencies of target simulateflow_app
[ 36%] Building CXX object programs/CMakeFiles/simulateflow_app.dir/simulateflow.cpp.o
[ 36%] Linking CXX executable simulateflow
/usr/bin/ld: CMakeFiles/simulateflow_app.dir/simulateflow.cpp.o: undefined reference to symbol ‘sqrt@@GLIBC_2.2.5
/lib64/libm.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [programs/simulateflow] Error 1
make[1]: *** [programs/CMakeFiles/simulateflow_app.dir/all] Error 2
make: *** [all] Error 2

I am detailing the process below just for ease of discussion.

a) I am using openmpi4.1.2 and Cmake 3.14

b) Installed FFTW3 with --enable-shared --disable-static --enable-mpi --enable-threads --enable-openmp --with-pic

c) Built HDF5 with --enable-shared --enable-cxx --with-zlib (passes make check test)

d) Installed netCDF as follows: (passes make check install test)
CC=/home/ritabrata.thakur/opt/openmpi4.1.2/bin/mpicc CFLAGS="-std=gnu99" CPPFLAGS="-I/home/ritabrata.thakur/opt/phdf5/include" LDFLAGS="-L/home/ritabrata.thakur/opt/phdf5/lib" ./configure --enable-shared --prefix=/home/ritabrata.thakur/opt/PnetCDF

e) And trying to install channel flow with:

/home/ritabrata.thakur/opt/cmake/3.14/bin/cmake /home/ritabrata.thakur/channelflow -DCMAKE_BUILD_TYPE=release -DCMAKE_INSTALL_PREFIX=/home/ritabrata.thakur/opt/channelflow -DCMAKE_PREFIX_PATH="/usr/bin;/lib64;/home/ritabrata.thakur/opt/fftw3;/home/ritabrata.thakur/opt/hdf5_cxx;/home/ritabrata.thakur/opt/PnetCDF;/home/ritabrata.thakur/opt/phdf5;/home/ritabrata.thakur/opt/openmpi4.1.2" -DUSE_MPI=ON -DWITH_HDF5CXX=ON -DEIGEN3_INCLUDE_DIR=/home/ritabrata.thakur/eigen -DCMAKE_CXX_COMPILER=/home/ritabrata.thakur/opt/openmpi4.1.2/bin/mpicc -DMPI_CXX_COMPILER=/home/ritabrata.thakur/opt/openmpi4.1.2/bin/mpicc

I have also tried adding -DCMAKE_C_FLAGS="-lm -ldl" to the CMake options but I get the same error.

The following is the configuration summary
###############################################
########### Configuration summary ###########
###############################################
Compiler: GNU 4.8.5
Build type: release
Install prefix: /home/ritabrata.thakur/opt/channelflow
Building shared library: yes
Linking programs to: shared library

Libraries
MPI: enabled
netcdf (default file format): enabled
Parallel netcdf: disabled
HDF5 C++ (legacy file format): enabled

Channelflow components
nsolver: enabled
Python wrapper: disabled
GTest unit testing: enabled

– Configuring done
– Generating done
– Build files have been written to: /home/ritabrata.thakur/channelflow/build

Hi there, here are some thoughts - I don’t know if they are useful since I’m not a cmake expert.

  • Is it possible that -DCMAKE_C_FLAGS does not actually get passed to the c++ compiler? In my build script I use -DCMAKE_CXX_FLAGS_RELEASE:STRING=" [ etc ] ". Maybe that works better.

  • I don’t typically need to explicitly link to the math library. Do newer versions of g++ have it built in perhaps? You could try updating gcc to something like version 6.x.x or greater and see if that helps.

  • If you update (or have updated) your configuration remember to delete the cmake cache before rebuilding.

The first thing to address is your compiler version. You’re using relatively modern versions of OpenMPI and CMake, but your GCC is ~12 years old. Is there any particular reason for using such an old version? If not, you should switch to the most recent version that is feasible before doing anything else.

The CMake build process automatically links these libraries for you. mpicc is just a wrapper around your regular compiler that makes compiling/linking MPI programs more straightforward. A lot has changed in GCC in 12 years, so it’s likely that mpicc is trying to compile/link things in a way that’s inconsistent with your installed GCC.

On a related note, is there a reason you’re compiling everything in your home directory, instead of using a package manager and/or installing these packages into the standard locations in /usr/local? Doing things this way tends to introduce a lot of needless complexity.

1 Like