Re: Issue: TORCS won't link libpng on Ubuntu 13.10

"Toms Lēšmanis" <[email protected]> Wed, 04 Dec 2013 05:45:40 +0200
Newsgroups gmane.games.torcs.general
Message-ID <[email protected]>
Hi,

Thanks for the reply!
I have just started using Ubuntu and I'm not familiar with linux at all , so please excuse me if my questions are a bit silly.. :)

When I search for libpng* in /usr directory, I get the following:
./include/libpng12
./include/libpng
./lib/x86_64-linux-gnu/pkgconfig/libpng12.pc
./lib/x86_64-linux-gnu/pkgconfig/libpng.pc
./lib/x86_64-linux-gnu/libpng.so
./lib/x86_64-linux-gnu/libpng12.so.0
./lib/x86_64-linux-gnu/libpng.a
./lib/x86_64-linux-gnu/libpng12.a
./lib/x86_64-linux-gnu/libpng12.so
./bin/libpng-config
./bin/libpng12-config

So I have libpng.so and libpng12.so both in /usr/lib/x86_64-linux-gnu/

When I do "nm -D ./lib/x86_64-linux-gnu/libpng12.so | grep create_info_struct", I get:
0000000000003e80 T png_create_info_struct
So it's defined there.

I configured the build flags to see the linker output and this is what I get:
GNU C++ (Ubuntu/Linaro 4.8.1-10ubuntu9) version 4.8.1 (x86_64-linux-gnu)
compiled by GNU C version 4.8.1, GMP version 5.1.2, MPFR version 3.1.1-p2, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/4.8"
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/home/tom/FYP/TORCS_source/torcs-1.3.5/export/include
/home/tom/FYP/TORCS_source/torcs-1.3.5
/usr/include/c++/4.8
/usr/include/x86_64-linux-gnu/c++/4.8
/usr/include/c++/4.8/backward
/usr/lib/gcc/x86_64-linux-gnu/4.8/include
/usr/local/include
/usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
GNU C++ (Ubuntu/Linaro 4.8.1-10ubuntu9) version 4.8.1 (x86_64-linux-gnu)
compiled by GNU C version 4.8.1, GMP version 5.1.2, MPFR version 3.1.1-p2, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: d4f6b5538c661bdd4dde0c4673c032a4
COLLECT_GCC_OPTIONS='-I' '/home/tom/FYP/TORCS_source/torcs-1.3.5/export/include' '-I' '/home/tom/FYP/TORCS_source/torcs-1.3.5' '-g' '-D' 'DEBUG' '-D' 'DEBUG_OUT' '-D' 'USE_RANDR_EXT' '-D' 'GL_GLEXT_PROTOTYPES' '-Wall' '-fPIC' '-fno-strict-aliasing' '-g' '-D' 'DEBUG' '-D' 'DEBUG_OUT' '-D' 'USE_RANDR_EXT' '-D' 'GL_GLEXT_PROTOTYPES' '-v' '-D' '_SVID_SOURCE' '-D' '_BSD_SOURCE' '-D' 'SHM' '-D' 'HAVE_CONFIG_H' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
as -v -I /home/tom/FYP/TORCS_source/torcs-1.3.5/export/include -I /home/tom/FYP/TORCS_source/torcs-1.3.5 --64 -o linuxspec.o /tmp/cczI8XEq.s
GNU assembler version 2.23.52 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.23.52.20130913
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-I' '/home/tom/FYP/TORCS_source/torcs-1.3.5/export/include' '-I' '/home/tom/FYP/TORCS_source/torcs-1.3.5' '-g' '-D' 'DEBUG' '-D' 'DEBUG_OUT' '-D' 'USE_RANDR_EXT' '-D' 'GL_GLEXT_PROTOTYPES' '-Wall' '-fPIC' '-fno-strict-aliasing' '-g' '-D' 'DEBUG' '-D' 'DEBUG_OUT' '-D' 'USE_RANDR_EXT' '-D' 'GL_GLEXT_PROTOTYPES' '-v' '-D' '_SVID_SOURCE' '-D' '_BSD_SOURCE' '-D' 'SHM' '-D' 'HAVE_CONFIG_H' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
g++ main.o linuxspec.o -L/home/tom/FYP/TORCS_source/torcs-1.3.5/export/lib -lopenal -lalut -lvorbisfile -L/usr/lib -lracescreens -lrobottools -lclient -lconfscreens -ltgf -ltgfclient -ltxml -lplibul -lraceengine -lmusicplayer -llearning -lplibjs -lplibssgaux -lplibssg -lplibsm -lplibsl -lplibsg -lplibul -lglut -lGLU -lGL -lpng -lz -ldl -lXrandr -lXrender -lXxf86vm -lXmu -lXi -lXt -lSM -lICE -lXext -lX11 -lm -o torcs-bin
/home/tom/FYP/TORCS_source/torcs-1.3.5/export/lib/libtgfclient.so: undefined reference to `png_get_valid'
/home/tom/FYP/TORCS_source/torcs-1.3.5/export/lib/libtgfclient.so: undefined reference to `png_create_info_struct'
...

So the png library seems to be in the library path..

Does this give you any indication on what's missing on my machine?

Thanks!
Tom

P.S. when I do "ldd png_test" [my sample program], I get the following:
linux-vdso.so.1 => (0x00007fff2bbc0000)
libpng12.so.0 => /lib/x86_64-linux-gnu/libpng12.so.0 (0x00007f651a44f000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f651a087000)
libz.so.1 => /usr/local/lib/libz.so.1 (0x00007f6519e6a000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f6519b66000)
/lib64/ld-linux-x86-64.so.2 (0x00007f651a68e000)

Quoting Bernhard Wymann <[email protected]> :

Hi Tom

Hm, no idea. What you can check if the symbol is available in the png
libs, and what your default library is (usually there are multiple
versions installed, e.g. 1.2 and 1.5):
cd /usr
find . -name "libpn*"
-> list of candidates
check with "nm -D path/libpng.so | grep create_info_struct" ("path" is
meant as placeholder here)

Is the symbol defined there?

You could try to export as well "-Wl,--verbose" in CPPFLAGS, CXXFLAGS
and CFLAGS, and rerun configure/make to see the linker output during the
build.

Please report back when you have more information or a solution.

Kind regards

Bernhard

On 12/02/2013 11:39 PM, Toms Lēšmanis wrote:
> Hi,
>
> I have spent days trying to work out what causes this problem, but I
> haven't been successful. Hence, I am turning to you.
>
> I am trying to build TORCS 1.3.5. on Ubuntu 13.10, but I keep getting
> the errors "undefined reference to png_*":
>
> g++ main.o linuxspec.o
> -L/home/reinis/FYP_Surrey/TORCS_source/torcs-1.3.5/export/lib -lopenal
> -lalut -lvorbisfile -L/usr/lib -L/usr/local/lib -lracescreens
> -lrobottools -lclient -lconfscreens -ltgf -ltgfclient -ltxml -lplibul
> -lraceengine -lmusicplayer -llearning -lplibjs -lplibssgaux -lplibssg
> -lplibsm -lplibsl -lplibsg -lplibul -lglut -lGLU -lGL -lpng -lz -ldl
> -lXrandr -lXrender -lXxf86vm -lXmu -lXi -lXt -lSM -lICE -lXext -lX11 -lm
> -o torcs-bin
> /home/reinis/FYP_Surrey/TORCS_source/torcs-1.3.5/export/lib/libtgfclient.so:
> undefined reference to `png_get_valid'
> /home/reinis/FYP_Surrey/TORCS_source/torcs-1.3.5/export/lib/libtgfclient.so:
> undefined reference to `png_create_info_struct'
> ...
>
> The error suggests the linker can't find the actual library, but the
> configuration (./configure) did not complain and I have written an
> example program that uses these functions, which builds fine with the
> command "gcc png_test.o -o png_test -lpng"
>
> Has anyone experienced a similar issue and can provide a solution to it?
> Help will be much appreciated.
>
> Thanks,
> Tom
>
>
> ------------------------------------------------------------------------------
> Rapidly troubleshoot problems before they affect your business. Most IT
> organizations don't have a clear picture of how application performance
> affects their revenue. With AppDynamics, you get 100% visibility into your
> Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
> http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
>
>
>
> _______________________________________________
> Torcs-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/torcs-users
>

------------------------------------------------------------------------------
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk

_______________________________________________
Torcs-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/torcs-users