LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 04-03-2009, 11:43 AM   #1
paulc4
LQ Newbie
 
Registered: Apr 2009
Posts: 7

Rep: Reputation: 0
gdb giving "Not executable format" error with .so


Hi,

I'm new to Linux, and playing with my first few programs.

I'm getting a >> "<myPath>/helloWorld": not an executable format: File Format not recognized << error from gdb when it attempts to load the executable.

Well, to be more precise….

If my HelloWorld.c is:

Code:
#include <stdio.h>

int main()
{

	printf("Hello world\n");
	return (0);
}
Then I can execute the program fine (./helloWorld), as well as debug it (gdb ./helloWorld). However, if I change the program to:

Code:
#include <stdio.h>
#include <dc1394.h>
#include <camera.h>

int main()
{
	dc1394_t * 	  pLibDc;  			// LIBDC1394 context
	pLibDc = dc1394_new ();

	printf("Hello world\n");
	return (0);
}
Then it still executes fine (./hellowWorld), but I get the above error message when I try to dbg it. The shared library in question, is the libdc1394 library for control of 1394 cameras. It seems to be working fine, as I can call all sorts of functions in the library and they do the right thing…. But I just can't get it to work under gdb.

for what it's worth, I'm using Anjuta to 'build' my program (which calls the gcc for me).

Any thoughts?

Thanks.
 
Old 04-03-2009, 03:50 PM   #2
TimothyEBaldwin
Member
 
Registered: Mar 2009
Posts: 249

Rep: Reputation: 27
Quote:
Originally Posted by paulc4 View Post
for what it's worth, I'm using Anjuta to 'build' my program (which calls the gcc for me).
I suspect Anjunta is calling libtool.

Is ./HelloWorld realy a shell script which calls the real executable?
 
Old 04-03-2009, 04:13 PM   #3
dwhitney67
Senior Member
 
Registered: Jun 2006
Location: Maryland
Distribution: Kubuntu, Fedora, RHEL
Posts: 1,541

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
Perhaps I misread the OP, but it would seem that there is an issue with debugging the dc1394 library. It is quite possible (actually, highly probable) that the library was not compiled with the '-g' option which includes symbolic information of the code.

If the source code of the library is available, try rebuilding it with the -g gcc option.
 
Old 04-03-2009, 06:32 PM   #4
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Maybe the library just needs 'x' permission - ldd complains about .so files not having 'x' permission.
 
Old 04-06-2009, 07:32 AM   #5
paulc4
LQ Newbie
 
Registered: Apr 2009
Posts: 7

Original Poster
Rep: Reputation: 0
D'oh -- I'm such a newb.

Timothy --> you nailed it. That's exactly what was happening.

Sergi --> that was my first guess too, but no luck.

Thanks for the replies guys.

/Paul
 
  


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
gdb "not in executable format: File format not recognized" tcma Programming 9 07-18-2007 06:02 AM
gdb error "Failed to read a valid object file image from memory." Fejimush Programming 0 03-11-2007 01:40 PM
X doesnt start anymore; error message: "/etc/X11/ X is not an executable" lixy Linux - General 5 01-14-2006 09:12 AM
"mythtv-setup" giving "Session management error: Authentication Rejected" Mitchua Ubuntu 0 10-09-2005 04:32 PM
kldload keeps giving "Exec format error" jd121 *BSD 1 07-20-2003 11:44 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:23 PM.

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
Open Source Consulting | Domain Registration