PDA

View Full Version : AC3Dloader1.1, ac3d_view compilation on linux/GL/glut?


wac3d
12th July 2004, 01:44 PM
i am trying to install the AC3Dloader1.1, ac3d_view utilities (http://www.ac3d.org/ac3d/download/AC3Dloader1.1.zip, http://www.ac3d.org/ac3d/download/tri_view.tgz) on a linux box (redhat el 3).

i believe i have the full glut pkgs, + GL, but the link stage fails for both with undefined references.
(note: i did modify the ac3d_view Makefile to not expect Mesa & to use -L /usr/X11R6/lib)

any suggestions?
thanks in advance.

------------------------------------------------------------------
$ rpm -qa|grep glut

glut-devel-3.7-12
glut-3.7-12

$ gmake
gcc -Wall -O2 -o ac3dview ac3d.o texture.o render.o main.o -L /usr/lib -lglut -L /usr/X11R6/lib/ -lGLU -lGL -lXmu -lXext -lX11 -lm
/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 `XSelectExtensionEvent'
collect2: ld returned 1 exit status

$ strings /usr/lib/libglut.so.3.7|grep XGetExtensionV
XGetExtensionVersion

Andy
12th July 2004, 02:13 PM
Those symbols are from X. As you are already linking with X11, I'd try reordering the -l's so that glut is after X11.

I'm unable to test this at the moment but it's what I'd try first.

Andy

wac3d
20th July 2004, 03:29 PM
thanks for your valuable suggestions.

the problem was that an additional X library is reqd (at least under RH EL 3.0) for the link to succeed.

here are workarounds for some other linux systems:

(1) Redhat EL 3 (nominal system):
XFree86: 4.3.0-62.EL
glut: 3.7-12 (note: same as RH 9.0)

result of make: link fails
e.g.:
$ gmake
gcc -Wall -O2 -o ac3dview ac3d.o texture.o render.o main.o -L /usr/lib -lglut -L /usr/X11R6/lib/ -lGLU -lGL -lXmu -lXext -lX11 -lm
/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 `XSelectExtensionEvent'
collect2: ld returned 1 exit status

$ strings /usr/lib/libglut.so.3.7|grep XGetExtensionV
XGetExtensionVersion

$strings /usr/X11R6/lib/libXi.a |grep XGetExtensionV
XGetExtensionVersion
XGetExtensionVersion

after adding -lXi to LIBS, it compiles and runs correctly.

(2) Redhat 7.3
XFree86: 4.2.1-13.73.3
glut: 3.7-4

revised Makefile:
LIB_DIRS = -L /usr/X11R6/lib
LIBS = -lglut -lXmu -lXext -lX11 -lm
result: compiles, links, and runs ok!

(3) SUSE 9.0 (64bit)

XFree86-Mesa: 4.3.0.1-52
mesaglut: 5.0.1-68

result: link fails
to use the 64 bit libraries requires:
LIBS_DIRS = -L /usr/X11R6/lib64/ -L /usr/lib64/
LIBS = -lglut -lGLU -lGL -lXext -lX11 -lm

and it compiles and runs correctly.