Subject: Bug#579: duplicate of #578

From: Mike Gabriel <[email-masked]>
Date: Fri, 15 May 2015 12:12:18 +0000

Control: close -1
Control: forcemerge #578 -1

Issue #579 is a duplicate of already close issue #578.

Mike
-- 

DAS-NETZWERKTEAM
mike gabriel, herweg 7, 24357 fleckeby
fon: +49 (1520) 1976 148

GnuPG Key ID 0x25771B31
mail: [email-masked], http://das-netzwerkteam.de

freeBusy:
https://mail.das-netzwerkteam.de/freebusy/m.gabriel%40das-netzwerkteam.de.xfb

---

From: [email-masked] (X2Go Bug Tracking System)
Date: Fri, 15 May 2015 12:15:02 +0000

This is an automatic notification regarding your Bug report
which was filed against the nx-libs package:

#579: nx-libs, Jpeg.cpp compilation error with jpeg-9a, with suggested patch

It has been closed by Mike Gabriel <[email-masked]>.

Their explanation is attached below along with your original report.
If this explanation is unsatisfactory and you have not received a
better one in a separate message then please contact Mike Gabriel <[email-masked]> by
replying to this email.

-- 
579: http://bugs.x2go.org/cgi-bin/bugreport.cgi?bug=579
X2Go Bug Tracking System
Contact [email-masked] with problems

Subject: duplicate of #578
From: Mike Gabriel <[email-masked]>
To: [email-masked]
Date: Fri, 15 May 2015 12:12:18 +0000

Control: close -1

Mike
-- 

DAS-NETZWERKTEAM

GnuPG Key ID 0x25771B31

freeBusy:

Subject: nx-libs, Jpeg.cpp compilation error with jpeg-9a, with suggested patch
From: Gabriel Marcano <[email-masked]>
To: "[email-masked]" <[email-masked]>
Date: Tue, 19 Aug 2014 20:25:40 -0700

Package: nx-libs
Version: HEAD
Tags: Patch

Found this problem while browsing:

    https://bugs.gentoo.org/show_bug.cgi?id=481360

Compiling nx-libs against jpeg-9a leads to a compilation error. Specifically:

    g++ -c -O3 -fno-rtti -fno-exceptions -I../nx-X11/exports/include
        -Wmissing-declarations -fPIC -DIN_ADDR_T=in_addr_t -DVERSION=\"3.5.0\"
        -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\"
        -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -Wall
        -Wpointer-arith   Jpeg.cpp
    Jpeg.cpp: In function ‘int DecompressJpeg16(unsigned char*, int,
        unsigned int, unsigned int, unsigned char*, int)’:
    Jpeg.cpp:443:29: error: invalid conversion from ‘int’ to ‘boolean’
        [-fpermissive]
    jpeg_read_header(&cinfo, 1);
                                ^
    In file included from Jpeg.cpp:29:0:
    /usr/include/jpeglib.h:1039:13: note: initializing argument 2 of ‘int
        jpeg_read_header(j_decompress_ptr, boolean)’
    EXTERN(int) jpeg_read_header JPP((j_decompress_ptr cinfo,
                ^
    Jpeg.cpp: In function ‘int DecompressJpeg24(unsigned char*, int,
        unsigned int, unsigned int, unsigned char*, int)’:
    Jpeg.cpp:584:29: error: invalid conversion from ‘int’ to ‘boolean’
        [-fpermissive]
    jpeg_read_header(&cinfo, 1);
                                ^
    In file included from Jpeg.cpp:29:0:
    /usr/include/jpeglib.h:1039:13: note: initializing argument 2 of ‘int
        jpeg_read_header(j_decompress_ptr, boolean)’
    EXTERN(int) jpeg_read_header JPP((j_decompress_ptr cinfo,
                ^
    Jpeg.cpp: In function ‘int DecompressJpeg32(unsigned char*, int, unsigned
        int, unsigned int, unsigned char*, int)’:
    Jpeg.cpp:721:29: error: invalid conversion from ‘int’ to ‘boolean’
        [-fpermissive]
    jpeg_read_header(&cinfo, 1);
                                ^
    In file included from Jpeg.cpp:29:0:
    /usr/include/jpeglib.h:1039:13: note: initializing argument 2 of ‘int
        jpeg_read_header(j_decompress_ptr, boolean)’
    EXTERN(int) jpeg_read_header JPP((j_decompress_ptr cinfo,
                ^
    Jpeg.cpp: In function ‘boolean JpegFillInputBuffer(j_decompress_ptr)’:
    Jpeg.cpp:836:10: error: invalid conversion from ‘int’ to ‘boolean’
        [-fpermissive]
    return 1;
            ^
    Makefile:82: recipe for target 'Jpeg.o' failed
    make: *** [Jpeg.o] Error 1

I am attaching a patch to address the problem. Specifically, it appears that
jpeg-9a changed the definition for its "boolean" type from an int to some other
 type (bool in C++, it seems). Using TRUE and FALSE, as provided by the jpeg
library, is what was done to address the problem. After applying the patch
to HEAD (commit 0e3b414ea6ecb6cc359d3b95f5cfeb6096066139), Jpeg.cpp compiles
fine.

Configuration:

Compiling against jpeg-9a.

$ gcc -v
    Using built-in specs.
    COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/4.9.0/gcc
    COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.9.0/lto-wrapper
    Target: x86_64-pc-linux-gnu
    Configured with: /var/tmp/portage/sys-devel/gcc-4.9.0/work/gcc-4.9.0/configure
    --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr
    --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.9.0
    --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.0/include
    --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.9.0
    --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.9.0/man
    --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.9.0/info
    --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.0/include/g++-v4
    --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.9.0/python
    --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt
    --disable-werror --with-system-zlib --enable-nls --without-included-gettext
    --enable-checking=release --with-bugurl=https://bugs.gentoo.org/
    --with-pkgversion='Gentoo 4.9.0 p1.0, pie-0.6.0' --enable-libstdcxx-time
    --enable-shared --enable-threads=posix --enable-__cxa_atexit
    --enable-clocale=gnu --enable-multilib --with-multilib-list=m32,m64
    --disable-altivec --disable-fixed-point --enable-targets=all
    --disable-libgcj --enable-libgomp --disable-libmudflap --disable-libssp
    --enable-lto --without-cloog
    Thread model: posix
    gcc version 4.9.0 (Gentoo 4.9.0 p1.0, pie-0.6.0)

$ autoreconf --version
    autoreconf (GNU Autoconf) 2.69

Steps to reproduce:

1. "git clone git://code.x2go.org/nx-libs.git" repository.
2. Change to the "nxcomp" directory.
3. Run "autoreconf" and then do "make Jpeg.o".

Expected outcome:
Successful compilation.

Actual outcome:
Compilation failure, see earlier in the report for the error messages.

--- nxcomp/Jpeg.cpp.orig	2014-08-19 22:23:36.139072400 -0400
+++ nxcomp/Jpeg.cpp	2014-08-19 22:25:24.323182800 -0400
@@ -440,7 +440,7 @@
 
   JpegSetSrcManager(&cinfo, compressedData, compressedLen);
 
-  jpeg_read_header(&cinfo, 1);
+  jpeg_read_header(&cinfo, TRUE);
 
   if (jpegError) goto AbortDecompressJpeg16;
 
@@ -581,7 +581,7 @@
 
   JpegSetSrcManager(&cinfo, compressedData, compressedLen);
 
-  jpeg_read_header(&cinfo, 1);
+  jpeg_read_header(&cinfo, TRUE);
 
   if (jpegError) goto AbortDecompressJpeg24;
 
@@ -718,7 +718,7 @@
 
   JpegSetSrcManager(&cinfo, compressedData, compressedLen);
 
-  jpeg_read_header(&cinfo, 1);
+  jpeg_read_header(&cinfo, TRUE);
 
   if (jpegError) goto AbortDecompressJpeg32;
 
@@ -833,7 +833,7 @@
   jpegSrcManager.bytes_in_buffer = jpegBufferLen;
   jpegSrcManager.next_input_byte = (JOCTET *)jpegBufferPtr;
 
-  return 1;
+  return TRUE;
 }
 
 static void JpegSkipInputData(j_decompress_ptr cinfo, long num_bytes)