compilation error with jpegsrc.v9a

I am compiling LAMMPS with the last version of libjpeg on Ubuntu
14.04.1 following this protocol:

sudo apt-get install git g++ openmpi-bin libopenmpi-dev
wget http://www.ijg.org/files/jpegsrc.v9a.tar.gz
tar zxvf jpegsrc.v9a.tar.gz
cd jpeg-9a
./configure --prefix=\{HOME\}/prefix\-jpeg\-9a make install cd \.\. git clone https://github.com/lammps/lammps lammps\-main cd lammps\-main make linux CC=mpic\+\+ LINK=mpic\+\+ CCFLAGS="\-O2 \-g \-I{HOME}/prefix-jpeg-9a/include" FFT_LIB=-lm LINKFLAGS="-O
-L${HOME}/prefix-jpeg-9a/lib" MPI_LIB=

Compilation fails with this error message:

../group.cpp: In member function ‘void LAMMPS_NS::Group::read_restart(FILE*)’:
../group.cpp:705:47: 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(&ngroup,sizeof(int),1,fp);
                                               ^
../group.cpp:717:44: 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(&n,sizeof(int),1,fp);
                                            ^
../group.cpp:721:53: 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(names[i],sizeof(char),n,fp);
                                                     ^
mpicc -O2 -g -I/home/vagrant/prefix-jpeg-9a/include -DLAMMPS_GZIP
-DLAMMPS_JPEG -DMPICH_SKIP_MPICXX -DFFT_FFTW -c ../image.cpp
../image.cpp: In member function ‘void LAMMPS_NS::Image::write_JPG(FILE*)’:
../image.cpp:1010:34: error: cannot convert ‘bool’ to ‘boolean’ for
argument ‘3’ to ‘void jpeg_set_quality(j_compress_ptr, int, boolean)’
   jpeg_set_quality(&cinfo,85,true);
                                  ^
../image.cpp:1011:34: error: cannot convert ‘bool’ to ‘boolean’ for
argument ‘2’ to ‘void jpeg_start_compress(j_compress_ptr, boolean)’
   jpeg_start_compress(&cinfo,true);
                                  ^
make[1]: *** [image.o] Error 1
make[1]: Leaving directory `/home/vagrant/lammps-main/src/Obj_linux'
make: *** [linux] Error 2

I think the last version of libjpeg is more strict with conversion
between boolean types. For me the patch in the attachmens fixes the
compilation error.

System information:
g++ (Ubuntu 4.8.2-19ubuntu1) 4.8.2
ompi_info | head -n 3
       Package: Open MPI [email protected] Distribution
                Open MPI: 1.6.5
   Open MPI SVN revision: r28673
LAMMPS: 4420cd014dbdc1

0001-Change-true-to-TRUE.patch (748 Bytes)

I am compiling LAMMPS with the last version of libjpeg on Ubuntu
14.04.1 following this protocol:

sudo apt-get install git g++ openmpi-bin libopenmpi-dev
wget http://www.ijg.org/files/jpegsrc.v9a.tar.gz
tar zxvf jpegsrc.v9a.tar.gz
cd jpeg-9a
./configure --prefix=\{HOME\}/prefix\-jpeg\-9a make install cd \.\. git clone https://github.com/lammps/lammps lammps\-main cd lammps\-main make linux CC=mpic\+\+ LINK=mpic\+\+ CCFLAGS="\-O2 \-g \-I{HOME}/prefix-jpeg-9a/include" FFT_LIB=-lm LINKFLAGS="-O
-L${HOME}/prefix-jpeg-9a/lib" MPI_LIB=

Compilation fails with this error message:

[...]

mpicc -O2 -g -I/home/vagrant/prefix-jpeg-9a/include -DLAMMPS_GZIP
-DLAMMPS_JPEG -DMPICH_SKIP_MPICXX -DFFT_FFTW -c ../image.cpp
../image.cpp: In member function ‘void LAMMPS_NS::Image::write_JPG(FILE*)’:
../image.cpp:1010:34: error: cannot convert ‘bool’ to ‘boolean’ for
argument ‘3’ to ‘void jpeg_set_quality(j_compress_ptr, int, boolean)’
   jpeg_set_quality(&cinfo,85,true);
                                  ^
../image.cpp:1011:34: error: cannot convert ‘bool’ to ‘boolean’ for
argument ‘2’ to ‘void jpeg_start_compress(j_compress_ptr, boolean)’
   jpeg_start_compress(&cinfo,true);
                                  ^
make[1]: *** [image.o] Error 1
make[1]: Leaving directory `/home/vagrant/lammps-main/src/Obj_linux'
make: *** [linux] Error 2

I think the last version of libjpeg is more strict with conversion
between boolean types. For me the patch in the attachmens fixes the
compilation error.

i think that is more likely due to the compiler.
in any case, the suggested fix is correct and compatible with all
compiler variants that i could test.

i'm including it into LAMMPS-ICMS for now, so it won't get lost.

thanks,
     axel.