LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   gdb giving "Not executable format" error with .so (https://www.linuxquestions.org/questions/programming-9/gdb-giving-not-executable-format-error-with-so-716604/)

paulc4 04-03-2009 11:43 AM

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.

TimothyEBaldwin 04-03-2009 03:50 PM

Quote:

Originally Posted by paulc4 (Post 3497401)
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?

dwhitney67 04-03-2009 04:13 PM

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.

Sergei Steshenko 04-03-2009 06:32 PM

Maybe the library just needs 'x' permission - ldd complains about .so files not having 'x' permission.

paulc4 04-06-2009 07:32 AM

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


All times are GMT -5. The time now is 12:44 PM.