LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   libmpfr error in GCC compilation (LFS7.2) (https://www.linuxquestions.org/questions/linux-from-scratch-13/libmpfr-error-in-gcc-compilation-lfs7-2-a-4175436544/)

Prabhu.Are 11-10-2012 06:37 AM

libmpfr error in GCC compilation (LFS7.2)
 
Hi I'm following LFS7.2 in that I'm facing error with 5.5.1 Installation of cross GCC module

I successfully compiled Binutilities, then I untared the GCC. In GCC folder I done the following steps

tar -Jxf ../mpfr-3.1.1.tar.xz
mv -v mpfr-3.1.1 mpfr
tar -Jxf ../gmp-5.0.5.tar.xz
mv -v gmp-5.0.5 gmp
tar -zxf ../mpc-1.0.tar.gz
mv -v mpc-1.0 mpc

This

for file in \
$(find gcc/config -name linux64.h -o -name linux.h -o -name sysv4.h)
do
cp -uv $file{,.orig}
sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \
-e 's@/usr@/tools@g' $file.orig > $file
echo '
#undef STANDARD_STARTFILE_PREFIX_1
#undef STANDARD_STARTFILE_PREFIX_2
#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
#define STANDARD_STARTFILE_PREFIX_2 ""' >> $file
touch $file.orig
done


This

sed -i '/k prot/agcc_cv_libc_provides_ssp=yes' gcc/configure

this
mkdir -v ../gcc-build
cd ../gcc-build


and finally this


../gcc-4.7.1/configure \
--target=$LFS_TGT \
--prefix=/tools \
--with-sysroot=$LFS \
--with-newlib \
--without-headers \
--with-local-prefix=/tools \
--with-native-system-header-dir=/tools/include \
--disable-nls \
--disable-shared \
--disable-multilib \
--disable-decimal-float \
--disable-threads \
--disable-libmudflap \
--disable-libssp \
--disable-libgomp \
--disable-libquadmath \
--enable-languages=c \
--with-mpfr-include=$(pwd)/../gcc-4.7.1/mpfr/src \
--with-mpfr-lib=$(pwd)/mpfr/src/.libs



Now the final step is to compile GCC by make command, at this point of time it got compiled for 10 mins and then it was showing an error message that


checking for MPFR... no
configure: error: libmpfr not found or uses a different ABI (including static vs shared).
make[1]: *** [configure-mpc] Error 1
make[1]: Leaving directory `/mnt/test/sources/gcc-build'
make: *** [all] Error 2


You can see the whole compilation part in this link

http://pastebin.com/ahMmeTk8


please help me to resolve this error..

spiky0011 11-10-2012 06:42 AM

Hi

If you look in the gcc-4.7.1 dir you should have a dir mpfr gmp mpc ?

druuna 11-10-2012 06:59 AM

The only times I've seen this error is when the host used isn't compliant.

Can you post the output of the version-check.sh script?

Please put your output inside [code] ... [/code] tags it preserves all spacing. If you don't know how: LQ - BB Code List.

Prabhu.Are 11-10-2012 07:14 AM

Quote:

Originally Posted by spiky0011 (Post 4826444)
Hi

If you look in the gcc-4.7.1 dir you should have a dir mpfr gmp mpc ?



Thank yo for replying,

Yes all the three dir are located in gcc-4.7.1.

Prabhu.Are 11-10-2012 07:17 AM

Quote:

Originally Posted by druuna (Post 4826453)
The only times I've seen this error is when the host used isn't compliant.

Can you post the output of the version-check.sh script?

Please put your output inside [code] ... [/code] tags it preserves all spacing. If you don't know how: LQ - BB Code List.


Sure, my verson-check output is..

Code:

bash, version 4.1.5(1)-release
/bin/sh -> /bin/dash
Binutils: (GNU Binutils for Ubuntu) 2.20.51-system.20100908
bison (GNU Bison) 2.4.1
/usr/bin/yacc -> /usr/bin/bison.yacc
bzip2,  Version 1.0.5, 10-Dec-2007.
Coreutils:  8.5
diff (GNU diffutils) 3.0
find (GNU findutils) 4.4.2
GNU Awk 3.1.7
/usr/bin/awk -> /usr/bin/gawk
gcc (Ubuntu/Linaro 4.4.4-14ubuntu5.1) 4.4.5
(Ubuntu EGLIBC 2.12.1-0ubuntu6) 2.12.1
GNU grep 2.6.3
gzip 1.3.12
Linux version 2.6.35-22-generic (buildd@rothera) (gcc version 4.4.5 (Ubuntu/Linaro 4.4.4-14ubuntu4) ) #33-Ubuntu SMP Sun Sep 19 20:34:50 UTC 2010
m4 (GNU M4) 1.4.14
GNU Make 3.81
patch 2.6
Perl version='5.10.1';
GNU sed version 4.2.1
tar (GNU tar) 1.23
Texinfo: makeinfo (GNU texinfo) 4.13
xz (XZ Utils) 4.999.9beta
gcc compilation OK


spiky0011 11-10-2012 07:17 AM

Can you post the version check output as druuna ask for

Prabhu.Are 11-10-2012 07:19 AM

Quote:

Originally Posted by spiky0011 (Post 4826462)
Can you post the version check output as druuna ask for

Yes I just did it.

spiky0011 11-10-2012 07:19 AM

Hi

As normal druuna is right lol

you have /bin/sh -> /bin/dash it should point to /bin/sh -> /bin/bash

Prabhu.Are 11-10-2012 07:25 AM

Quote:

Originally Posted by spiky0011 (Post 4826466)
Hi

As normal druuna is right lol

you have /bin/sh -> /bin/dash it should point to /bin/sh -> /bin/bash


Could you please help me how to change it.

spiky0011 11-10-2012 07:27 AM

Code:

rm /bin/sh
Code:

ln -s /bin/bash /bin/sh

druuna 11-10-2012 07:34 AM

Quote:

Originally Posted by spiky0011 (Post 4826466)
As normal druuna is right lol

;)

Quote:

Originally Posted by Prabhu.Are (Post 4826465)
Yes I just did it.

As pointed out by spiky0011, you overlooked something important.

Be careful and precise, building an LFS based system and understanding how this is done is hard enough as-is if this is your first time and have (very?) limited linux experience.

Tip for when you finish chapter 5: Do make a back-up at that point (the Caution). This way you don't have to start from scratch when something goes wrong in chapter 6.

spiky0011 11-10-2012 07:37 AM

It might be a good idea if you started from the beginning again as well

jjsmithct 11-13-2012 08:23 AM

Hello. First post on this forum. I've been trying to work this out myself but am confused about what is doing what. I'm having the same issue, only I don't see issue with the versions of the packages on my host. Figured I'd post here as a reply instead of creating another thread on the same thing.

I'm working from SVN-20121103 version of the book - think that's 7.2? Doing LFS on VMware on an HP laptop. I had started with the livecd but scrapped that and my host is now slackware 14.

In section 5.5. GCC-4.7.2 - Pass 1.

make errs out with this...

Code:

libtool: install: warning: remember to run `libtool --finish /tools/libexec/gcc/i686-lfs-linux-gnu/4.7.2'
configure: WARNING: fixed-point is not supported for this target, ignored
Links are now set up to build a cross-compiler
 from i686-pc-linux-gnu to i686-lfs-linux-gnu.
configure: WARNING: using cross tools not prefixed with host triplet
configure: WARNING: cannot check for properly working vsnprintf when cross compiling, will assume it's ok
libtool: link: warning: library `/usr/lib/libmpfr.la' was moved.
/bin/sed: can't read /usr/lib/libgmp.la: No such file or directory
libtool: link: `/usr/lib/libgmp.la' is not a valid libtool archive
make[4]: *** [libmpc.la] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-mpc] Error 2
make: *** [all] Error 2

Cannot find libgmp.la anywhere on the system.

Here is output of my version-check.sh
Code:

root@lithium:~# ./version-check.sh
bash, version 4.2.37(2)-release
/bin/sh -> /bin/bash
Binutils: (Linux/GNU Binutils) 2.22.52.0.2.20120424
bison (GNU Bison) 2.5.1
/usr/bin/yacc -> /usr/bin/yacc
bzip2,  Version 1.0.6, 6-Sept-2010.
Coreutils:  8.19
diff (GNU diffutils) 3.2
find (GNU findutils) 4.4.2
GNU Awk 3.1.8
/usr/bin/awk -> /bin/gawk-3.1.8
gcc (GCC) 4.7.1
(GNU libc) 2.15
grep (GNU grep) 2.14
gzip 1.5
Linux version 3.2.29-smp (root@hive) (gcc version 4.7.1 (GCC) ) #2 SMP Mon Sep 17 13:16:43 CDT 2012
m4 (GNU M4) 1.4.16
GNU Make 3.82
GNU patch 2.7
Perl version='5.16.1';
GNU sed version 4.2.1
tar (GNU tar) 1.26
Texinfo: makeinfo (GNU texinfo) 4.13
xz (XZ Utils) 5.0.4
gcc compilation OK

I'm continuing to try to understand it myself, looking through output of make, google etc, but if anyone has suggestions, it will be appreciated.

Thanks - Jeff

spiky0011 11-13-2012 08:46 AM

Hi

The 3 files gmp mpfr mpc should be in surce dir
Untar gcc cd into gcc dir then run commands in book
From with in gcc dir

jjsmithct 11-13-2012 09:52 AM

Probably should have mentioned - I've done that - all three directories are there (renamed to gmp, mpfr, mpc) and followed all instructions in the book. I've done this a few times - wiping everything clean beforehand. Still getting this error.

It seems that libmpfr.la is being moved at some point in the process:
Code:

libtool: link: warning: library `/usr/lib/libmpfr.la' was moved.
, sed is looking for libgmp.la in /usr/lib and can't find it, then libtool is trying to link with it and doesn't report it as not found, but reports it as "not a valid libtool archive."

Actually, a little strange because I could have sworn I searched my whole box for "libgmp.la" and could not find it, but now:

Code:

lfs:/mnt/lfs/sources$ find . -name \*.la
./gcc-build/mpc/src/libmpc.la
./gcc-build/lto-plugin/.libs/liblto_plugin.la
./gcc-build/lto-plugin/liblto_plugin.la
./gcc-build/gmp/libgmp.la
./gcc-build/gmp/mpz/.libs/libmpz.la
./gcc-build/gmp/mpz/libmpz.la
./gcc-build/gmp/.libs/libgmp.la
./gcc-build/gmp/mpq/.libs/libmpq.la
./gcc-build/gmp/mpq/libmpq.la
./gcc-build/gmp/mpn/.libs/libmpn.la
./gcc-build/gmp/mpn/libmpn.la
./gcc-build/gmp/scanf/.libs/libscanf.la
./gcc-build/gmp/scanf/libscanf.la
./gcc-build/gmp/mpf/.libs/libmpf.la
./gcc-build/gmp/mpf/libmpf.la
./gcc-build/gmp/printf/.libs/libprintf.la
./gcc-build/gmp/printf/libprintf.la
./gcc-build/mpfr/src/.libs/libmpfr.la
./gcc-build/mpfr/src/libmpfr.la
./gcc-build/gcc/liblto_plugin.la

So it does exist - except where tools (libtool, sed) are looking for it is not correct: they are looking in /usr/lib. Guess I could just make symlinks in /usr/lib to get around this, although not sure this is the best solution?


All times are GMT -5. The time now is 09:34 PM.