LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris and OpenSolaris.
General Sun, SunOS and Sparc related questions also go here.

Notices



Reply
 
Search this Thread
Old 11-30-2009, 08:21 AM   #1
kreena
LQ Newbie
 
Registered: Nov 2009
Posts: 5

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

Last edited by kreena; 11-30-2009 at 08:41 AM.
 
Old 11-30-2009, 10:49 AM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,523

Rep: Reputation: 365Reputation: 365Reputation: 365Reputation: 365
Quote:
Originally Posted by kreena View Post

> 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
?
 
Old 12-03-2009, 01:44 AM   #3
kreena
LQ Newbie
 
Registered: Nov 2009
Posts: 5

Original Poster
Rep: Reputation: 0
Smile

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.
 
Old 12-03-2009, 11:49 AM   #4
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,523

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

Last edited by jlliagre; 12-04-2009 at 04:57 AM. Reason: add reminder
 
Old 12-04-2009, 06:51 AM   #5
kreena
LQ Newbie
 
Registered: Nov 2009
Posts: 5

Original Poster
Rep: Reputation: 0
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
 
Old 12-09-2009, 10:03 PM   #6
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,523

Rep: Reputation: 365Reputation: 365Reputation: 365Reputation: 365
Are you using the gcc bundled with Solaris or some other version you installed ?
 
Old 12-14-2009, 12:44 AM   #7
kreena
LQ Newbie
 
Registered: Nov 2009
Posts: 5

Original Poster
Rep: Reputation: 0
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
 
Old 12-14-2009, 03:51 AM   #8
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,523

Rep: Reputation: 365Reputation: 365Reputation: 365Reputation: 365
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
 
  


Reply

Tags
compile, error, gcc


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
/usr/lib/libgd.so: file not recognized: File format not recognized kimjao Linux - Software 2 07-24-2009 12:46 PM
not in executable format: File format not recognized ypy13 Linux - Newbie 9 07-10-2008 12:33 AM
Fedora 7 64bit /usr/lib/libexpat.so: could not read symbols: File in wrong format GATTACA Fedora 1 06-21-2007 08:47 PM
/usr/lib/libfontconfig.so: could not read symbols: File in wrong format TrekJunky Linux - Newbie 2 10-01-2006 07:05 PM
File Format not recognized eachow Linux - Hardware 2 07-10-2006 04:52 PM


All times are GMT -5. The time now is 02:09 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