LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 05-04-2015, 02:27 AM   #1
ashwinidubey
LQ Newbie
 
Registered: Jun 2007
Location: Mumbai, India
Posts: 25

Rep: Reputation: 15
gcc -static flag throws error


Hi All,

for educational purposes I am trying to build a static linked application and gcc throws error


Code:
gcc -static  first.c -o firstStatic
/usr/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status
Installaiton:
Fedora 20,
ThinkPad X240,
GCC version 4.8.3 20140911 (Red Hat 4.8.3-7),

thankyou for help.
 
Old 05-04-2015, 04:03 AM   #2
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,860
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
You should have a file called /usr/lib/libc.a

sg like this:
Code:
yum install glibc-static

Last edited by NevemTeve; 05-04-2015 at 04:05 AM.
 
1 members found this post helpful.
  


Reply



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
gcc -static flag? Linking from different compilations? dolle39 Programming 5 08-18-2012 10:08 AM
gcc throws Segmentation fault runtime error mrajdeep Programming 9 08-22-2011 02:30 PM
GCC Static linking error CartmanYO Programming 2 06-11-2010 02:28 AM
gcc -lGLU Flag Gives An Error Chryzmo Slackware 2 09-30-2004 09:22 PM
Compiled some exes without -static flag. Now what? sarin Linux From Scratch 2 07-22-2002 08:40 PM

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

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