Compiling (serial) LAMMPS with (Warning: ignoring return value) Errors

Dear LAMMPS Users

I tried to install LAMMPS serial version (31Mar17) on a ubuntu 16.04.

However, I have the following repeating error messages:

user@…6919…:~/lammps-31Mar17/src$ make serial
make[1]: Entering directory ‘/home/user/lammps-31Mar17/src/Obj_serial’
cc -O -o fastdep.exe …/DEPEND/fastdep.c
make[1]: Leaving directory ‘/home/user/lammps-31Mar17/src/Obj_serial’
make[1]: Entering directory ‘/home/user/lammps-31Mar17/src/Obj_serial’
g++ -g -O3 -DLAMMPS_GZIP -DLAMMPS_MEMALIGN=64 -I…/STUBS -c …/atom_vec_charge.cpp
g++ -g -O3 -DLAMMPS_GZIP -DLAMMPS_MEMALIGN=64 -I…/STUBS -c …/reaxc_control.cpp
…/reaxc_control.cpp: In function ‘char Read_Control_File(char*, control_params*, output_controls*)’:
…/reaxc_control.cpp:117:29: warning: ignoring return value of ‘char* fgets(char*, int, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
fgets( s, MAX_LINE, fp );
^
g++ -g -O3 -DLAMMPS_GZIP -DLAMMPS_MEMALIGN=64 -I…/STUBS -c …/ntopo_angle_partial.cpp
g++ -g -O3 -DLAMMPS_GZIP -DLAMMPS_MEMALIGN=64 -I…/STUBS -c …/compute_chunk_atom.cpp
g++ -g -O3 -DLAMMPS_GZIP -DLAMMPS_MEMALIGN=64 -I…/STUBS -c …/bond_zero.cpp
…/bond_zero.cpp: In member function ‘virtual void LAMMPS_NS::BondZero::read_restart(FILE*)’:
…/bond_zero.cpp:131:53: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
fread(&r0[1],sizeof(double),atom->nbondtypes,fp);
^
g++ -g -O3 -DLAMMPS_GZIP -DLAMMPS_MEMALIGN=64 -I…/STUBS -c …/pair_dpd.cpp
…/pair_dpd.cpp: In member function ‘virtual void LAMMPS_NS::PairDPD::read_restart(FILE*)’:
…/pair_dpd.cpp:319:58: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
if (me == 0) fread(&setflag[i][j],sizeof(int),1,fp);
^
…/pair_dpd.cpp:323:47: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
fread(&a0[i][j],sizeof(double),1,fp);
^
…/pair_dpd.cpp:324:50: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
fread(&gamma[i][j],sizeof(double),1,fp);
^
…/pair_dpd.cpp:325:48: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
fread(&cut[i][j],sizeof(double),1,fp);
^
…/pair_dpd.cpp: In member function ‘virtual void LAMMPS_NS::PairDPD::read_restart_settings(FILE*)’:
…/pair_dpd.cpp:353:44: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
fread(&temperature,sizeof(double),1,fp);
^
…/pair_dpd.cpp:354:43: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
fread(&cut_global,sizeof(double),1,fp);
^
…/pair_dpd.cpp:355:34: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
fread(&seed,sizeof(int),1,fp);
^
…/pair_dpd.cpp:356:38: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
fread(&mix_flag,sizeof(int),1,fp);"

However, I still managed to have lmp_serial “installed” in the end.

Many Thanks for your patience!

Best Wishes
Lunna

Dear LAMMPS Users

I tried to install LAMMPS serial version (31Mar17) on a ubuntu 16.04.

However, I have the following repeating error messages:

​please note, that these are warnings and not errors. and while the ubuntu
developers may think this is dangerous programming, it is quite harmless in
LAMMPS.
if it bothers​ you, you can edit the makefile in src/MAKE/Makefile.serial
and add the flag -Wno-unused-result to the CCFLAGS definition.

axel.