Hi all,
I cannot build the example/COUPLE/simple according to the README instructions.
$ mpicc -I/home/bz186/lammps/src -c simple.c
$ mpicc -L/home/bz186/lammps/build simple.o -llammps -o simpleC
/usr/bin/ld: /home/bz186/lammps/build/liblammps.a(variable.cpp.o): undefined reference to symbol ‘floor@@GLIBC_2.2.5’
//usr/lib64/libm.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
It seems the first line works, but linking the object file fails.
I found there was a post in 2016 about this. I tried the script provided, but the error still occurs.
I also tried to switch openmpi/2.1.1 to mvapich2/2.2, but still not working.
How can I fix this ?
Thanks,
Bo
the error message from the linker is quite clear, you need to add -lm to also link with libm.so
since you built a static and not a shared library, you need to link with all libraries and flags that are also required for linking the LAMMPS executable.
more explanations are given here: https://lammps.sandia.gov/doc/Build_link.html
axel.
Hi Axel,
I think I found the solution. The command in the example/COUPLE/simple/README is not consistent with the documentation website.
When linking the object, we have to use mpicxx since lammps is a c++ code.
Bo
The README file describes an example with having LAMMPS compiled as a shared library. For that specific case, using a C compiler is sufficient.
The manual discusses both cases.
Axel.