The International Simutrans Forum

 

Author Topic: svn 6851 & libpng 1.6.6 on linux: makeobj fails to create dat files [Fixed]  (Read 2346 times)

0 Members and 1 Guest are viewing this topic.

Offline jspaces

  • *
  • Posts: 15
Having downloaded the latest svn 6851 then using the freshly compiled makeobj fails to create skins.dat or any other pak dat files when the system's libpng version is 1.6.6 on Linux x86_64.

Here is the strace output:

 
Code: [Select]
strace /home/space/factory/simutrans-svn/src/simutrans/build/default/makeobj/makeobj PAK pedestrians.pak pedestrians.dat
execve("/home/space/factory/simutrans-svn/src/simutrans/build/default/makeobj/makeobj", ["/home/space/factory/simutrans-sv"..., "PAK", "pedestrians.pak", "pedestrians.dat"], [/* 36 vars */]) = 0
brk(0)                                  = 0x1d5a000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=169354, ...}) = 0
mmap(NULL, 169354, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f62cab08000
close(3)                                = 0
open("/usr/lib/libpng16.so.16", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20`\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=216216, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f62cab3e000
mmap(NULL, 2311384, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f62ca6e0000
mprotect(0x7f62ca714000, 2093056, PROT_NONE) = 0
mmap(0x7f62ca913000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x33000) = 0x7f62ca913000
close(3)                                = 0
open("/usr/lib/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260\272\5\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=979080, ...}) = 0
mmap(NULL, 3159072, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f62ca3d8000
mprotect(0x7f62ca4be000, 2093056, PROT_NONE) = 0
mmap(0x7f62ca6bd000, 40960, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xe5000) = 0x7f62ca6bd000
mmap(0x7f62ca6c7000, 82976, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f62ca6c7000
close(3)                                = 0
open("/usr/lib/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320*\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=88992, ...}) = 0
mmap(NULL, 2184800, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f62ca1c0000
mprotect(0x7f62ca1d5000, 2097152, PROT_NONE) = 0
mmap(0x7f62ca3d5000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x15000) = 0x7f62ca3d5000
close(3)                                = 0
open("/usr/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\34\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=2027565, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f62cab3d000
mmap(NULL, 3844624, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f62c9e10000
mprotect(0x7f62c9fb2000, 2093056, PROT_NONE) = 0
mmap(0x7f62ca1b1000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1a1000) = 0x7f62ca1b1000
mmap(0x7f62ca1b7000, 14864, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f62ca1b7000
close(3)                                = 0
open("/usr/lib/libz.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0000#\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=88592, ...}) = 0
mmap(NULL, 2183688, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f62c9bf8000
mprotect(0x7f62c9c0d000, 2093056, PROT_NONE) = 0
mmap(0x7f62c9e0c000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x14000) = 0x7f62c9e0c000
close(3)                                = 0
open("/usr/lib/libm.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0PX\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1059264, ...}) = 0
mmap(NULL, 3154264, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f62c98f0000
mprotect(0x7f62c99f2000, 2093056, PROT_NONE) = 0
mmap(0x7f62c9bf1000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x101000) = 0x7f62c9bf1000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f62cab3c000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f62cab3b000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f62cab35000
arch_prctl(ARCH_SET_FS, 0x7f62cab35740) = 0
mprotect(0x7f62ca1b1000, 16384, PROT_READ) = 0
mprotect(0x7f62c9bf1000, 4096, PROT_READ) = 0
mprotect(0x7f62c9e0c000, 4096, PROT_READ) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f62cab3a000
mprotect(0x7f62ca6bd000, 32768, PROT_READ) = 0
mprotect(0x7f62ca913000, 4096, PROT_READ) = 0
mprotect(0x626000, 4096, PROT_READ)     = 0
mprotect(0x7f62cab37000, 4096, PROT_READ) = 0
munmap(0x7f62cab08000, 169354)          = 0
brk(0)                                  = 0x1d5a000
brk(0x1d7b000)                          = 0x1d7b000
write(2, "Makeobj version 55.2 for Simutra"..., 60Makeobj version 55.2 for Simutrans 112.4 Nightly and higher
) = 60
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 4), ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f62cab34000
write(1, "\n", 1
)                       = 1
write(1, "Makeobj version 55.2 for Simutra"..., 60Makeobj version 55.2 for Simutrans 112.4 Nightly and higher
) = 60
write(1, "\n", 1
)                       = 1
write(1, "(c) 2002-2012 V. Meyer, Hj. Malt"..., 82(c) 2002-2012 V. Meyer, Hj. Malthaner, M. Pristovsek & Simutrans development team
) = 82
write(1, "\n", 1
)                       = 1
open("pedestrians.pak", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
write(1, "writing file pedestrians.pak\n", 29writing file pedestrians.pak
) = 29
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f62cab33000
lseek(3, 0, SEEK_CUR)                   = 0
openat(AT_FDCWD, ".", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 4
getdents(4, /* 17 entries */, 32768)    = 640
getdents(4, /* 0 entries */, 32768)     = 0
close(4)                                = 0
open("pedestrians.dat", O_RDONLY)       = 4
write(1, "   reading file pedestrians.dat\n", 32   reading file pedestrians.dat
) = 32
fstat(4, {st_mode=S_IFREG|0600, st_size=2571, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f62cab32000
read(4, "Obj=pedestrian\nName=pedestrian_1"..., 4096) = 2571
write(1, "      packing pedestrian.pedestr"..., 38      packing pedestrian.pedestrian_1
) = 38
write(3, "Simutrans object file\nCompiled w"..., 61) = 61
lseek(3, 89, SEEK_SET)                  = 89
write(3, "pedestrian_1\0", 13)          = 13
lseek(3, 81, SEEK_SET)                  = 81
write(3, "TEXT\0\0\r\0",             = 8
lseek(3, 110, SEEK_SET)                 = 110
write(3, "\0", 1)                       = 1
lseek(3, 102, SEEK_SET)                 = 102
open("pedestrians1.png", O_RDONLY)      = 5
fstat(5, {st_mode=S_IFREG|0600, st_size=7352, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f62cab31000
read(5, "\211PNG\r\n\32\n\0\0\0\rIHDR\0\0\2\0\0\0\1\200\10\2\0\0\0TBM"..., 4096) = 4096
write(2, "libpng error: png_start_read_ima"..., 71libpng error: png_start_read_image/png_read_update_info: duplicate call) = 71
write(2, "\n", 1
)                       = 1
write(1, "read_png: fatal error.\n", 23read_png: fatal error.
) = 23
write(3, "TEXT\0\0\1\0",             = 8
exit_group(1)                           = ?
+++ exited with 1 +++
« Last Edit: October 27, 2013, 02:48:27 PM by jspaces »

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5695
  • Languages: EN, NO
From what I found by googling the error message, it seems like a change in libpng 1.6.0.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4899
  • Languages: EN, DE, AT
It seems that calling png_read_update_info first and then  png_start_read_image is an error. I have yet to see a reasonable documentation for libpng. This library is one candidate for my personal "Library with worst documentation today" award.

Edit: removed the call with r6855
« Last Edit: October 26, 2013, 01:00:55 PM by Dwachs »

Offline jspaces

  • *
  • Posts: 15
It is a shame that such important a library has such poor documentation causing grief where none should exist. Thanks Dwachs for your timely fix!

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5695
  • Languages: EN, NO
It is a shame that such important a library has such poor documentation causing grief where none should exist.

It's for libraries what autotools is for build systems. It seems that those that use autoconf have simply copied the configuration from another project, because no one knows how to set it up from scratch. With libpng, people use intermediate libraries instead, which also support other image formats, but means you now also need the low-level libraries for them as well.