Fail to compile wargus_2.2.6.orig on Gentoo

Bug #1001285 reported by brezerk
This bug report is a duplicate of:  Bug #963210: Compilation with libpng15. Edit Remove
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Wargus
New
Undecided
Unassigned

Bug Description

Hi i trying to compile wargus 2.2.6 on Gentoo and get this error:

[ himera ] brezerk@pts/1:209 ~/build/wargus_2.2.6.orig/build $
make
[ 28%] Built target pudconvert
[ 42%] Built target wargus
[ 57%] Building C object CMakeFiles/wartool.dir/wartool.c.o
/home/brezerk/build/wargus_2.2.6.orig/wartool.c: In function ‘SavePNG’:
/home/brezerk/build/wargus_2.2.6.orig/wartool.c:1852:6: error: dereferencing pointer to incomplete type
/home/brezerk/build/wargus_2.2.6.orig/wartool.c:1861:37: error: ‘Z_BEST_COMPRESSION’ undeclared (first use in this function)
/home/brezerk/build/wargus_2.2.6.orig/wartool.c:1861:37: note: each undeclared identifier is reported only once for each function it appears in
/home/brezerk/build/wargus_2.2.6.orig/wartool.c:1864:10: error: dereferencing pointer to incomplete type
/home/brezerk/build/wargus_2.2.6.orig/wartool.c:1865:10: error: dereferencing pointer to incomplete type
/home/brezerk/build/wargus_2.2.6.orig/wartool.c:1866:10: error: dereferencing pointer to incomplete type
/home/brezerk/build/wargus_2.2.6.orig/wartool.c:1867:10: error: dereferencing pointer to incomplete type
/home/brezerk/build/wargus_2.2.6.orig/wartool.c:1868:10: error: dereferencing pointer to incomplete type
/home/brezerk/build/wargus_2.2.6.orig/wartool.c:1869:10: error: dereferencing pointer to incomplete type
/home/brezerk/build/wargus_2.2.6.orig/wartool.c:1870:10: error: dereferencing pointer to incomplete type
/home/brezerk/build/wargus_2.2.6.orig/wartool.c:1871:10: error: dereferencing pointer to incomplete type
/home/brezerk/build/wargus_2.2.6.orig/wartool.c: In function ‘ConvertWav’:
/home/brezerk/build/wargus_2.2.6.orig/wartool.c:3231:2: error: ‘gzFile’ undeclared (first use in this function)
/home/brezerk/build/wargus_2.2.6.orig/wartool.c:3231:9: error: expected ‘;’ before ‘gf’
/home/brezerk/build/wargus_2.2.6.orig/wartool.c:3238:2: error: ‘gf’ undeclared (first use in this function)
/home/brezerk/build/wargus_2.2.6.orig/wartool.c: In function ‘ConvertXmi’:
/home/brezerk/build/wargus_2.2.6.orig/wartool.c:3270:2: error: ‘gzFile’ undeclared (first use in this function)
/home/brezerk/build/wargus_2.2.6.orig/wartool.c:3270:9: error: expected ‘;’ before ‘gf’
/home/brezerk/build/wargus_2.2.6.orig/wartool.c:3367:2: error: ‘gf’ undeclared (first use in this function)
/home/brezerk/build/wargus_2.2.6.orig/wartool.c: In function ‘ConvertText’:
/home/brezerk/build/wargus_2.2.6.orig/wartool.c:3601:2: error: ‘gzFile’ undeclared (first use in this function)
/home/brezerk/build/wargus_2.2.6.orig/wartool.c:3601:9: error: expected ‘;’ before ‘gf’
/home/brezerk/build/wargus_2.2.6.orig/wartool.c:3620:2: error: ‘gf’ undeclared (first use in this function)
make[2]: *** [CMakeFiles/wartool.dir/wartool.c.o] Error 1
make[1]: *** [CMakeFiles/wartool.dir/all] Error 2
make: *** [all] Error 2

I am using:
sys-devel/gcc 4.5.3-r2
dev-util/cmake 2.8.7-r5
sys-libs/zlib 1.2.6
media-libs/libsdl 1.2.15-r1
media-libs/sdl-gfx 2.0.23
media-libs/sdl-image 1.2.12
media-libs/sdl-mixer 1.2.12-r1
media-libs/sdl-net 1.2.8
[media-libs/sdl-sound 1.0.3
[media-libs/sdl-ttf 2.0.11

Revision history for this message
brezerk (brezerk) wrote :

Ok. It looks like libpng-1.5.x. 'libpng15/png.h' no longer includes 'zlib.h'. So you must do it yourself.

[ himera ] brezerk@pts/1:225 ~/build/wargus_2.2.6.orig/build $
diff -u /home/brezerk/build/wargus_2.2.6.orig/wartool.c.orig /home/brezerk/build/wargus_2.2.6.orig/wartool.c
--- /home/brezerk/build/wargus_2.2.6.orig/wartool.c.orig 2012-05-18 18:06:25.000000000 +0300
+++ /home/brezerk/build/wargus_2.2.6.orig/wartool.c 2012-05-18 18:06:39.000000000 +0300
@@ -53,6 +53,7 @@
 #include <stdint.h>
 #include <ctype.h>
 #include <png.h>
+#include <zlib.h>

 #if defined(_MSC_VER) || defined(WIN32)
 #include <windows.h>

This helps, but i still can't compile:

[ himera ] brezerk@pts/1:223 ~/build/wargus_2.2.6.orig/build $
make
[ 28%] Built target pudconvert
[ 42%] Built target wargus
[ 57%] Building C object CMakeFiles/wartool.dir/wartool.c.o
/home/brezerk/build/wargus_2.2.6.orig/wartool.c: In function ‘SavePNG’:
/home/brezerk/build/wargus_2.2.6.orig/wartool.c:1853:6: error: dereferencing pointer to incomplete type
/home/brezerk/build/wargus_2.2.6.orig/wartool.c:1865:10: error: dereferencing pointer to incomplete type
/home/brezerk/build/wargus_2.2.6.orig/wartool.c:1866:10: error: dereferencing pointer to incomplete type
/home/brezerk/build/wargus_2.2.6.orig/wartool.c:1867:10: error: dereferencing pointer to incomplete type
/home/brezerk/build/wargus_2.2.6.orig/wartool.c:1868:10: error: dereferencing pointer to incomplete type
/home/brezerk/build/wargus_2.2.6.orig/wartool.c:1869:10: error: dereferencing pointer to incomplete type
/home/brezerk/build/wargus_2.2.6.orig/wartool.c:1870:10: error: dereferencing pointer to incomplete type
/home/brezerk/build/wargus_2.2.6.orig/wartool.c:1871:10: error: dereferencing pointer to incomplete type
/home/brezerk/build/wargus_2.2.6.orig/wartool.c:1872:10: error: dereferencing pointer to incomplete type
make[2]: *** [CMakeFiles/wartool.dir/wartool.c.o] Error 1
make[1]: *** [CMakeFiles/wartool.dir/all] Error 2
make: *** [all] Error 2

Revision history for this message
brezerk (brezerk) wrote :

Yeah. It looks like libpng ab[ himera ] brezerk@pts/1:233 ~/build/wargus_2.2.6.orig/build $
diff -u /home/brezerk/build/wargus_2.2.6.orig/wartool.c.orig /home/brezerk/build/wargus_2.2.6.orig/wartool.c
--- /home/brezerk/build/wargus_2.2.6.orig/wartool.c.orig 2012-05-18 18:06:25.000000000 +0300
+++ /home/brezerk/build/wargus_2.2.6.orig/wartool.c 2012-05-18 18:14:45.000000000 +0300
@@ -53,6 +53,7 @@
 #include <stdint.h>
 #include <ctype.h>
 #include <png.h>
+#include <zlib.h>

 #if defined(_MSC_VER) || defined(WIN32)
 #include <windows.h>
@@ -1849,7 +1850,7 @@
                return 1;
        }

- if (setjmp(png_ptr->jmpbuf)) {
+ if (setjmp(png_jmpbuf(png_ptr))) {
                // FIXME: must free buffers!!
                png_destroy_write_struct(&png_ptr, &info_ptr);
                fclose(fp);
@@ -1861,14 +1862,8 @@
        png_set_compression_level(png_ptr, Z_BEST_COMPRESSION);

        // prepare the file information
- info_ptr->width = w;
- info_ptr->height = h;
- info_ptr->bit_depth = 8;
- info_ptr->color_type = PNG_COLOR_TYPE_PALETTE;
- info_ptr->interlace_type = 0;
- info_ptr->valid |= PNG_INFO_PLTE;
- info_ptr->palette = (png_colorp)pal;
- info_ptr->num_palette = 256;
+ png_set_IHDR(png_ptr, info_ptr, w, h, 8, PNG_COLOR_TYPE_PALETTE, 0, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
+ png_set_PLTE(png_ptr, info_ptr, (png_colorp)pal, 256);

        if (transparent) {
                unsigned char* p;i was changed too :(

Revision history for this message
brezerk (brezerk) wrote :

Ok. I was able to build wargus. Here a patch:

Revision history for this message
Pali (pali) wrote :

This bug is already fixed in commit http://bazaar.launchpad.net/~stratagus/wargus/trunk/revision/1643

Before reporting bugs, search for duplicates. In bug #963210 was attached similar (same) patch which was commited.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.