LinuxQuestions.org
Review your favorite Linux distribution.
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 08-22-2011, 01:15 PM   #1
kapsikum
Member
 
Registered: Mar 2005
Location: INDIA
Posts: 79

Rep: Reputation: 16
glibc 2.14 compilation issue


I had to compile glibc for which i took glibc-2.14. Since there were some undefined references which came with native binutils-2.18.50.0.6, i had to compile and use binutils-2.21.1 for this. Now that my glibc, after some more errors and subsequent resolutions, has compiled and while i try to use it for my test program i get this error :
=====================================================
x.c.text+0x0): multiple definition of `main'
/tmp/ccE7QcUB.o:x.c.text+0x0): first defined here
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../crt1.o: In function `_start':
(.text+0xc): undefined reference to `__libc_csu_fini'
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../crt1.o: In function `_start':
(.text+0x11): undefined reference to `__libc_csu_init'
collect2: ld returned 1 exit status
=====================================================

Can anybody please tell me whats wrong here. At somebody's, one of the previous posts somebody suggested that may be LDFLAGS need to be set, if that is the case, what should be the values which i need to set from my x86 32 bit compilation. I am using gcc-4.3 on linux kernel 2.6.25-14 (fedora core 9)
 
Old 08-22-2011, 02:22 PM   #2
business_kid
Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 6,497

Rep: Reputation: 570Reputation: 570Reputation: 570Reputation: 570Reputation: 570Reputation: 570
Fedora 9?
There are unwritten rules here which I shall summarize.
1. Understand the implications of changing glibc - it changed the libraries against which everything is linked, which is generally a bad thing.
2. Generally speaking, compile the current stuff with the current stuff if you're compiling. You're always going to get errors using a 2009 binutils/kernel/gcc and a 2011 glibc.

Why not update? Give a few details why you have to go this road.
 
1 members found this post helpful.
Old 08-22-2011, 02:38 PM   #3
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
Did you rebuilt gcc using your new glibc? Are you linking with ld or with gcc (those look like errors caused when linking with the former)?
Kevin Barry
 
Old 08-22-2011, 02:42 PM   #4
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014.08, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 13,943

Rep: Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602
Glibc is your system ( together with the kernel ).
Thus glibc can usually not be changed.

Don't expect anything to work ever, if you get glibc-2.14 installed.
A reinstall is most often the only cure after a glibc change.
 
Old 08-22-2011, 05:46 PM   #5
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
Quote:
Originally Posted by knudfl View Post
Don't expect anything to work ever, if you get glibc-2.14 installed.
A reinstall is most often the only cure after a glibc change.
I would say that's only true if the previous version is removed, and then you'd need to recompile everything on your system, not reinstall it.
Kevin Barry
 
Old 08-22-2011, 06:05 PM   #6
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 453Reputation: 453Reputation: 453Reputation: 453Reputation: 453
Quote:
Originally Posted by knudfl View Post
Glibc is your system ( together with the kernel ).
Thus glibc can usually not be changed.

Don't expect anything to work ever, if you get glibc-2.14 installed.
A reinstall is most often the only cure after a glibc change.
'glibc' can be compiled and used without replacing system 'glibc'. I've done this, using self-compiled 'glibc' in literally hundreds of targets, but is really tricky and convoluted.

'glibc' is notoriously bitchy to compile, and RedHat (i.e. "sourceware") doesn't even accept bug reports against 'glibc' build mechanism. I myself found a number of bugs.

Look up on the web "bug/faq 333".

Compiling 'glibc' is a lottery, i.e. using exactly the same environment one can be lucky compiling version N, fail compiling version N + 1 and again be lucky compiling version N + 2. I am telling all this from my own experience.

One can read http://lwn.net/Articles/333755/ and http://linux.slashdot.org/story/09/0...libc-To-Eglibc -> specifically: http://linux.slashdot.org/comments.p...9&cid=27853081 - the very first 7 words are right on target.
 
Old 08-23-2011, 01:20 AM   #7
John VV
Guru
 
Registered: Aug 2005
Posts: 13,051

Rep: Reputation: 1741Reputation: 1741Reputation: 1741Reputation: 1741Reputation: 1741Reputation: 1741Reputation: 1741Reputation: 1741Reputation: 1741Reputation: 1741Reputation: 1741
fedora 9 !

stay current and install fedora 15 .
problem solved

now yes it is possible to install a SECOND glib
BUT it is VERY easy to KILL/ FUBAR/ DOA the operating system
one false move one little typo and R.I.P you will never boot the computer


i do it for the dev tree of Gimp sometimes it needs a newer version than the OS

but it is NOT recommended


install Fedora 15 !!!
 
Old 08-23-2011, 01:46 AM   #8
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014.08, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 13,943

Rep: Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602
# 6
Quote:
'glibc' is notoriously bitchy to compile
Not impossible, if you use the instructions in LFS
http://www.linuxfromscratch.org/lfs/view/stable/
... ( And if you remember to use a hideaway prefix like /opt/glibc213/ ).


# 1 :
Quote:
I had to compile glibc
Usually # yum install glibc-devel
will do for the files you may be missing.

( Glibc-2.14 is a future version.)

..

Last edited by knudfl; 08-23-2011 at 01:48 AM.
 
Old 08-23-2011, 04:20 AM   #9
kapsikum
Member
 
Registered: Mar 2005
Location: INDIA
Posts: 79

Original Poster
Rep: Reputation: 16
Hello,

thank you all for your suggestions, my reason for compiling a separate gcc is purely developmental. I Need to modify the malloc.
Since the current stable version is 2.14, so i took that. I do not intend to use it on my native host for all the native applications but just to modify the malloc according to my specific requirements, make a new libc.so and link it against my test program (issuing multiple calls to malloc and free).
OR
may be i can download the source code for the same version of glibc which my OS has, that way i suppose i can get a new environment where i can make changes to glibc, compile and test it without any extraneous glibc issues ?
 
Old 08-23-2011, 04:45 AM   #10
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 453Reputation: 453Reputation: 453Reputation: 453Reputation: 453
Quote:
Originally Posted by knudfl View Post
# 6

Not impossible, if you use the instructions in LFS
http://www.linuxfromscratch.org/lfs/view/stable/
... ( And if you remember to use a hideaway prefix like /opt/glibc213/ ).

..
Of course, I am using different from system one prefix. Furthermore, I am not using root permission while compiling and installing stuff.

Now about the "possibility" - following your link:

http://www.linuxfromscratch.org/lfs/...r05/glibc.html :

Quote:
Fix a bug that prevents Glibc from building with GCC-4.5.2:

patch -Np1 -i ../glibc-2.13-gcc_fix-1.patch
...
I.e., it is impossible to compile stock glibc-2.13 using gcc-4.5.2 (and I already am using gcc-4.5.3). Which just proves my statements: 'glibc' is notoriously bitchy to compile, developers don't even accept bug reports against 'glibc' build mechanism.
 
Old 08-23-2011, 07:56 AM   #11
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
Quote:
Originally Posted by kapsikum View Post
Hello,

thank you all for your suggestions, my reason for compiling a separate gcc is purely developmental. I Need to modify the malloc.
Since the current stable version is 2.14, so i took that. I do not intend to use it on my native host for all the native applications but just to modify the malloc according to my specific requirements, make a new libc.so and link it against my test program (issuing multiple calls to malloc and free).
OR
may be i can download the source code for the same version of glibc which my OS has, that way i suppose i can get a new environment where i can make changes to glibc, compile and test it without any extraneous glibc issues ?
Wouldn't it be easier to just shadow glibc malloc during linking? You can do that by creating your own .so with malloc and linking to it. ld will find your malloc first and use it; not a lot of work involved.
Kevin Barry

edit: Unless, of course, you want your malloc to be used when malloc is called within glibc or if your malloc needs access to glibc symbols that aren't globally visible.

Last edited by ta0kira; 08-23-2011 at 08:05 AM.
 
Old 08-25-2011, 06:18 AM   #12
kapsikum
Member
 
Registered: Mar 2005
Location: INDIA
Posts: 79

Original Poster
Rep: Reputation: 16
Finally, i was able to build glibc 2.13 using gcc 4.5.2 and able to use it. Though there were some errors while compiling but help is available on the net esp. LSF.

Thanks a lot to all of you.
 
  


Reply


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
Glibc compilation errors phoenix12345 Linux From Scratch 4 05-09-2009 11:32 AM
glibc-2.7 compilation error circul Linux From Scratch 2 01-26-2008 06:30 PM
glibc compilation error newcomer4 Linux - Newbie 1 02-03-2006 02:53 PM
glibc compilation error newcomer4 Linux From Scratch 1 02-03-2006 05:02 AM
Glibc compilation error Krappy Linux From Scratch 0 05-03-2005 12:24 AM


All times are GMT -5. The time now is 05:06 PM.

Main Menu
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