LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.

Notices


Reply
  Search this Thread
Old 11-30-2009, 07: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 07:41 AM.
 
Old 11-30-2009, 09:49 AM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
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, 12: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, 10:49 AM   #4
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
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 03:57 AM. Reason: add reminder
 
Old 12-04-2009, 05: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, 09:03 PM   #6
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Are you using the gcc bundled with Solaris or some other version you installed ?
 
Old 12-13-2009, 11:44 PM   #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, 02:51 AM   #8
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

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



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

LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris

All times are GMT -5. The time now is 12:59 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
Open Source Consulting | Domain Registration