[SOLVED]libpng issue

Questions, problems and discussion about compiling FreeOrion.

Moderators: Oberlus, Oberlus

Post Reply
Message
Author
dwlg122
Space Krill
Posts: 9
Joined: Sun May 23, 2010 7:52 am

[SOLVED]libpng issue

#1 Post by dwlg122 » Wed May 26, 2010 7:17 am

The game crashes at startup with the following message:

Code: Select all

root:~/src/freeorion/FreeOrion$ ./freeorion
libpng warning: Application was compiled with png.h from libpng-1.4.0rc05
libpng warning: Application  is  running with png.c from libpng-1.2.41
libpng error: Incompatible libpng version in application and library
libpng warning: Application was compiled with png.h from libpng-1.4.0rc05
libpng warning: Application  is  running with png.c from libpng-1.2.41
libpng error: Incompatible libpng version in application and library
libpng warning: Application was compiled with png.h from libpng-1.4.0rc05
libpng warning: Application  is  running with png.c from libpng-1.2.41
libpng error: Incompatible libpng version in application and library
libpng warning: Application was compiled with png.h from libpng-1.4.0rc05
libpng warning: Application  is  running with png.c from libpng-1.2.41
libpng error: Incompatible libpng version in application and library
main() caught exception(std::exception): png_get_file_size: fail to call png_create_write_struct()
root:~/src/freeorion/FreeOrion$
strace output:

Code: Select all

stat("/root/src/freeorion/FreeOrion/default/data/art/icons/leftarrownormal.png", {st_mode=S_IFREG|0644, st_size=2986, ...}) = 0
stat("/root/src/freeorion/FreeOrion/default/data/art/icons/leftarrownormal.png", {st_mode=S_IFREG|0644, st_size=2986, ...}) = 0
open("/root/src/freeorion/FreeOrion/default/data/art/icons/leftarrownormal.png", O_RDONLY) = 18
fstat(18, {st_mode=S_IFREG|0644, st_size=2986, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fec8be4e000
read(18, "\211PNG\r\n\32\n\0\0\0\rIHDR\0\0\0 \0\0\0 \10\6\0\0\0szz"..., 4096) = 2986
write(2, "libpng warning: Application was "..., 73libpng warning: Application was compiled with png.h from libpng-1.4.0rc05) = 73
write(2, "\n", 1
)                       = 1
write(2, "libpng warning: Application  is "..., 70libpng warning: Application  is  running with png.c from libpng-1.2.41) = 70
write(2, "\n", 1
)                       = 1
write(2, "libpng error: Incompatible libpn"..., 68libpng error: Incompatible libpng version in application and library) = 68
write(2, "\n", 1
)                       = 1
close(18)                               = 0
munmap(0x7fec8be4e000, 4096)            = 0
I compiled all libs with libpng14 (GG,graphviz,ogre)
and there are no leftover libpng12 files.
So what am I doing wrong?
Last edited by dwlg122 on Thu May 27, 2010 7:26 am, edited 1 time in total.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12381
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: libpng issue

#2 Post by Geoff the Medio » Wed May 26, 2010 9:01 am

The errors say you compiled with 1.4, but are running with 1.2... So presumably that is the case. You may not have any libpng 1.2 headers or source files, but you might have 1.2 of the library itself still installed.

Also try using "ldd -v freeorion" from the binary directory to see what library versions are required by the final binary, and what versions of the library object files are being loaded and where the files are located.

dwlg122
Space Krill
Posts: 9
Joined: Sun May 23, 2010 7:52 am

Re: libpng issue

#3 Post by dwlg122 » Wed May 26, 2010 10:10 am

The error says libpng-1.4.0rc05 conflict with libpng-1.2.41 but GG and freeorion are compiled wit libpng-1.4.1
and they load libpng14.so.14.1.0 (libpng14.so.14 is a link to libpng14.so.14.1.0)

Code: Select all

ldd:
root:~/src/freeorion/FreeOrion$ ldd -v freeorion|grep png
        libpng14.so.14 => /usr/lib/libpng14.so.14 (0x00007f310f72f000)
                libpng14.so.14 (PNG14_0) => /usr/lib/libpng14.so.14
        /usr/lib/libpng14.so.14:

ldconfig:
root:~/src/freeorion/FreeOrion$ ldconfig -p |grep png
        libpng14.so.14 (libc6,x86-64) => /usr/lib/libpng14.so.14
        libpng14.so (libc6,x86-64) => /usr/lib/libpng14.so


ls&find:
root:/usr/lib$ ls -o |grep png
lrwxrwxrwx  1 root        10 Mar  5 05:12 libpng.a -> libpng14.a
lrwxrwxrwx  1 root        11 Dec 27 13:50 libpng.la -> libpng14.la*
lrwxrwxrwx  1 root        11 Mar  5 05:12 libpng.so -> libpng14.so*
-rw-r--r--  1 root    255102 Mar  5 05:12 libpng14.a
-rwxr-xr-x  1 root       933 Dec 27 13:50 libpng14.la*
lrwxrwxrwx  1 root        18 Mar  5 05:12 libpng14.so -> libpng14.so.14.1.0*
lrwxrwxrwx  1 root        18 Mar  5 05:12 libpng14.so.14 -> libpng14.so.14.1.0*
-rwxr-xr-x  1 root    223996 Dec 27 13:50 libpng14.so.14.0.0*
-rwxr-xr-x  1 root    183369 Mar  5 05:12 libpng14.so.14.1.0*
root:/$ find |grep libpng
./usr/bin/libpng-config
./usr/bin/libpng14-config
./usr/lib/libpng14.so.14
./usr/lib/pkgconfig/libpng14.pc
./usr/lib/pkgconfig/libpng.pc
./usr/lib/libpng.so
./usr/lib/libpng14.a
./usr/lib/libpng14.so
./usr/lib/libpng.a
./usr/lib/libpng.la
./usr/lib/libpng14.so.14.0.0
./usr/lib/libpng14.la
./usr/lib/libpng14.so.14.1.0
./usr/include/libpng14
./usr/include/libpng14/png.h
./usr/include/libpng14/pngconf.h

User avatar
kroddn
Static Linker
Posts: 347
Joined: Thu Jun 28, 2007 10:28 am

Re: libpng issue

#4 Post by kroddn » Wed May 26, 2010 10:36 am

What OS are you using? The problem ist, that FO used png1.2 when compiling.

Did you update libpng in the past? Maybe you did not do a clean build after upgrading?

If ldd names png 14.so.14 that does not automatically mean, that it's right. Some part of the code could have been compiled using 1.2 headers and then linked using 1.4, what leads to those errors you see.

Make sure you do not have 1.2 HEADERs left on your system. And then make sure that you do a distclean on GG and FreeOrion!

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12381
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: libpng issue

#5 Post by Geoff the Medio » Wed May 26, 2010 10:40 am

There are more places than just /usr/lib where a shared library could be located.

A bit of googling for the "Application is running with png.c from libpng-1.2.41" error found a Dutch page.

Running that through Google Translate suggests that you might have something in your PATH that causes the library loader to find another version of libpng before the one you're seeing in /usr/lib. That page mentions /usr/local/bin for example.

dwlg122
Space Krill
Posts: 9
Joined: Sun May 23, 2010 7:52 am

Re: libpng issue

#6 Post by dwlg122 » Thu May 27, 2010 7:26 am

1. I searched for all libpng library and header files on the entire disk and removed them.
2. I installed libpng-1.4.1
3. Removed freeorion+source, GG+source, graphviz, ogre.
4. Downloaded the freeorion, GG sources.
5. Compiled freeorion and all libraries, cairo->pango->graphviz etc.
6. Checked them all for libpng14
7. Started freeorion:

Code: Select all

libpng warning: Application was compiled with png.h from libpng-1.4.1
libpng warning: Application  is  running with png.c from libpng-1.2.41
8. checked all ELF files on the whole disk for libpng12 and found wx_gtk2
9. recompiled wx_gtk
10. SUCCSESS!

I don't know why wx_gtk. I think some library uses some library that uses wx_gtk..

For all who have the same problem:
1. Search all gcc,ld include, library path for libpng, png.h and check if pbg.h is the right version(ldd -v /usr/lib/*|grep libpng12 >/tmp/ldd;gedit /tmp/ldd)
2. Recompile all libraries that uses libpng12 with the right version
3. recompile freeorion,GG from a clean source

Now I can finaly play freeorion ;)
Thanks for your help Geoff the Medio, kroddn

Post Reply