Problem compiling Mplayer with file pngdec.c

Hello, I was trying to compile Mplayer 1.3 using gcc 4.4, but I am getting LOTS of error messages when make reaches the pngdec.c file. These are the error messages.

 libavcodec/pngdec.c:37:18: warning: zlib.h: No such file or directory
libavcodec/pngdec.c:82: error: expected specifier-qualifier-list before 'z_stream'
libavcodec/pngdec.c: In function 'png_decode_idat':
libavcodec/pngdec.c:395: error: 'PNGDecContext' has no member named 'zstream'
libavcodec/pngdec.c:396: error: 'PNGDecContext' has no member named 'zstream'
libavcodec/pngdec.c:400: error: 'PNGDecContext' has no member named 'zstream'
libavcodec/pngdec.c:401: error: implicit declaration of function 'inflate'
libavcodec/pngdec.c:401: error: 'PNGDecContext' has no member named 'zstream'
libavcodec/pngdec.c:401: error: 'Z_PARTIAL_FLUSH' undeclared (first use in this function)
libavcodec/pngdec.c:401: error: (Each undeclared identifier is reported only once
libavcodec/pngdec.c:401: error: for each function it appears in.)
libavcodec/pngdec.c:402: error: 'Z_OK' undeclared (first use in this function)
libavcodec/pngdec.c:402: error: 'Z_STREAM_END' undeclared (first use in this function)
libavcodec/pngdec.c:406: error: 'PNGDecContext' has no member named 'zstream'
libavcodec/pngdec.c:410: error: 'PNGDecContext' has no member named 'zstream'
libavcodec/pngdec.c:411: error: 'PNGDecContext' has no member named 'zstream'
libavcodec/pngdec.c:413: error: 'PNGDecContext' has no member named 'zstream'
libavcodec/pngdec.c:415: error: 'PNGDecContext' has no member named 'zstream'
libavcodec/pngdec.c: In function 'decode_zbuf':
libavcodec/pngdec.c:425: error: 'z_stream' undeclared (first use in this function)
libavcodec/pngdec.c:425: error: expected ';' before 'zstream'
libavcodec/pngdec.c:426: warning: ISO C90 forbids mixed declarations and code
libavcodec/pngdec.c:430: error: 'zstream' undeclared (first use in this function)
libavcodec/pngdec.c:433: error: implicit declaration of function 'inflateInit'
libavcodec/pngdec.c:433: error: 'Z_OK' undeclared (first use in this function)
libavcodec/pngdec.c:447: error: 'Z_PARTIAL_FLUSH' undeclared (first use in this function)
libavcodec/pngdec.c:448: error: 'Z_STREAM_END' undeclared (first use in this function)
libavcodec/pngdec.c:456: error: implicit declaration of function 'inflateEnd'
libavcodec/pngdec.c: In function 'decode_idat_chunk':
libavcodec/pngdec.c:724: error: 'PNGDecContext' has no member named 'zstream'
libavcodec/pngdec.c:725: error: 'PNGDecContext' has no member named 'zstream'
libavcodec/pngdec.c: In function 'decode_frame_apng':
libavcodec/pngdec.c:1367: error: 'PNGDecContext' has no member named 'zstream'
libavcodec/pngdec.c:1368: error: 'PNGDecContext' has no member named 'zstream'
libavcodec/pngdec.c:1376: error: 'PNGDecContext' has no member named 'zstream'
libavcodec/pngdec.c:1376: error: 'Z_OK' undeclared (first use in this function)
libavcodec/pngdec.c:1400: error: 'PNGDecContext' has no member named 'zstream'
make[1]: *** [libavcodec/pngdec.o] Error 1

The only thing I know is that I have zlib.h in /usr/src/linux-headers-2.6.31-14/include/linux/zlib.h

No idea about what to do, would appreciate any suggestions.

Probably need to install zlib-dev or gzip-dev or whatever your distribution's equivalent is, to get zlib.h and so forth.

I compiled zlib and installed it to /media/34GB/Arquivos-de-Programas-Linux/Zlib-1.2.8
Then I created the directory /usr/include/zlib and putted symbolic links there to /media/34GB/Arquivos-de-Programas-Linux/Zlib-1.2.8/include/zlib.h /media/34GB/Arquivos-de-Programas-Linux/Zlib-1.2.8/include/zconf.h but the same error messages persisted. My doubt now is which file(s) I need to create a symbolic link to system directories and to where. Zlib.h is certainly one of them, but what else?
And to what places?

Does your source reference the zlib headers with:

#include <zlib/zlib.h>
#include <zlib/zconf.h>

or:

#include <zlib.h>
#include <zconf.h>

or is it some other form of #include directives?

Do the headers /media/34GB/Arquivos-de-Programas-Linux/Zlib-1.2.8/include/zlib.h and /media/34GB/Arquivos-de-Programas-Linux/Zlib-1.2.8/include/zconf.h use any #include directives to reference any files that are not system supplied headers? If so, please show us those #include directives (in CODE tags).

What is the complete command line that you are using to build your code (in CODE tags)?

What compiler commands is make issuing to compile your library routines (in CODE tags)?

pngdec.c

has an

#include <zlib.h>

And

zconf.h

was mentioned because is one of two file in /media/34GB/Arquivos-de-Programas-Linux/Zlib-1.2.8/include , and it is required by

zlib.h

As I mentioned above, zlib.h has an

#include "zconf.h"

First I build zlib with:

./configure --prefix=/media/34GB/Arquivos-de-Programas-Linux/Zlib/ --eprefix=/media/34GB/Arquivos-de-Programas-Linux/Zlib/

followed by

make

and

make install

Then mplayer with:

./configure --prefix=/media/34GB/Arquivos-de-Programas-Linux/MPlayer-1.3.0/

followed by

make

Do you want me to copy and paste pieces of the Makefile of Mplayer? I don't know what parts it would be necessary

Your created symlinks to your headers in /usr/include/zlib which would make them visible if your source used #include <zlib/zlib.h> , but that is not what your code uses. (It might have worked if you had created the symlinks in /usr/include instead of /usr/include/zlib or, since your #include lines use double quotes instead of less-than and greater-the symbols surrounding the header names, in the directory where your source files are located.) It would also work if the compiler command your makefile used to compile your code included a -I option that named the directory in which your headers were located and your code used #include "zib.h" .

You haven't shown us the command make uses to compile your library routines, but since your code is saying it can't find the header, we have to assume that your ./configure command is not correctly specifying the directory where the zlib headers are to be found when compiling your code.

I tried to create symbolic links in

/usr/include

instead of

/usr/include/zib 

, and it worked, these error messages were gone. but now I get this a little further in the compilation process:

ffmpeg/libavcodec/libavcodec.a(pngdec.o): In function `decode_text_chunk':
pngdec.c:(.text+0x1382): undefined reference to `inflateInit_'
pngdec.c:(.text+0x140f): undefined reference to `inflate'
pngdec.c:(.text+0x1434): undefined reference to `inflateEnd'
pngdec.c:(.text+0x14af): undefined reference to `inflateEnd'
ffmpeg/libavcodec/libavcodec.a(pngdec.o): In function `decode_frame_common':
pngdec.c:(.text+0x1a79): undefined reference to `inflate'
ffmpeg/libavcodec/libavcodec.a(pngdec.o): In function `decode_frame_apng':
pngdec.c:(.text+0x38a1): undefined reference to `inflateInit_'
pngdec.c:(.text+0x390c): undefined reference to `inflateEnd'
ffmpeg/libavcodec/libavcodec.a(pngenc.o): In function `encode_frame':
pngenc.c:(.text+0xb1f): undefined reference to `deflate'
pngenc.c:(.text+0xcdb): undefined reference to `deflate'
pngenc.c:(.text+0xdff): undefined reference to `deflate'
pngenc.c:(.text+0xe99): undefined reference to `deflateReset'
ffmpeg/libavcodec/libavcodec.a(pngenc.o): In function `encode_apng':
pngenc.c:(.text+0x1027): undefined reference to `deflateBound'
ffmpeg/libavcodec/libavcodec.a(pngenc.o): In function `encode_png':
pngenc.c:(.text+0x20c5): undefined reference to `deflateBound'
ffmpeg/libavcodec/libavcodec.a(pngenc.o): In function `png_enc_close':
pngenc.c:(.text.unlikely+0x12): undefined reference to `deflateEnd'
ffmpeg/libavcodec/libavcodec.a(pngenc.o): In function `png_enc_init':
pngenc.c:(.text.unlikely+0x336): undefined reference to `deflateInit2_'
ffmpeg/libavcodec/libavcodec.a(rscc.o): In function `rscc_decode_frame':
rscc.c:(.text+0x49f): undefined reference to `uncompress'
rscc.c:(.text+0x5d2): undefined reference to `uncompress'
ffmpeg/libavcodec/libavcodec.a(screenpresso.o): In function `screenpresso_decode_frame':
screenpresso.c:(.text+0x92): undefined reference to `uncompress'
ffmpeg/libavcodec/libavcodec.a(tdsc.o): In function `tdsc_decode_frame':
tdsc.c:(.text+0x79): undefined reference to `uncompress'
collect2: ld returned 1 exit status
make: *** [mplayer] Error 1

These are all functions from

zlib.h

. I then opened

rscc.c

saw an

include <zlib.h>

and changed it to

include "/media/34GB/Arquivos-de-Programas-Linux/Zlib/include/zlib.h"

. typed

make

again and the

ffmpeg/libavcodec/libavcodec.a(rscc.o): In function `rscc_decode_frame':
rscc.c:(.text+0x49f): undefined reference to `uncompress'
rscc.c:(.text+0x5d2): undefined reference to `uncompress'

error messages persisted. Also copied cp

/media/34GB/Arquivos-de-Programas-Linux/Zlib/include/zlib.h

to

/media/34GB/Arquivos-de-Programas-Linux/mplayer-1.3.0/ffmpeg/libavcodec

where

rscc.c

and the others are, then changed

include "/media/34GB/Arquivos-de-Programas-Linux/Zlib/include/zlib.h"

to

include "zlib.h"

and again nothing changed.

I found this in the

Makefile

:

# ./configure must be rerun if it changed
config.mak: configure
	@echo "############################################################"
	@echo "####### Please run ./configure again - it's changed! #######"
	@echo "############################################################"

checkhelp: help/help_mp*.h
	help/help_check.sh $(CC) $^

help_mp.h: help/help_mp-en.h $(HELP_FILE)
	help/help_create.sh $(HELP_FILE) $(CHARSET)

# rebuild version.h each time the working copy is updated
version.h: version.sh $(wildcard .svn/entries .git/logs/HEAD)
	./$< `$(CC) -dumpversion`

%$(EXESUF): %.c
	$(CC) $(CC_DEPFLAGS) $(CFLAGS) -o $@ $^ $(LIBS)

%.ho: %.h
	$(CC) $(CFLAGS) -Wno-unused -c -o $@ -x c $<

checkheaders: $(ALLHEADERS:.h=.ho)

and maybe in the last line with

$(CC)

I should put the [-I], but I am unsure about how to procede.
it should became

$(CC) $(CFLAGS) -Wno-unused -c -o -I /media/34GB/Arquivos-de-Programas-Linux/Zlib/include/ $@ -x c $<

? or it should be a little different? Or should in another place in the

Makefile

? Or is this even the next step I should follow? I am lost right now

"undefined reference" does not mean missing include file. When the include errors went away, the files were being included.

What's missing now is the libraries themselves, -lzlib -L/path/to/folder/containing/zlib/so/

1 Like

I tried

./configure  --prefix=/media/34GB/Arquivos-de-Programas-Linux/MPlayer-1.3.0/ -lzlib  -L/media/34GB/Arquivos-de-Programas-Linux/Zlib/lib 

and received:

Unknown parameter: -lzlib

.
If I remove

-lzlib

I receive the same error message with the -L parameter. What can I do?

-l and -L are linker options, belonging in LDFLAGS. Try LDFLAGS="-lzlib -L/path/to/whatever" ./configure ...

1 Like

I tried

and received

However, I was able to compile it creating a symbolic link to libz.a in

, so that problem is solved. Thanks

1 Like

Is your problem completely solved, then? You were able to build a working mplayer?

Yes, altough I am experiencing some problems with it, but that it is another matter.

1 Like