LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   collect2: ld returned 1 exit status (https://www.linuxquestions.org/questions/linux-newbie-8/collect2-ld-returned-1-exit-status-4175467297/)

salathia 06-25-2013 05:36 AM

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 \
--enable-kernel=2.6.0

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

make

/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/ld.so: 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/ld.so] 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

adelabarra 06-27-2013 11:04 AM

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


All times are GMT -5. The time now is 02:19 AM.