LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices


Reply
  Search this Thread
Old 10-19-2014, 10:26 AM   #1
Z_Tagr
Member
 
Registered: Jul 2011
Distribution: Slackware 13.37
Posts: 59
Blog Entries: 1

Rep: Reputation: Disabled
Question Trouble compiling C program on Fedora 20 64-bit system


Hello all!

I have been all over the internet on this, and have merely become more confused!

First off, I am using Fedora 20, 64-bit, with the current kernel version being 3.16.6-200.fc20.x86_64,
and the gcc version I have installed is gcc (GCC) 4.8.3 20140911 (Red Hat 4.8.3-7), which I installed using:
>sudo yum groupinstall "Development Tools"

When I try to compile a REALY SIMPLE C program, like the following:

Code:
/* Simple.c */
    
int main()
{
  return 0;
}
using the command:
>gcc Simple.c -o Simple

I get the following error messages:

/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.8.3/../../../libc.so when searching for -lc
/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.8.3/../../../libc.a when searching for -lc
/bin/ld: skipping incompatible /lib/libc.so when searching for -lc
/bin/ld: skipping incompatible /lib/libc.a when searching for -lc
/bin/ld: skipping incompatible /usr/lib/libc.so when searching for -lc
/bin/ld: skipping incompatible /usr/lib/libc.a when searching for -lc
/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status

I believe I installed the development tools correctly (but have I?); I have also installed the
kernel-devel package upon a suggestion from an internet post...

I believe that this error message is telling me that the C / C++ library libc is not the correct version (or, more literally, an incompatible version) of that library? How can this be? How can it have occurred?

I am in desperate need of some assistance here!

If you require any other info. to help you resolve this issue, please let me know! I just can't figure this out!

Thanks in advance,

ZT.
 
Old 10-19-2014, 03:30 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,138

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
It sounds like you have something installed that should not be there. What do you get from:
Code:
rpm -qf /lib/libc.so
On a 64-bit system, your libraries should be under /lib64.
 
Old 10-19-2014, 04:46 PM   #3
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Works OK here, Fedora 20 - 64 : $ gcc Simple.c -o Simple

Both glibc-develīs are installed : glibc-devel.x86_64, glibc-devel.i686,
and gcc finds the right `libc.so', from /usr/lib64/.
( /lib64/ is a link to /usr/lib64/ ).

-
 
Old 10-19-2014, 05:59 PM   #4
Z_Tagr
Member
 
Registered: Jul 2011
Distribution: Slackware 13.37
Posts: 59

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
Exclamation I am really confused here...

Ok, I took your suggestion smallpond, and typed:
> rpm -qf /lib/libc.so

and I got the following:

glibc-devel-2.18-16.fc20.i686

Now what the heck does THAT mean? The version doesn't look right, but what's the "devel" all about?

This just isn't logical; I just freshly installed this system about a month ago, and I can't imaging what could have installed a seperate version of glibc...

All things considered, what would YOU do next to resolve this (almost laughable) situation? I have never encountered a similiar problem before! Why didn't yum complain when I installed gcc? 'Cause isn't this a DIFFERENT VERSION's library (or am I misunderstanding something?).

Should I simply try removing this package? Will that even work now?

Wow, this is some messed up stuff :-{

Anyways, thanks for responding to the post!

ZT.
 
Old 10-19-2014, 07:53 PM   #5
Z_Tagr
Member
 
Registered: Jul 2011
Distribution: Slackware 13.37
Posts: 59

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
Thumbs up Thanks guys! I got it (finally!)

Thanks to both you guys!

Using info. I extrapolated from both of your responses, I began to look into my /lib and /lib64 folders; I discoved that, although /lib indeed DID have a "libc.so" link, /lib64 DID NOT! Both of these folders did, however, have a file named "glibc-2.18.so" (which I now gather is the CORRECT library version? Who knew :-{ . This prompted me to do a little research on how and what "libc.so" actually is.

Through this further research I realized that, potentially, I had ONLY the glibc-devel.i686 package installed! I then ran:

> sudo yum install glibc-devel

and that solved the problem! I guess that simply using:

> sudo yum groupinstall "Development Tools"

is NOT all that's required in order to compile using gcc on 64-bit Fedora systems!

Thanks for all your help, gentlemen!

ZT.
 
Old 10-20-2014, 03:34 AM   #6
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Quote:
> sudo yum groupinstall "Development Tools"

is NOT all that's required in order to compile using gcc
No. The first requirement is : # yum install gcc-c++
.. which will also install the packages that make gcc work :
{ glibc-devel.x86_64, glibc-headers, kernel-headers }.
 
  


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
Trouble compiling program using the readline library stf92 Programming 3 11-25-2013 12:06 AM
[SOLVED] If I compile from source on 64 bit system will the compiled program be 64 bit? SharpyWarpy Linux - Software 3 08-14-2012 02:59 PM
Compiling 32 bit sample program on 64 bit fedora using -m32 option pankajdev Linux - Newbie 2 10-07-2009 07:42 AM
LXer: Upgrade from 32-bit to 64-bit Fedora Linux without a system reinstall LXer Syndicated Linux News 0 01-11-2008 09:42 PM
Trouble compiling QT program vapebait Programming 2 11-25-2003 02:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora

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