Dear all,

To generate JPEG through the LAMMPS, I followed the remedies provided in the steps of 4 and 7 of manual and modified my Makefile.mpi (which worked previusly) as follow:

JPG_INC = /usr/include/
JPG_PATH = /usr/lib64/
JPG_LIB = libjpeg.so

~ make clean/ or make clean-all


~ make mpi

But the compilation failed
tom.o -latc -lreax -lpoems -lvoro++ -lmeam libjpeg.so -llinalg -lgfortran -lgfortran -lz -o …/lmp_mpi
g++: error: libjpeg.so: No such file or directory
Makefile:89: recipe for target ‘…/lmp_mpi’ failed
make[1]: *** […/lmp_mpi] Error 1
make[1]: Leaving directory ‘/home/salman/Downloads/sw/lammps/lammps-11Aug17/src/Obj_mpi’
Makefile:158: recipe for target ‘mpi’ failed
make: *** [mpi] Error 2

It seems that it can not find the libjpeg.so file, whereas I am sure about the PATHes and name in JPG_INC/JPG_PATH and JPG_LIB. I can see myself the libjpeg.so jpeglib.h files in the provided pathes above!

Second question:

If I wan to include the :-DLAMMPS_PNG" as well, the PATH and name for PNG library should come in front of those three line of JPG_INC/PATHLIB? Is something like below is correct?

JPG_INC = /usr/include/ /usr/include/libpng16
JPG_PATH = /usr/lib64/ /usr/lib64/
JPG_LIB = libjpeg.so libpng16.so

Third question:

There are additionally libpng15.so, libpng12.so or even libpng.so, am I free to choose whichever I want?

Thank you very much.



I think the JPG_LIB entry should be the name of the library and not its filename. The linker line should read -ljpeg and not libjpeg.so. I suggest you change JPG_LIB to the following:

JPG_LIB = -ljpeg

or just

JPG_LIB = jpeg

if the first did not work. Similarly, for PNG use -lpng or just png.

Hope that helps,

Khalid Abdelaziz

Your makefile modifications are wrong in multiple ways. Too many to explain them all here. Please see src/MAKE/OPTIONS/Makefile.jpeg for an example as to how to correctly specify include, library paths.

Support for libpng can be added likewise. Your OS should automatically provide a default PNG support version without including the version number. If not, use the latest and fall back to an older version, if that is not compatible. However, I have not seen any problem with just using - lpng instead of - lpng16 or other on a large variety of systems.

Please refer to the compiler documentation or tutorials on how compilers/linkers work to learn more about how to correctly specify include file and library file search paths as well as how to correctly specify the name of a library you want to link to from such a path.