My previous procedure for installing the lammps python wrapper was to make a shared library, and then python-install. However, the make help message does not mention “mode=shlib”, just “mode=shared”. When I try that, it makes a library called liblammps_onyx_mpi.so, but then it fails to actually create the executable:
CC -g -O3 main.o -L. -llammps_onyx_mpi -o …/lmp_onyx_mpi
/usr/bin/ld: cannot find -llammps_onyx_mpi
collect2: error: ld returned 1 exit status
Makefile:89: recipe for target ‘…/lmp_onyx_mpi’ failed
make[1]: *** […/lmp_onyx_mpi] Error 1
make[1]: Leaving directory ‘/p/home/noamb/src/work/LAMMPS/lammps/src/Obj_shared_onyx_mpi’
Makefile:195: recipe for target ‘onyx_mpi’ failed
make: *** [onyx_mpi] Error 2
noamb@onyx06:~/src/work/LAMMPS/lammps/src> make -j 16 mode=shlib onyx_mpi
It also complains about the lack of liblammps.so when I try to do the python installation:
noamb@onyx06:~/src/work/LAMMPS/lammps/src> make install-python
ERROR: LAMMPS shared library …/src/liblammps.so does not exist
I’m using github commit 5d75ae98a
My MAKE/Makefile.machine is essentially identical to Makefile.mpi, except for the actual compiler executables and flags.
It’s easy enough to rename the .so file, but is this known to be broken?
My previous procedure for installing the lammps python wrapper was to make a shared library, and then python-install. However, the make help message does not mention “mode=shlib”, just “mode=shared”. When I try that, it makes a library called liblammps_onyx_mpi.so, but then it fails to actually create the executable:
CC -g -O3 main.o -L. -llammps_onyx_mpi -o …/lmp_onyx_mpi
/usr/bin/ld: cannot find -llammps_onyx_mpi
collect2: error: ld returned 1 exit status
Makefile:89: recipe for target ‘…/lmp_onyx_mpi’ failed
make[1]: *** […/lmp_onyx_mpi] Error 1
make[1]: Leaving directory ‘/p/home/noamb/src/work/LAMMPS/lammps/src/Obj_shared_onyx_mpi’
Makefile:195: recipe for target ‘onyx_mpi’ failed
make: *** [onyx_mpi] Error 2
noamb@onyx06:~/src/work/LAMMPS/lammps/src> make -j 16 mode=shlib onyx_mpi
It also complains about the lack of liblammps.so when I try to do the python installation:
noamb@onyx06:~/src/work/LAMMPS/lammps/src> make install-python
ERROR: LAMMPS shared library …/src/liblammps.so does not exist
I’m using github commit 5d75ae98a
My MAKE/Makefile.machine is essentially identical to Makefile.mpi, except for the actual compiler executables and flags.
is this essentially identical to an older version of Makefile.mpi or the current version. there has been some adjustments in the traditional make process that reduced the number of settings and made the procedure more aligned between using CMake and GNU make. My first guess would be that you may need to update your custom makefile to reflect those changes.
It’s easy enough to rename the .so file, but is this known to be broken?
compilation, including building and using the python module is part of our continuous integration testing for both, the CMake based and the GNU make based, build procedures on multiple Linux platforms including cross compilation to windows. we recently also added a check for CMake build on MacOS. So if anything of that got broken, it would be noticed.
axel.
I’ll double check, but I believe that it is based on the new makefile, because until I updated it, it wouldn’t compile at all.
OK, just wanted to confirm before I put in more effort tracking it down. That is weird, then, so let me track it down in more detail, and follow up if I have further questions.
Noam
I’ll double check, but I believe that it is based on the new makefile, because until I updated it, it wouldn’t compile at all.
I confirmed that indeed my MAKE/Makefile.machine is exactly the latest Makefile.mpi except for compiler executable name for CC and LINK, and adding “-std=c++11” for CC (but not LINK).
OK, just wanted to confirm before I put in more effort tracking it down. That is weird, then, so let me track it down in more detail, and follow up if I have further questions.
OK - the issue appears to be that this version of CC (gcc 7.3.0 on a Cray XC40) requires “-shared” at link time to find the lammps .so library, for some reason:
cd Obj_shared_onyx_mpi/
CC -g -O3 main.o -L. -llammps_onyx_mpi -o …/lmp_onyx_mpi
/usr/bin/ld: cannot find -llammps_onyx_mpi
collect2: error: ld returned 1 exit status
CC -g -O3 main.o -shared -L. -llammps_onyx_mpi -o …/lmp_onyx_mpi
ls -l liblammps_onyx_mpi.so
lrwxrwxrwx 1 noamb nrl6390v 24 Feb 8 08:08 liblammps_onyx_mpi.so → …/liblammps_onyx_mpi.so*
I guess I can add it to CCFLAGS in my Makefile.machine, but is there a way of adding “-shared” iff mode=shared? Can I manually test the value of the “mode” variable, or is there a “LINKFLAGS_SHARED” sort of thing that’s used iff mode=shared?
Or should I just switch to cmake? Is that more encouraged now, or likely to be more encouraged in the future?
Noam