Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 06-25-2013, 06:36 AM   #1
LQ Newbie
Registered: Jun 2013
Posts: 7

Rep: Reputation: Disabled
collect2: ld returned 1 exit status

I am working on the toolchain from the scratch...

While installing gcc with the following commands:
echo "libc_cv_forced_unwind=yes" > config.cache
echo "libc_cv_c_cleanup=yes" >> config.cache
../../Source/glibc-2.9/configure \
--build=$BUILDMACH \
--host=$TARGETMACH \
--prefix=/usr \
--with-headers=$SYSROOTDIR/usr/include \
--config-cache \
--enable-add-ons=glibc-ports-2.9,nptl \

It worked fine and
make -k install-headers cross_compiling=yes install_root=$SYSROOTDIR

It also worked fine but after configuring I am facing the error for this command


/home/phytectoolchain/Build/glibc-build/elf/librtld.os: In function `_dl_start_final':
/home/phytectoolchain/Source/glibc-2.9/elf/rtld.c:348: undefined reference to `_begin'
/home/phytectoolchain/Install/lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/bin/ld: /home/phytectoolchain/Build/glibc-build/elf/ hidden symbol `_begin' isn't defined
/home/phytectoolchain/Install/lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status
make[2]: *** [/home/phytectoolchain/Build/glibc-build/elf/] Error 1
make[2]: Leaving directory `/home/phytectoolchain/Source/glibc-2.9/elf'
make[1]: *** [elf/subdir_lib] Error 2
make[1]: Leaving directory `/home/phytectoolchain/Source/glibc-2.9'
make: *** [all] Error 2

Last edited by salathia; 06-25-2013 at 06:43 AM.
Old 06-27-2013, 12:04 PM   #2
Registered: May 2008
Location: Argentina
Distribution: Debian, Slackware
Posts: 49

Rep: Reputation: 3

Dear salathia:
I've got a method that is a pain in the ass, but sometimes works.
First, I do a grep so that I can send all the file names that have the unreferenced symbol/function to a file.

For example: grep -rl "_dl_start_final" $PWD > afiletosaveallnames

Then you open "afiletosaveallnames" (doesn't need to be so long) and see whereelse is the unreferenced symbol. Sometimes the function is declared but not [I]defined[/].
Sometimes is easy, if you find where the function is defined you can add the file to the headers if you find it.
The most of the times the file exists but is misplaced.
If you can't find where the function is defined, then some library is missing.
You 've got to find it somewhere ... and fall in an endless updating..https://lqo-thequestionsnetw.netdna-..._lq/icon12.gif

Last edited by adelabarra; 06-27-2013 at 12:05 PM.


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
A different collect2: ld returned 1 exit status old_as_a_fossil Linux - General 0 01-28-2010 10:57 AM
collect2: ld returned 1 exit status makphy Linux - Newbie 0 12-14-2009 03:05 AM
collect2: ld returned 1 exit status kvijaik Linux - Software 2 10-07-2009 10:17 PM
collect2: ld returned 1 exit status Ritendra Linux - Newbie 2 07-30-2009 08:39 AM
collect2: ld returned 1 exit status abirami Linux - Software 0 03-02-2005 02:07 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:42 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration