解决Bug in Fl_JPEG_Image: compile fltk-1.3.3 on gcc-4.6.4

On gcc-4.8, the compilation of fltk-1.3.3-source.tar.gz goes smoothly. But downgrade gcc to 4.6.4, while re-compiling the same code, the following erro came up.


sudo tar -xvf fltk-1.3.3-source.tar.gz

cd fltk-1.3.3/

mkdir bin

cd bin

sudo ccmake ../

sudo make


The following erro shows up:

[ 53%] Building CXX object src/CMakeFiles/fltk_images.dir/Fl_GIF_Image.cxx.o

[ 54%] Building CXX object src/CMakeFiles/fltk_images.dir/Fl_Help_Dialog.cxx.o

[ 54%] Building CXX object src/CMakeFiles/fltk_images.dir/Fl_JPEG_Image.cxx.o

/usr/local/src/fltk-1.3.3/src/Fl_JPEG_Image.cxx: In constructor ‘Fl_JPEG_Image::Fl_JPEG_Image(const char*)’:

/usr/local/src/fltk-1.3.3/src/Fl_JPEG_Image.cxx:158:29: error: invalid conversion from ‘int’ to ‘boolean’ [-fpermissive]

/usr/local/include/jpeglib.h:1039:13: error:   initializing argument 2 of ‘int jpeg_read_header(j_decompress_ptr, boolean)’ [-fpermissive]

/usr/local/src/fltk-1.3.3/src/Fl_JPEG_Image.cxx: In constructor ‘Fl_JPEG_Image::Fl_JPEG_Image(const char*, const unsigned char*)’:

/usr/local/src/fltk-1.3.3/src/Fl_JPEG_Image.cxx:340:29: error: invalid conversion from ‘int’ to ‘boolean’ [-fpermissive]

/usr/local/include/jpeglib.h:1039:13: error:   initializing argument 2 of ‘int jpeg_read_header(j_decompress_ptr, boolean)’ [-fpermissive]

make[2]: *** [src/CMakeFiles/fltk_images.dir/Fl_JPEG_Image.cxx.o] Error 1

make[1]: *** [src/CMakeFiles/fltk_images.dir/all] Error 2

make: *** [all] Error 2


To fix:

sudo gedit /usr/local/src/fltk-1.3.3/src/Fl_JPEG_Image.cxx


Replace this function declaration (in both 158 and 340 line) as:

jpeg_read_header(&dinfo, 1);            //the original


with

jpeg_read_header(&dinfo, TRUE);     //the changed



sudo make


sudo make install


Finished!!

This bug is detailed and solved in:

http://www.fltk.org/str.php?L2920

http://blog.gmane.org/gmane.comp.lib.fltk.bugs/month=20130101


你可能感兴趣的:(linux,error,bug,fltk)