Slackware This Forum is for the discussion of Slackware Linux.
|
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
07-28-2004, 03:29 PM
|
#1
|
|
Member
Registered: Apr 2003
Posts: 345
Rep:
|
OpenGL and SDL programming with Slackware
Hey all,
I've been trying to get my OpenGL programs (some of which make heavy use of SDL and SDL_mixer) to compile on Slackware (9.1 and 10.0), but no luck so far. I've tried all the various make variations as suggested by the glut-3.7 README file and the SDL README files, I've tried moving the header files around into various directories, but no luck so far. Since my error messages keep changing and are very numerous, I shall refrain from posting them here for now. My main question really is if anyone here has been able to code, compile and run programs that use both OpenGL and SDL on a Slackware distro. I know it works on SuSE and the like, but I've just never been able to get it to work on Slack. Getting it to work in Windows is a breeze of course, but *blegh* basically. Who wants their hands held anyway?
Well, off to  .... I'll be hoping to hear from at least one person with a success story.
-zsejk
|
|
|
|
07-28-2004, 06:23 PM
|
#2
|
|
LQ Newbie
Registered: Jun 2003
Distribution: Slackware current
Posts: 6
Rep:
|
I really don't know whats the problem but I've compiled several OpenGL-SDL applications and not a problem so.. that's my succes story
|
|
|
|
07-29-2004, 01:31 AM
|
#3
|
|
Member
Registered: Apr 2003
Posts: 345
Original Poster
Rep:
|
Hehehe.... that's really all I needed, someone to tell me it *is* possible.
The main issues are libraries that can't be found, GLUT functions not working, SDL_audio.h being unfindable even though it's in the same directory as SDL.h, etc. Basically there's something new every time I try to recompile or move stuff around. I guess I just have to keep tinkering until it works. One question though: did you use the SDL stuffs already in Slackware, or did you get packages from libsdl.org? Same question for glut: did you go to the OpenGL site and download the glut package (3.7 say), or do you use the glut stuffs already in Slack?
Thanks!!!
-zsejk
|
|
|
|
07-29-2004, 02:04 AM
|
#4
|
|
Senior Member
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140
|
SDL does not require glut to run open GL as far I know (but glu.h instead)
Try use these flags :
Code:
gcc `sdl-config --cflags --libs` -L/usr/X11R6/lib -lGL -lGLU -lpthread -o program program.c
|
|
|
|
07-29-2004, 11:19 AM
|
#5
|
|
Member
Registered: Apr 2003
Posts: 345
Original Poster
Rep:
|
Hey,
Thanks for that, I'll try it in a few minutes (have to eat some breakfast first). The reason I need glut.h though is because I use stuff like glutIdleFunc and glutSwapBuffers etc.
-zsejk
|
|
|
|
07-29-2004, 12:09 PM
|
#6
|
|
Member
Registered: Nov 2003
Distribution: Slackware
Posts: 63
Rep:
|
Quote:
Originally posted by zsejk
Hey,
Thanks for that, I'll try it in a few minutes (have to eat some breakfast first). The reason I need glut.h though is because I use stuff like glutIdleFunc and glutSwapBuffers etc.

-zsejk
|
Why are you using SDL and glut at the same time ?
|
|
|
|
07-29-2004, 12:16 PM
|
#7
|
|
Member
Registered: Apr 2003
Posts: 345
Original Poster
Rep:
|
Good question!  Basically in the program I'm trying to run I used SDL for the sound effects and glut for the other stuff. I also use glu and regular gl of course, so basically it's the one program I want to get running. 'Cause if *it* runs, everything will run.
-zsejk
|
|
|
|
07-29-2004, 02:36 PM
|
#8
|
|
Member
Registered: Apr 2003
Posts: 345
Original Poster
Rep:
|
Quote:
Originally posted by Cedrik
SDL does not require glut to run open GL as far I know (but glu.h instead)
Try use these flags :
Code:
gcc `sdl-config --cflags --libs` -L/usr/X11R6/lib -lGL -lGLU -lpthread -o program program.c
|
Well, I tried that and then some. Here's what I ended up with:
Code:
bash-2.05b$ make program
g++ -O -I. -I/usr -I/usr/include -L/usr/lib -L/lib -L/usr/X11R6/lib
`sdl-config --cflags --libs` -lGL -lGLU -lglut -lpthread -lSDL
-lSDL_mixer -o program program.o
/usr/lib/libglut.so: undefined reference to `XGetExtensionVersion'
/usr/lib/libglut.so: undefined reference to `XFreeDeviceList'
/usr/lib/libglut.so: undefined reference to `XQueryDeviceState'
/usr/lib/libglut.so: undefined reference to `XListInputDevices'
/usr/lib/libglut.so: undefined reference to `XFreeDeviceState'
/usr/lib/libglut.so: undefined reference to `XOpenDevice'
/usr/lib/libglut.so: undefined reference to `XmuLookupStandardColormap'
/usr/lib/libglut.so: undefined reference to `XSelectExtensionEvent'
collect2: ld returned 1 exit status
make: *** [program] Error 1
So it seems things are working mildly ok, only now I have this odd collection of things in my glut library that can't find their way.
-zsejk
|
|
|
|
07-31-2004, 04:25 AM
|
#9
|
|
Member
Registered: Nov 2003
Distribution: Slackware
Posts: 63
Rep:
|
You need to link the X libraries to, try adding the following flags : -lX11 -lXmu
If you still get undefined references run
ldd /usr/X11R6/lib/libglut.so
This will give you a list of libraries glut needs, then it's just a matter of linking the ones which are missing.
Last edited by George666; 07-31-2004 at 04:28 AM.
|
|
|
|
07-31-2004, 04:30 AM
|
#10
|
|
Senior Member
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140
|
I feel it a little curious to use both glut and sdl libraries in a program as all glut functions have an equivalent in SDL
|
|
|
|
07-31-2004, 09:36 AM
|
#11
|
|
Member
Registered: Apr 2003
Posts: 345
Original Poster
Rep:
|
Quote:
Originally posted by George666
You need to link the X libraries to, try adding the following flags : -lX11 -lXmu
If you still get undefined references run
ldd /usr/X11R6/lib/libglut.so
This will give you a list of libraries glut needs, then it's just a matter of linking the ones which are missing.
|
I did remember to do the first part of your suggestion, but still the same error. I'll give the second part a try later today... who knows!
And Cedrik... I don't think GLUT provides sound events... does it? Which doesn't make it necessary to use GLUT, I realize that (just use SDL right?), but I have some programs using GLUT and not SDL, which I really don't feel like changing. So whether or not GLUT and SDL end up being able to work together in the same program, the very *least* thing I need is for GLUT to work by itself.
-zsejk
|
|
|
|
07-31-2004, 09:45 AM
|
#12
|
|
Senior Member
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140
|
did you put -L/usr/X11R6/lib before -lX11 ?
[edit]
From man glut :
An example X11/Unix compile line would look like:
cc -o foo foo.c -lglut -lGLU -lGL -lXmu -lXi -lXext -lX11 -lm
Last edited by Cedrik; 07-31-2004 at 09:48 AM.
|
|
|
|
07-31-2004, 10:05 AM
|
#13
|
|
Member
Registered: Apr 2003
Posts: 345
Original Poster
Rep:
|
Yeah, that's actually what I started out with. It can't find the -Xext though, but I will try your solution about the order of things. Right after I get Slakcware re-installed, that is.
-zsejk
|
|
|
|
08-03-2004, 07:52 PM
|
#14
|
|
Member
Registered: Apr 2003
Posts: 345
Original Poster
Rep:
|
Well, you all were right... I was wrong. Nothing needs to be done to get this to work in Slackware 10.0. Especially make sure you don't go installing GLUT by downloading it somewhere, because you'll likely be messing up links and libraries that are best left alone.
In a fresh Slackware install, my makefile looks as follows:
Code:
CC = g++
GCCFLAGS = -O
INCLUDE = -I. -I/usr/include
LDLIBS = -lglut -lXext -lX11 -lXmu -lXi -lGL -lGLU -lm -lSDL -lSDL_mixer
LDFLAGS = -L/usr/X11R6/lib -L/usr/lib -L/lib
program:
$(CC) $(GCCFLAGS) $(INCLUDE) progam.c $(LDFLAGS) $(LDLIBS) -o program
The header includes inside the code are simply as follows:
Code:
#include <GL/glut.h>
#include <GL/gl.h>
#include <SDL/SDL.h>
#include <SDL/SDL_mixer.h>
-zsejk
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 07:38 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|