Newbie question - installing libsdl on redhat linux

I’m having trouble getting my first SDL program to compile. I used the devel RPM, and it says that this installed fine. I’m not able to gcc a program though. I’m using sdl-config --cflags --libs as a parameter for gcc.

which sdl-config gives me /usr/bin/sdl-config

sdl-config --version is 1.2.6

locate libSDL gives me this:

/usr/lib/libSDL-1.2.so.0
/usr/lib/libSDL_mixer-1.2.so.0
/usr/lib/libSDL-1.2.so.0.0.5
/usr/lib/libSDL_mixer-1.2.so.0.2.2
/usr/lib/libSDL_net-1.2.so.0
/usr/lib/libSDL_net-1.2.so.0.0.4
/usr/lib/libSDL_image-1.2.so.0
/usr/lib/libSDLmain.a
/usr/lib/libSDL_image-1.2.so.0.1.1
/usr/lib/libSDL_mixer.a
/usr/lib/libSDL_mixer.la
/usr/lib/libSDL_mixer.so
/usr/lib/libSDL_net.a
/usr/lib/libSDL_net.so
/usr/lib/libSDL.a
/usr/lib/libSDL.la

I don’t have a config.log file. (But rpm does say that sdl is installed. I checked by running rpm -qa)

I’m very new to linux, so it may be something very simple I’m missing. Can anyone see what it is? -John---------------------------------
Do you Yahoo!?
Yahoo! Hotjobs: Enter the “Signing Bonus” Sweepstakes

John Jung wrote:

I’m having trouble getting my first SDL program to compile. I used the devel
RPM, and it says that this installed fine. I’m not able to gcc a program
though. I’m using sdl-config --cflags --libs as a parameter for gcc.

I assume you have installed the “wrong” RPM. For compiling programs with
SDL you probably need SDL-devel. I don’t know who ever had the idea to
split software into normal and -devel packages. If I got a cent
everytime I see someone stumbling over this, I’d be a rich man.–
Christian
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20040105/b8cc9080/attachment.pgp

Are you getting any errors? Try running sdl-config on its own with the
flags and check the output. We had a problem with Suse machine not so long
ago where sdl-config was just an empty file with execute permissions.

Mario de SousaOn Mon, 5 Jan 2004 21:20:53 -0800 (PST) John Jung wrote:

I’m having trouble getting my first SDL program to compile. I used the
devel RPM, and it says that this installed fine. I’m not able to gcc a
program though. I’m using sdl-config --cflags --libs as a parameter
for gcc.

which sdl-config gives me /usr/bin/sdl-config

sdl-config --version is 1.2.6

locate libSDL gives me this:

/usr/lib/libSDL-1.2.so.0
/usr/lib/libSDL_mixer-1.2.so.0
/usr/lib/libSDL-1.2.so.0.0.5
/usr/lib/libSDL_mixer-1.2.so.0.2.2
/usr/lib/libSDL_net-1.2.so.0
/usr/lib/libSDL_net-1.2.so.0.0.4
/usr/lib/libSDL_image-1.2.so.0
/usr/lib/libSDLmain.a
/usr/lib/libSDL_image-1.2.so.0.1.1
/usr/lib/libSDL_mixer.a
/usr/lib/libSDL_mixer.la
/usr/lib/libSDL_mixer.so
/usr/lib/libSDL_net.a
/usr/lib/libSDL_net.so
/usr/lib/libSDL.a
/usr/lib/libSDL.la

I don’t have a config.log file. (But rpm does say that sdl is installed.
I checked by running rpm -qa)

I’m very new to linux, so it may be something very simple I’m missing.
Can anyone see what it is? -John


Do you Yahoo!?
Yahoo! Hotjobs: Enter the “Signing Bonus” Sweepstakes

I’m having trouble getting my first SDL program to compile. I used the
devel RPM, and it says that this installed fine. I’m not able to gcc a
program though. I’m using sdl-config --cflags --libs as a parameter
for gcc.

Would you post the exact command you run to compile
your program ( eg: 'gcc sdl-config --cflags x.c -o x
sdl-config --libs ), and the compilers error output. That
would be alot more helpful.

Still having trouble getting my first SDL program to compile- but thanks for your help so far. I am using the sdl-devel rpm. Here is the exact command I’m using to compile:

gcc SDLtest.c sdl-config --cflags --libs

here’s the error message (I edited the length down. It’s a long listing of undefined references, it looks like all are from /usr/lib/libSDL.a…):

/usr/lib/libSDL.a(SDL_x11video.lo)(.text+0x1d): In function X11_Available': : undefined reference toXOpenDisplay’
/usr/lib/libSDL.a(SDL_x11video.lo)(.text+0x2f): In function X11_Available': : undefined reference toXCloseDisplay’
/usr/lib/libSDL.a(SDL_x11video.lo)(.text+0x453): In function create_aux_windows': : undefined reference toXDestroyWindow’
/usr/lib/libSDL.a(SDL_x11video.lo)(.text+0x4ff): In function create_aux_windows': : undefined reference toXCreateWindow’
/usr/lib/libSDL.a(SDL_x11video.lo)(.text+0x528): In function create_aux_windows': : undefined reference toXSelectInput’
/usr/lib/libSDL.a(SDL_x11video.lo)(.text+0x583): In function create_aux_windows': : undefined reference toXInternAtom’
/usr/lib/libSDL.a(SDL_x11video.lo)(.text+0x5da): In function create_aux_windows': : undefined reference toXSendEvent’
/usr/lib/libSDL.a(SDL_x11video.lo)(.text+0x5ff): In function create_aux_windows': : undefined reference toXGetWMHints’
/usr/lib/libSDL.a(SDL_x11video.lo)(.text+0x61b): In function create_aux_windows': : undefined reference toXGetWMName’
/usr/lib/libSDL.a(SDL_x11video.lo)(.text+0x638): In function create_aux_windows': : undefined reference toXGetWMIconName’
/usr/lib/libSDL.a(SDL_x11video.lo)(.text+0x64e): In function create_aux_windows': : undefined reference toXDestroyWindow’
/usr/lib/libSDL.a(SDL_x11video.lo)(.text+0x6a0): In function create_aux_windows': : undefined reference toXCreateWindow’
/usr/lib/libSDL.a(SDL_x11video.lo)(.text+0x6b7): In function `create_aux_windows’:

collect2: ld returned 1 exit status

I ran rpm -qa | grep “SDL” and here’s what I got:

SDL-1.2.5-3
SDL_net-devel-1.2.4-5
SDL_image-devel-1.2.2-5
SDL_image-1.2.2-5
SDL_mixer-1.2.4-7
SDL-devel-1.2.6-1
SDL_net-1.2.4-5
SDL_mixer-devel-1.2.4-7

sdl-config --cflags --libs give me:

-I/usr/include/SDL -D_REENTRANT
-L/usr/lib -Wl,-rpath,/usr/lib -lSDL -lpthread—

I’m having trouble getting my first SDL program to compile. I used the devel RPM, and it says that this installed fine. I’m not able to gcc a program though. I’m using sdl-config --cflags --libs as a parameter for gcc.

which sdl-config gives me /usr/bin/sdl-config

sdl-config --version is 1.2.6

locate libSDL gives me this:

/usr/lib/libSDL-1.2.so.0
/usr/lib/libSDL_mixer-1.2.so.0
/usr/lib/libSDL-1.2.so.0.0.5
/usr/lib/libSDL_mixer-1.2.so.0.2.2
/usr/lib/libSDL_net-1.2.so.0
/usr/lib/libSDL_net-1.2.so.0.0.4
/usr/lib/libSDL_image-1.2.so.0
/usr/lib/libSDLmain.a
/usr/lib/libSDL_image-1.2.so.0.1.1
/usr/lib/libSDL_mixer.a
/usr/lib/libSDL_mixer.la
/usr/lib/libSDL_mixer.so
/usr/lib/libSDL_net.a
/usr/lib/libSDL_net.so
/usr/lib/libSDL.a
/usr/lib/libSDL.la

I don’t have a config.log file. (But rpm does say that sdl is installed. I checked by running rpm -qa)

I’m very new to linux, so it may be something very simple I’m missing. Can anyone see what it is? -John


Do you Yahoo!?
Yahoo! Hotjobs: Enter the “Signing Bonus” Sweepstakes

Are you using Mandrake by any chance?

-MarkOn Tue, 6 Jan 2004, John Jung wrote:

Still having trouble getting my first SDL program to compile- but thanks for your help so far. I am using the sdl-devel rpm. Here is the exact command I’m using to compile:

gcc SDLtest.c sdl-config --cflags --libs

here’s the error message (I edited the length down. It’s a long listing of undefined references, it looks like all are from /usr/lib/libSDL.a…):

/usr/lib/libSDL.a(SDL_x11video.lo)(.text+0x1d): In function X11_Available': : undefined reference toXOpenDisplay’
/usr/lib/libSDL.a(SDL_x11video.lo)(.text+0x2f): In function X11_Available': : undefined reference toXCloseDisplay’
/usr/lib/libSDL.a(SDL_x11video.lo)(.text+0x453): In function create_aux_windows': : undefined reference toXDestroyWindow’
/usr/lib/libSDL.a(SDL_x11video.lo)(.text+0x4ff): In function create_aux_windows': : undefined reference toXCreateWindow’
/usr/lib/libSDL.a(SDL_x11video.lo)(.text+0x528): In function create_aux_windows': : undefined reference toXSelectInput’
/usr/lib/libSDL.a(SDL_x11video.lo)(.text+0x583): In function create_aux_windows': : undefined reference toXInternAtom’
/usr/lib/libSDL.a(SDL_x11video.lo)(.text+0x5da): In function create_aux_windows': : undefined reference toXSendEvent’
/usr/lib/libSDL.a(SDL_x11video.lo)(.text+0x5ff): In function create_aux_windows': : undefined reference toXGetWMHints’
/usr/lib/libSDL.a(SDL_x11video.lo)(.text+0x61b): In function create_aux_windows': : undefined reference toXGetWMName’
/usr/lib/libSDL.a(SDL_x11video.lo)(.text+0x638): In function create_aux_windows': : undefined reference toXGetWMIconName’
/usr/lib/libSDL.a(SDL_x11video.lo)(.text+0x64e): In function create_aux_windows': : undefined reference toXDestroyWindow’
/usr/lib/libSDL.a(SDL_x11video.lo)(.text+0x6a0): In function create_aux_windows': : undefined reference toXCreateWindow’
/usr/lib/libSDL.a(SDL_x11video.lo)(.text+0x6b7): In function `create_aux_windows’:

collect2: ld returned 1 exit status

I ran rpm -qa | grep “SDL” and here’s what I got:

SDL-1.2.5-3
SDL_net-devel-1.2.4-5
SDL_image-devel-1.2.2-5
SDL_image-1.2.2-5
SDL_mixer-1.2.4-7
SDL-devel-1.2.6-1
SDL_net-1.2.4-5
SDL_mixer-devel-1.2.4-7

sdl-config --cflags --libs give me:

-I/usr/include/SDL -D_REENTRANT
-L/usr/lib -Wl,-rpath,/usr/lib -lSDL -lpthread


I’m having trouble getting my first SDL program to compile. I used the devel RPM, and it says that this installed fine. I’m not able to gcc a program though. I’m using sdl-config --cflags --libs as a parameter for gcc.

which sdl-config gives me /usr/bin/sdl-config

sdl-config --version is 1.2.6

locate libSDL gives me this:

/usr/lib/libSDL-1.2.so.0
/usr/lib/libSDL_mixer-1.2.so.0
/usr/lib/libSDL-1.2.so.0.0.5
/usr/lib/libSDL_mixer-1.2.so.0.2.2
/usr/lib/libSDL_net-1.2.so.0
/usr/lib/libSDL_net-1.2.so.0.0.4
/usr/lib/libSDL_image-1.2.so.0
/usr/lib/libSDLmain.a
/usr/lib/libSDL_image-1.2.so.0.1.1
/usr/lib/libSDL_mixer.a
/usr/lib/libSDL_mixer.la
/usr/lib/libSDL_mixer.so
/usr/lib/libSDL_net.a
/usr/lib/libSDL_net.so
/usr/lib/libSDL.a
/usr/lib/libSDL.la

I don’t have a config.log file. (But rpm does say that sdl is installed. I checked by running rpm -qa)

I’m very new to linux, so it may be something very simple I’m missing. Can anyone see what it is? -John


Do you Yahoo!?
Yahoo! Hotjobs: Enter the “Signing Bonus” Sweepstakes


Mark K. Kim
AIM: markus kimius
Homepage: http://www.cbreak.org/
Xanga: http://www.xanga.com/vindaci
Friendster: http://www.friendster.com/user.jsp?id=13046
PGP key fingerprint: 7324 BACA 53AD E504 A76E 5167 6822 94F0 F298 5DCE
PGP key available on the homepage

sorry about the disjointed resposes. It’s a red hat 9 system, not mandrake.---------------------------------
Do you Yahoo!?
Yahoo! Hotjobs: Enter the “Signing Bonus” Sweepstakes

I had a similar problem with Mandrake. I got around it by adding
-lGL, I think:

gcc program.c sdl-config --cflags --libs -lGL

-MarkOn Tue, 6 Jan 2004, John Jung wrote:

sorry about the disjointed resposes. It’s a red hat 9 system, not mandrake.


Do you Yahoo!?
Yahoo! Hotjobs: Enter the “Signing Bonus” Sweepstakes


Mark K. Kim
AIM: markus kimius
Homepage: http://www.cbreak.org/
Xanga: http://www.xanga.com/vindaci
Friendster: http://www.friendster.com/user.jsp?id=13046
PGP key fingerprint: 7324 BACA 53AD E504 A76E 5167 6822 94F0 F298 5DCE
PGP key available on the homepage

this is what I needed to use:
gcc -I/usr/include/SDL -D_REENTRANT -L/usr/lib -Wl, -rpath, /usr/lib
-lSDL -lpthread <inputfile.c> -o

I had trouble using sdl-config in the command line, so I took its output
and wrote it in manually. Then I made a script. However, that was not
necessary, I just wanted to get it compiling!

THEN, I realized why I had trouble:

` is very different from ’

the following is the proper way to compile, I believe:
gcc sdl-config --libs --cflags <inputfile.c> -o

make sure you use the ` (it is the same key as “~”, without being
shift-modified)

hope that helps.

John Jung wrote:

Still having trouble getting my first SDL program to compile- but thanks
for your help so far. I am using the sdl-devel rpm. Here is the exact
command I’m using to compile:

gcc SDLtest.c sdl-config --cflags --libs

It would be better to use

(g)cc sdl-config --cflags SDLtest.c sdl-config --libs

Although, that wouldn’t fix your problem.

here’s the error message (I edited the length down. It’s a long listing
of undefined references, it looks like all are from /usr/lib/libSDL.a…):

/usr/lib/libSDL.a(SDL_x11video.lo)(.text+0x1d): In function X11_Available': : undefined reference toXOpenDisplay’
[…]

Your SDL libraries seem to be badly compile. Do

nm -A /usr/lib/*.{so,a} 2>/dev/null|grep XOpenDisplay

to see which library you need to link against. It’s probably libX11.so
so you’ll need to add -lX11 to $LIBS (or rather fix your sdl-config).
You might want to look in /usr/X11R6/lib or whereever you have libraries
installed, too. Don’t forget to add -L and -R
if the library isn’t in your system’s default library path.

I don’t have a config.log file.

You’d have one if you compiled the libraries yourself. It’s created by
configure. Or if you used Autoconf for you program, you’d have a
config.log there too, of course.–
Christian
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20040107/38557a5c/attachment.pgp