LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 05-27-2009, 04:00 AM   #1
ectof
LQ Newbie
 
Registered: May 2009
Posts: 7

Rep: Reputation: 0
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
 
Old 05-27-2009, 04:22 AM   #2
verdeboy2k
Member
 
Registered: Jan 2004
Location: /dev/random
Distribution: Gentoo amd64, CrunchBang amd64
Posts: 350

Rep: Reputation: 32
What distribution are you using? And what exact error message are you getting when you try to run programs that don't work?
 
Old 05-27-2009, 04:25 AM   #3
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 453Reputation: 453Reputation: 453Reputation: 453Reputation: 453
Quote:
Originally Posted by ectof View Post
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
I think items in red and blue contradict each other.
 
Old 05-27-2009, 07:37 AM   #4
ectof
LQ Newbie
 
Registered: May 2009
Posts: 7

Original Poster
Rep: Reputation: 0
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
 
Old 05-27-2009, 07:45 AM   #5
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 453Reputation: 453Reputation: 453Reputation: 453Reputation: 453
Quote:
Originally Posted by ectof View Post
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
So, post (copy-paste) the source, command lines you used to compile and link, command lines you used to invoke the newly produced programs and the error messages they produce.
 
Old 05-27-2009, 01:58 PM   #6
ectof
LQ Newbie
 
Registered: May 2009
Posts: 7

Original Poster
Rep: Reputation: 0
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
 
Old 05-27-2009, 05:21 PM   #7
verdeboy2k
Member
 
Registered: Jan 2004
Location: /dev/random
Distribution: Gentoo amd64, CrunchBang amd64
Posts: 350

Rep: Reputation: 32
So, only programs that use that one library are not working, correct?
 
Old 05-27-2009, 06:13 PM   #8
ectof
LQ Newbie
 
Registered: May 2009
Posts: 7

Original Poster
Rep: Reputation: 0
Yes so far as I'm aware but I haven't tested all the libraries.
 
Old 05-27-2009, 06:28 PM   #9
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
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
 
Old 05-27-2009, 07:19 PM   #10
ectof
LQ Newbie
 
Registered: May 2009
Posts: 7

Original Poster
Rep: Reputation: 0
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

Last edited by ectof; 05-27-2009 at 07:24 PM.
 
Old 05-27-2009, 11:10 PM   #11
verdeboy2k
Member
 
Registered: Jan 2004
Location: /dev/random
Distribution: Gentoo amd64, CrunchBang amd64
Posts: 350

Rep: Reputation: 32
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.
 
Old 05-27-2009, 11:18 PM   #12
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
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
 
Old 05-28-2009, 03:44 AM   #13
ectof
LQ Newbie
 
Registered: May 2009
Posts: 7

Original Poster
Rep: Reputation: 0
I have tried recompiling a few of the programs, which didn't work.

Some of the other programs need it.

Thanks.
 
Old 05-28-2009, 04:24 AM   #14
AnanthaP
Member
 
Registered: Jul 2004
Location: Chennai, India
Distribution: UBUNTU 5.10 since Jul-18,2006 on Intel 820 DC
Posts: 659

Rep: Reputation: 160Reputation: 160
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
 
Old 05-28-2009, 05:24 AM   #15
ectof
LQ Newbie
 
Registered: May 2009
Posts: 7

Original Poster
Rep: Reputation: 0
Thanks, that's kind of embarrassing. This looks like it may be a much more common problem than I thought.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Execute a command , reboot and then execute another command ganeshp@moris.org Linux - Newbie 3 12-03-2008 01:51 AM
Can't execute convertquota MonsieurLeBoulet Linux - Server 1 10-06-2008 09:35 AM
Cannot execute '/etc/rc.S' jmartinph Slackware 2 03-15-2004 02:39 AM
execute from root raysr Linux - Newbie 3 12-09-2003 02:41 AM
g++ how do i execute? neon Linux - Newbie 5 08-14-2003 04:51 AM


All times are GMT -5. The time now is 05:56 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration