Linking troubles on Linux with X

Hi,

I’m having a lot of trouble getting a sample SDL program to link. I’m
first creating the object file and then falling into troubles at the
2nd step. Here are my comands:

sh4-linux-g++ -c lesson02.cpp
-I/usr/local/sh4-linux-dev/tools-0010/sh4-linux/include/SDL
-D_REENTRANT -I/usr/local/sh4-linux-dev/tools-0010/sh4-linux/usr/X11R6/include

This works fine…

sh4-linux-g++ -o lesson02 lesson02.o
-L/usr/local/sh4-linux-dev/tools-0010/sh4-linux/lib
-Wl,-rpath,/usr/local/sh4-linux-dev/tools-0010/sh4-linux/lib -lSDL
-lpthread -lX11
-L/usr/local/sh4-linux-dev/tools-0010/sh4-linux/usr/X11R6/lib

But this is where it fails with the output:

/UNIONFS/usr/local/sh4-linux-dev/tools-0010/bin/…/lib/gcc/sh4-linux/3.4.4/…/…/…/…/sh4-linux/bin/ld:
warning: libXext…6, needed by
/usr/local/sh4-linux-dev/tools-0010/sh4-linux/lib/libSDL.so, not found
(try using -rpath or -rpath-link)
/usr/local/sh4-linux-dev/tools-0010/sh4-linux/lib/libSDL.so: undefined
reference to XShmDetach' /usr/local/sh4-linux-dev/tools-0010/sh4-linux/lib/libSDL.so: undefined reference toXextAddDisplay’
/usr/local/sh4-linux-dev/tools-0010/sh4-linux/lib/libSDL.so: undefined
reference to XextFindDisplay' /usr/local/sh4-linux-dev/tools-0010/sh4-linux/lib/libSDL.so: undefined reference toXShmCreateImage’
/usr/local/sh4-linux-dev/tools-0010/sh4-linux/lib/libSDL.so: undefined
reference to XShmPutImage' /usr/local/sh4-linux-dev/tools-0010/sh4-linux/lib/libSDL.so: undefined reference toXShmAttach’
/usr/local/sh4-linux-dev/tools-0010/sh4-linux/lib/libSDL.so: undefined
reference to XextCreateExtension' /usr/local/sh4-linux-dev/tools-0010/sh4-linux/lib/libSDL.so: undefined reference toXShmQueryExtension’
/usr/local/sh4-linux-dev/tools-0010/sh4-linux/lib/libSDL.so: undefined
reference to XextRemoveDisplay' /usr/local/sh4-linux-dev/tools-0010/sh4-linux/lib/libSDL.so: undefined reference toXMissingExtension’

I don’t understand why the library cannot be found, even though I’ve
included it with the -L in my linker statement…

I’m not too knowledgealble about this, so any help would really be great!!

Thank you,
chris

/UNIONFS/usr/local/sh4-linux-dev/tools-0010/bin/…/lib/gcc/sh4-linux/3.4.4/…/…/…/…/sh4-linux/bin/ld:
warning: libXext…6, needed by
/usr/local/sh4-linux-dev/tools-0010/sh4-linux/lib/libSDL.so, not found

Looks like SDL botched the discovery of your X11 libraries (it’s looking
for “libXext…6” instead of “libXext.so.6”), which is a problem in
building SDL and not a problem in building your program.

If you built your own SDL, you might get lucky and using
–enable-x11-shared in the configure script may work around the bug
(telling SDL to dlopen() the X11 libraries at runtime instead of link
against them directly). If you don’t need X11, you can build with
–disable-video-x11, which will definitely fix the problem.

If you didn’t build your own SDL, please tell whomever did that they
broke it. :slight_smile:

If you get totally desperate, make a symbolic link from libXext.so.6 to
libXext…6, which will probably make things work, but it’s sort of a
nasty solution.

–ryan.