LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Solaris / OpenSolaris (https://www.linuxquestions.org/questions/solaris-opensolaris-20/)
-   -   Compiler error : /usr/lib/libc.so: file not recognized: File format not recognized (https://www.linuxquestions.org/questions/solaris-opensolaris-20/compiler-error-usr-lib-libc-so-file-not-recognized-file-format-not-recognized-772433/)

kreena 11-30-2009 07:21 AM

Compiler error : /usr/lib/libc.so: file not recognized: File format not recognized
 
I am compiling a .c file with gcc & getting this

> gcc -o test.o test.c
/usr/lib/libc.so: file not recognized: File format not recognized

I tried it on bach as well as with csh. Getting the same error.

> ls -l /usr/lib/libc.so
lrwxrwxrwx 1 root root 19 Apr 7 2009 /usr/lib/libc.so -> ../../lib/libc.so.1

PS: I am on Solaris : Solaris 10 10/08 s10s_u6wos_07b SPARC

jlliagre 11-30-2009 09:49 AM

Quote:

Originally Posted by kreena (Post 3774311)

> gcc -o test.o test.c

That should be either:
Code:

gcc -c -o test.o test.c
(with "-o test.o" redundant) or
Code:

gcc -o test test.c
However, this doesn't explain the main issue:
Quote:

/usr/lib/libc.so: file not recognized: File format not recognized
What says:
Code:

file /usr/lib/libc.so
?

kreena 12-03-2009 12:44 AM

Hi jlliagre

With gcc -c its working fine. Thanks a lot for your reply.

However, now I am not able to link thread libraries with it.

$ gcc -c -o test -c test.c -lthread
gcc: -lthread: linker input file unused since linking not done.

Can you suggest how can I proceed here.

Thanks in advance.

jlliagre 12-03-2009 10:49 AM

Remove the "-c" if you want to build an executable and please answer to my previous question (file /usr/lib/libc.so).

kreena 12-04-2009 05:51 AM

Hi,

$ file /usr/lib/libc.so
/usr/lib/libc.so: ELF 32-bit MSB dynamic lib SPARC32PLUS Version 1, V8+ Required, dynamically linked, not stripped, no debugging information available

After removing -c option I am getting previous error : File format not recognized

jlliagre 12-09-2009 09:03 PM

Are you using the gcc bundled with Solaris or some other version you installed ?

kreena 12-13-2009 11:44 PM

Hi,

I am using

$ gcc -v
Reading specs from /usr/local/gnu/lib/gcc-lib/sparc-sun-solaris2.5/2.7.2/specs
gcc version 2.7.2

jlliagre 12-14-2009 02:51 AM

That's not the Solaris bundled one. You might want to try again with:
Code:

$ PATH=/usr/sfw/bin:$PATH
$ gcc -v
...
$ gcc -o test test.c



All times are GMT -5. The time now is 09:59 PM.