C won't execute?!??!
Hi,
For some reason one of my computers has stopped executing C programs. On startup it will be fine for a bit and then (presumably after some unknown event) will not run any of my c programs. I can compile and run a new C program that will work and it will run Tcl and bash scripts but not C. Sorry there isn't more information but it hasn't happened many times. Thanks, ectof |
What distribution are you using? And what exact error message are you getting when you try to run programs that don't work?
|
Quote:
|
Sorry, the question was not well posed.
The distro is a quite old version of suse (7.?) and gcc is 3.3, it has been reasonably stable up to now. I meant that I could compile and run the executable of a new program, but I cannot run programs that have been compiled previously i.e. before the last boot up. ectof |
Quote:
|
Thanks for your help so far.
So I managed to find out a bit more. The program I was testing with was just the most basic 'hello_world.c' When I compile and run #include <stdio.h> int main() { printf("hello world\n"); return 0; } gcc 'hello_world.c' ./a.out it gives the expected 'hello world' But, if I do gcc 'hello_world.c' -lgpibapi ./a.out It seems to compile OK and then when I execute it just hangs. I then tried gcc 'hello_world.c' -lm ./a.out and again it executes. As I say the on immediate startup things are OK but then it stops working. If you have any idea why this might happen for this library that would be great. I guess I am doing something to screw up the gpib, but I have no idea what. ectof |
So, only programs that use that one library are not working, correct?
|
Yes so far as I'm aware but I haven't tested all the libraries.
|
Can you post ldd a.out (when the program doesn't execute)? Do you happen to have two versions of libgpibapi with the same soname? Also post ls -l /usr/lib/libgpibapi/libgpibapi* (adjust path as applicable.)
Kevin Barry |
Hi this is the output from the session log
ldd a.out linux-gate.so.1 => (0xffffe000) libgpibapi.so.2 => /usr/local/lib/libgpibapi.so.2 (0x40032000) libc.so.6 => /lib/tls/libc.so.6 (0x40091000) libnipalu.so.1 => /usr/local/lib/libnipalu.so.1 (0x401a6000) libgpibconf.so.2 => /usr/local/lib/libgpibconf.so.2 (0x4023b000) libm.so.6 => /lib/tls/libm.so.6 (0x40251000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000) librt.so.1 => /lib/tls/librt.so.1 (0x40273000) libdl.so.2 => /lib/libdl.so.2 (0x4027b000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x4027e000) ls -l /usr/local/lib/libgpibapi* lrwxrwxrwx 1 root root 15 2005-09-16 16:09 /usr/local/lib/libgpibapi.so -> libgpibapi.so.2 lrwxrwxrwx 1 root root 19 2005-09-16 16:09 /usr/local/lib/libgpibapi.so.2 -> libgpibapi.so.2.3.1 lrwxrwxrwx 1 root root 49 2005-09-16 16:09 /usr/local/lib/libgpibapi.so.2.3.1 -> /usr/local/natinst/ni4882/lib/libgpibapi.so.2.3.1 ls -l /usr/local/natinst/ni4882/lib/libgpibapi.so.2.3.1 -rwxr-xr-x 1 root root 379735 2005-03-02 20:25 /usr/local/natinst/ni4882/lib/libgpibapi.so.2.3.1 |
Have you recompiled all (or at least one) of the non-functioning programs? Maybe you updated the library and they are linked against the wrong version.
|
It seems like it has something to do with the loading of that particular library (i.e. the _init function.) Why do you try to link to it? Does it replace something contained in libm?
Kevin Barry |
I have tried recompiling a few of the programs, which didn't work.
Some of the other programs need it. Thanks. |
Having googled for "libgpibapi", here are two promising results you may like to pursue.
http://forums.ni.com/ni/board/messag...ssage.id=17597 http://linux.derkeiler.com/pdf/Newsg...1/msg00165.pdf End |
Thanks, that's kind of embarrassing. This looks like it may be a much more common problem than I thought.
|
All times are GMT -5. The time now is 03:09 PM. |