[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

-pthread weirdness



porting another SDL game and having an issue w/-pthread. port here:

http://63.111.27.83/ports/files/moonlander-port.tar.gz

I rewrote the Makefile from scratch and it uses bsd.prog.mk now.

If I build moonlander from the ports framework, it doesn't run:

/usr/libexec/ld.so: Undefined symbol "_pthread_mutexattr_init" called
from moonlander:/usr/local/lib/libSDL.so.1.0 at 0x4006ad40

Okay, so check ldd:

/usr/local/bin/moonlander:
        -lSDL.1 => /usr/local/lib/libSDL.so.1.0 (0x40026000)
        -lm.1 => /usr/lib/libm.so.1.0 (0x40072000)
        -lX11.7 => /usr/X11R6/lib/libX11.so.7.0 (0x40086000)
        -lXext.7 => /usr/X11R6/lib/libXext.so.7.0 (0x40160000)
        -lusbhid.1 => /usr/lib/libusbhid.so.1.0 (0x4016d000)
        -lSDL_image.1 => /usr/local/lib/libSDL_image.so.1.2 (0x40170000)
        -lSDL_mixer.2 => /usr/local/lib/libSDL_mixer.so.2.3 (0x40187000)
        -lc.29 => /usr/lib/libc.so.29.0 (0x401bc000)
        -ljpeg.62 => /usr/local/lib/libjpeg.so.62.0 (0x4027a000)
        -lpng.3 => /usr/local/lib/libpng.so.3.1 (0x40298000)
        -lz.2 => /usr/lib/libz.so.2.0 (0x402b8000)
        -lsmpeg.1 => /usr/local/lib/libsmpeg.so.1.3 (0x402c5000)

Ok, it's not linked to libpthread.  Let's see why not:

cc  `sdl-config --libs` -lSDL_image -lSDL_mixer  -o moonlander -nostdlib
-L/usr/lib /usr/lib/crt0.o  moon_lander.o game_lib.o DT_drawtext.o
-lgcc -lc -lgcc

Result of `sdl-config --libs`:

-L/usr/local/lib -L/usr/X11R6/lib -lSDL -pthread -lm -L/usr/X11R6/lib
-lX11 -lXext -lusbhid

Okay, so it *should* be linking with libpthread, especially since it's
linking with all the other junk.

Now, if I go into ${WRKSRC} and build it without the ports framework,
the binary works.

So, let's see what was different:

cc  `sdl-config --libs` -lSDL_image -lSDL_mixer  -o moonlander
moon_lander.o game_lib.o DT_drawtext.o

And let's ldd it just to make sure:

./moonlander:
        -lSDL.1 => /usr/local/lib/libSDL.so.1.0 (0x40026000)
        -lm.1 => /usr/lib/libm.so.1.0 (0x40072000)
        -lX11.7 => /usr/X11R6/lib/libX11.so.7.0 (0x40086000)
        -lXext.7 => /usr/X11R6/lib/libXext.so.7.0 (0x40160000)
        -lusbhid.1 => /usr/lib/libusbhid.so.1.0 (0x4016d000)
        -lSDL_image.1 => /usr/local/lib/libSDL_image.so.1.2 (0x40170000)
        -lSDL_mixer.2 => /usr/local/lib/libSDL_mixer.so.2.3 (0x40187000)
        -lpthread.1 => /usr/lib/libpthread.so.1.0 (0x401bc000)
        -lc.29 => /usr/lib/libc.so.29.0 (0x401d3000)
        -ljpeg.62 => /usr/local/lib/libjpeg.so.62.0 (0x40291000)
        -lpng.3 => /usr/local/lib/libpng.so.3.1 (0x402af000)
        -lz.2 => /usr/lib/libz.so.2.0 (0x402cf000)
        -lsmpeg.1 => /usr/local/lib/libsmpeg.so.1.3 (0x402dc000)

Can anyone clue me into why this is happening?

- jolan



Visit your host, monkey.org