Adding PNG support to LIGGGHTS, image.cpp: undefined reference

Submitted by PurpleCrumpets on Mon, 11/11/2019 - 10:52

Dear all,

I am trying to add image support to LIGGGHTS. Based on the instructions found in the documentation, I believe I should be able to add the following lines to the Makefile.user file:

LMP_INC=-DLAMMPS_PNG
JPG_INC=-I/opt/pkg/filelib/libpng/1.6.34/gnu/7.2.0/64/opt/include/libpng16
JPG_PATH=-lpng
JPG_LIB=-L/opt/pkg/filelib/libpng/1.6.34/gnu/7.2.0/64/opt/lib

However, when trying to compile LIGGGHTS, I recieve the following error:

image.o: In function `LAMMPS_NS::Image::write_PNG(_IO_FILE*)':
image.cpp:(.text+0x4bff): undefined reference to `png_create_write_struct'
image.cpp:(.text+0x4c13): undefined reference to `png_create_info_struct'
image.cpp:(.text+0x4c46): undefined reference to `png_destroy_write_struct'
image.cpp:(.text+0x4c6f): undefined reference to `png_init_io'
image.cpp:(.text+0x4c80): undefined reference to `png_set_compression_level'
image.cpp:(.text+0x4cbe): undefined reference to `png_set_IHDR'
image.cpp:(.text+0x4d96): undefined reference to `png_set_text'
image.cpp:(.text+0x4da9): undefined reference to `png_write_info'
image.cpp:(.text+0x4ec4): undefined reference to `png_write_image'
image.cpp:(.text+0x4ed7): undefined reference to `png_write_end'
image.cpp:(.text+0x4eea): undefined reference to `png_destroy_write_struct'
image.cpp:(.text+0x4f0a): undefined reference to `png_destroy_write_struct'
collect2: error: ld returned 1 exit status
make[1]: *** [../lmp_auto] Error 1

Any assistance or pointers would be greatly appreciated. The odd paths are due to running LIGGGHTS on a cluster.

Many thanks,

Tim