LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   gcc compilation failed in version-check.sh script (https://www.linuxquestions.org/questions/linux-from-scratch-13/gcc-compilation-failed-in-version-check-sh-script-4175421606/)

gibran 08-11-2012 03:04 PM

gcc compilation failed in version-check.sh script
 
Under the page http://www.linuxfromscratch.org/lfs/.../hostreqs.html there is a script that checks versions:
Code:

cat > version-check.sh << "EOF" #!/bin/bash # Simple script to list version numbers of critical development tools  export LC_ALL=C bash --version | head -n1 | cut -d" " -f2-4 echo "/bin/sh -> `readlink -f /bin/sh`" echo -n "Binutils: "; ld --version | head -n1 | cut -d" " -f3- bison --version | head -n1 if [ -e /usr/bin/yacc ];  then echo "/usr/bin/yacc -> `readlink -f /usr/bin/yacc`";    else echo "yacc not found"; fi  bzip2 --version 2>&1 < /dev/null | head -n1 | cut -d" " -f1,6- echo -n "Coreutils: "; chown --version | head -n1 | cut -d")" -f2 diff --version | head -n1 find --version | head -n1 gawk --version | head -n1 if [ -e /usr/bin/awk ];  then echo "/usr/bin/awk -> `readlink -f /usr/bin/awk`";    else echo "awk not found"; fi  gcc --version | head -n1 ldd --version | head -n1 | cut -d" " -f2-  # glibc version grep --version | head -n1 gzip --version | head -n1 cat /proc/version m4 --version | head -n1 make --version | head -n1 patch --version | head -n1 echo Perl `perl -V:version` sed --version | head -n1 tar --version | head -n1 echo "Texinfo: `makeinfo --version | head -n1`" xz --version | head -n1  echo 'main(){}' > dummy.c && gcc -o dummy dummy.c if [ -x dummy ]    then echo "gcc compilation OK";  else echo "gcc compilation failed"; fi rm -f dummy.c dummy EOF  bash version-check.sh
When running that script I have the following returned:

Code:

bash, version 4.2.24(1)-release
/bin/sh -> /bin/dash
Binutils: (GNU Binutils) 2.22
bison (GNU Bison) 2.5
/usr/bin/yacc -> /usr/bin/bison.yacc
bzip2,  Version 1.0.6, 6-Sept-2010.
Coreutils:  8.13
diff (GNU diffutils) 3.2
find (GNU findutils) 4.4.2
GNU Awk 3.1.8
/usr/bin/awk -> /usr/bin/gawk
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
(Ubuntu EGLIBC 2.15-0ubuntu10) 2.15
grep (GNU grep) 2.10
gzip 1.4
Linux version 3.2.0-29-generic (buildd@roseapple) (gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) ) #46-Ubuntu SMP Fri Jul 27 17:04:05 UTC 2012
m4 (GNU M4) 1.4.16
GNU Make 3.81
patch 2.6.1
Perl version='5.14.2';
GNU sed version 4.2.1
tar (GNU tar) 1.26
Texinfo: makeinfo (GNU texinfo) 4.13
xz (XZ Utils) 5.1.0alpha
/tools/bin/ld: this linker was not configured to use sysroots
collect2: ld returned 1 exit status
gcc compilation failed

I have searched a lot trying to find any hits that would lead me toward an answer at why this is happening, but could anyone possibly guide me in a direction to identifying why it returns that the linker was not configured/collect2/gcc comp. failed?

Any help much appreciated, thank you!

druuna 08-11-2012 03:23 PM

Quote:

Originally Posted by gibran (Post 4751864)
Under the page http://www.linuxfromscratch.org/lfs/.../hostreqs.html there is a script that checks versions:

When running that script I have the following returned:

Code:

bash, version 4.2.24(1)-release
/bin/sh -> /bin/dash
Binutils: (GNU Binutils) 2.22
bison (GNU Bison) 2.5
/usr/bin/yacc -> /usr/bin/bison.yacc
bzip2,  Version 1.0.6, 6-Sept-2010.
Coreutils:  8.13
diff (GNU diffutils) 3.2
find (GNU findutils) 4.4.2
GNU Awk 3.1.8
/usr/bin/awk -> /usr/bin/gawk
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
(Ubuntu EGLIBC 2.15-0ubuntu10) 2.15
grep (GNU grep) 2.10
gzip 1.4
Linux version 3.2.0-29-generic (buildd@roseapple) (gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) ) #46-Ubuntu SMP Fri Jul 27 17:04:05 UTC 2012
m4 (GNU M4) 1.4.16
GNU Make 3.81
patch 2.6.1
Perl version='5.14.2';
GNU sed version 4.2.1
tar (GNU tar) 1.26
Texinfo: makeinfo (GNU texinfo) 4.13
xz (XZ Utils) 5.1.0alpha
/tools/bin/ld: this linker was not configured to use sysroots
collect2: ld returned 1 exit status
gcc compilation failed

I have searched a lot trying to find any hits that would lead me toward an answer at why this is happening, but could anyone possibly guide me in a direction to identifying why it returns that the linker was not configured/collect2/gcc comp. failed?

You need to fix the bold blue part. /bin/sh should point to /bin/bash and not bin/dash

The brown part looks very odd. You are checking your host and I see a directory that points to /tools/bin? How did that happen. /tools is part of LFS and not relevant at this point (and surely unwanted!).

gibran 08-11-2012 05:03 PM

Quote:

Originally Posted by druuna (Post 4751869)
You need to fix the bold blue part. /bin/sh should point to /bin/bash and not bin/dash

The brown part looks very odd. You are checking your host and I see a directory that points to /tools/bin? How did that happen. /tools is part of LFS and not relevant at this point (and surely unwanted!).

I went to far in the guide and had to backtrack to fix another error. At least thats what I believe made this happen...
At this point it would probably be easier to just start from the beginning. Obviously I strayed from the guide to get myself to this point so I will accept my defeat :newbie:

Thank you for the quick reply :D

druuna 08-12-2012 03:07 AM

Quote:

Originally Posted by gibran (Post 4751933)
I went to far in the guide and had to backtrack to fix another error. At least thats what I believe made this happen...
At this point it would probably be easier to just start from the beginning. Obviously I strayed from the guide to get myself to this point so I will accept my defeat :newbie:

Thank you for the quick reply :D

If these are leftovers from previous attempts then you should start from scratch again (and make sure all lfs related is removed).

Can you put up the [SOLVED] tag if this is resolved.
first post -> Thread Tools -> Mark this thread as solved

Sarthak 09-25-2015 07:34 PM

i m also having an error in this
 
this is the output of the bash version-check.sh

Code:

sarthak@sarthak:~$ bash version-check.sh
bash, version 4.3.11(1)-release
/bin/sh -> /bin/bash
Binutils: (GNU Binutils) 2.25
bison (GNU Bison) 3.0.2
/usr/bin/yacc -> /usr/bin/bison.yacc
bzip2,  Version 1.0.6, 6-Sept-2010.
Coreutils:  8.21
diff (GNU diffutils) 3.3
find (GNU findutils) 4.4.2
GNU Awk 4.0.1
/usr/bin/awk -> /usr/bin/gawk
gcc (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4
g++ (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4
(Ubuntu EGLIBC 2.19-0ubuntu6.6) 2.19
grep (GNU grep) 2.16
gzip 1.6
Linux version 3.16.0-49-generic (buildd@lgw01-52) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) ) #65~14.04.1-Ubuntu SMP Wed Sep 9 10:03:23 UTC 2015
m4 (GNU M4) 1.4.17
GNU Make 3.81
GNU patch 2.7.1
Perl version='5.18.2';
sed (GNU sed) 4.2.2
tar (GNU tar) 1.27.1
makeinfo (GNU texinfo) 5.2
xz (XZ Utils) 5.1.0alpha
/usr/local/bin/ld: this linker was not configured to use sysroots
collect2: error: ld returned 1 exit status
g++ compilation failed

please help.. thankyou

ReaperX7 09-25-2015 09:05 PM

Install binutils.

Sarthak 09-26-2015 04:19 AM

Quote:

Install binutils.
what do you mean by this please explain as on my host system, binutils is installed and this is the command on 1.5.1 of the LFS 7.7.
thankyou

knudfl 09-26-2015 04:31 AM

Re #7.

? May be you didn't install a complete "binutils", but only the run time files ?

$ sudo apt-get install binutils-dev

Sarthak 09-26-2015 05:09 AM

after installing this there is no improvement
output remains the same

knudfl 09-26-2015 05:42 AM

Re #9.

Which output remains the same ?


Quote:

/usr/local/bin/ld: this linker was not configured to use sysroots
collect2: error: ld returned 1 exit status
g++ compilation failed
1) You are not supposed to have any "/usr/local/bin/ld". Please uninstall or hide away.
2) Install g++ : $ sudo apt-get install g++
.. And run ./version-check.sh
.. to check that things improved.

When everything is OK : Start from scratch with chapter 5.4, Binutils-2.25 - Pass 1


-

Sarthak 09-26-2015 06:31 AM

Quote:

1) You are not supposed to have any "/usr/local/bin/ld". Please uninstall or hide away.
can you please tell me how to hide it or uninstall it.

Quote:

2) Install g++ : $ sudo apt-get install g++
when i am doing this it is showing that g++ is already the newest version.

please help

Sarthak 09-26-2015 06:47 AM

thanks for every help you all have given to me
i found my answer and corrected it. now building it from scratch


All times are GMT -5. The time now is 07:32 AM.