Click to See Complete Forum and Search --> : SVGAlib problems
innes
06-20-2003, 12:32 AM
I am having trouble with svaglib. First I installed svgalib via RPM.
While trying to compile a simple program to test my video card and link to the svgalib I encounter the error:
/usr/bin/ld: cannot find -lvga
So I tried downloading the tarball and compiling the library and succeded. This time I hade no problems compiling the program but when I tried to run it I recived the error:
./mode_tester: error while loading shared libraries: libvga.so.1: cannot open shared object file: No such file or directory
I looked for libvga.so.1 as a regular user but came up with nothing but when I tried with suid I got
/usr/lib/libvga.so.1.4.3
/usr/lib/libvga.so.1
I looked for them there and displayed hidden filles but didn't find them. So that's where I'm at. All I really want to do is get svgalib succsessfully installed and try my hand at graphics programing
with C or C++.
Thank you for any help.
GaryJones32
06-21-2003, 03:06 AM
for compiling
this in your compiler string
-L/usr/lib -lvga
in a makefile it would be like
LIBS = &(SUBLIBS) -L/usr/lib -lvga
ought to do it
for run
if usr/lib
is not in your directory path you can add the path to
/etc/ld.so.conf
then run
ldconfig
can also put the path in ~/.bash_profile
LD_LIBRARY_PATH=/usr/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
have to log all the way out and log back in
or you can just type the above at the command line
hope that helps
innes
06-21-2003, 03:02 PM
Thank you. Now i've got ld configured and libvga.so.1 in the right spot. Now I am getting the same error:
./mode_tester: error while loading shared libraries: libm.so.5: cannot open shared object file: No such file or directory
but in reference to libm.so.5 which are aperently old compatability libraries.
So I installed them but cannot find them on my system. I used the locate command at the command line but found nothing, so what gives?? Like I said before I am looking into simple graphics programming so feel free to suggest other courses of action.
bwkaz
06-21-2003, 03:43 PM
libm isn't an old compatibility library, it's your glibc math library. ;) But, it's not named libm.so.5, it's named libm.so. That's probably the problem.
Unless, perhaps, libm.so.5 is for libc5, then yeah, it's old. But if your program linked against libc5, that would mean you have libc5 on your system, which would mean you'd be able to find libm.so.5. Hmm...
Well, you can try creating a symlink named libm.so.5 that points at libm.so, and rerun ldconfig. ln -s libm.so /usr/lib/libm.so.5 && /sbin/ldconfig as root should do that.
You're still trying to run the program you wrote, right? What was the full compilation command you used?
innes
06-21-2003, 10:01 PM
well my compile command was:
gcc -o mode_tester mode_tester.c -lvga
so i tried making the symlink and running ldconfig:
ln -s libm.so /usr/lib/libm.so.5 && /sbin/ldconfig
and got:
/sbin/ldconfig: /usr/lib/libpython2.2.so.0.0 is not a shared object file (Type:768).
and i tried commpilling and got :
mode_tester.c:19:2: warning: no newline at end of file
/usr/lib/gcc-lib/i386-redhat-linux/3.2/../../../libvga.so: undefined reference to `_xstat'
/usr/lib/gcc-lib/i386-redhat-linux/3.2/../../../libvga.so: undefined reference to `_fxstat'
collect2: ld returned 1 exit status
so ... hmmm. Was I creating the link wrong?
This is everything that shows up for libm.so
locate libm.so
/usr/lib/libm.so
/usr/i486-linuxlibc5/lib/libm.so.5.0.9
/lib/libm.so.6
/lib/i686/libm.so.6
should I be linking to the i486 -linuxlibc5 library?
bwkaz
06-21-2003, 10:23 PM
What the heck distro is this, BTW?
Try blowing away your symlink; the ldconfig didn't work because of some problem with the Python library or something, so I have a feeling it didn't do any good anyway.
Try running ldd on the libvga.so file. Add anything that comes back to your linked-in libraries, for example, if ldd comes back with this:
$ ldd /usr/lib/libxslt.so
libxml2.so.2 => /usr/lib/libxml2.so.2 (0x40035000)
libz.so.1 => /usr/lib/libz.so.1 (0x400ec000)
libm.so.6 => /lib/libm.so.6 (0x400fa000)
libc.so.6 => /lib/libc.so.6 (0x4011d000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) Then you'll need to add -lxml2 -lz -lm to your link command (I ran ldd on libxslt because I don't have svgalib installed; you'll want to run it on libvga.so, and specify everything that comes back except libc and /lib/ld-linux.so.2).
innes
06-21-2003, 10:58 PM
Sorry I didn't say earlier but this is RH8.0
So I removed the symlink and ran ldd
$ ldd /usr/local/lib/libvga.so
libm.so.6 => /lib/i686/libm.so.6 (0x40063000)
libc.so.6 => /lib/i686/libc.so.6 (0x42000000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)
I came up with that I needed to add -lm to the command and before -lvga as documentation says most important file last. So..
gcc -o mode_tester mode_tester.c -lm -lvga
mode_tester.c:19:2: warning: no newline at end of file
/usr/bin/ld: warning: libm.so.5, needed by /usr/lib/gcc-lib/i386-redhat-linux/3.2/../../../libvga.so, not found (try using -rpath or -rpath-link)
/usr/lib/gcc-lib/i386-redhat-linux/3.2/../../../libvga.so: undefined reference to `_xstat'
/usr/lib/gcc-lib/i386-redhat-linux/3.2/../../../libvga.so: undefined reference to `_fxstat'
collect2: ld returned 1 exit status
same as before but now looking for libm.so.5
So should I make a symlink to libm.so.6??
Also thanks for the help so far i've been learning along the way.:D
bwkaz
06-22-2003, 12:28 PM
Is this the SVGAlib that you installed yourself? I see that it's /usr/lib/libvga.so -- that isn't the file that gets installed from a source build, unless you pass --prefix=/usr to the configure script. It sounds like this is just a very old version of libvga.so, maybe. (Was the RPM that you used the first time written for RH 8 specifically?)
What happens if you uninstall (rpm -e) the old SVGAlib package, and then reinstall the .tar.gz version?
innes
06-22-2003, 02:34 PM
Yah this is an SVGlib I installed. So I went ahead and did a little cleaning up and did a clean install from the tar.gz and recived an error about not finding libvga.so.1 like in the begining. So I found what I installed (libvga.so.1.4.3) and made a symlink at /user/lib/libvga.so.1.
This seemed to solve my problem because I compiled and ran the video mode testing program I was working with at first, but it just spat out text(like it was supposed to of course). When I tried another simple program that called for initlizing the vga card I run into the same old problems.
So I suppose that the libraries are only half way linked because i could call functions like (vga_hasmode) but not (vga_int).
Heres the full error:
gcc -o myfirst myfirst.c -lvgagl -lvga
/tmp/ccIU4G6C.o: In function `main':
/tmp/ccIU4G6C.o(.text+0x11): undefined reference to `vga_int'
collect2: ld returned 1 exit status
Guess I need to start reading some man pages.:)
innes
06-22-2003, 04:01 PM
A little update here. I went ahead and compiled some demo programs that came w/ SVAlib and they worked. I started looking at them and noticed that they left out the vga_int call at the begining which is contrary to what the documentation says.
So I tried leaving it out of my code and it compiled and ran.
My only concern is that the readme said this function released suid right after initilazation.
bwkaz
06-22-2003, 10:28 PM
Maybe the svgalib interface changed but the docs haven't caught up yet?
Interesting...
Try printing out the results of calling geteuid() (store it in any integer), after you call your first svgalib function. If geteuid() returns 0, then you're still root, which is bad -- perhaps the suid root isn't needed anymore?