LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   Why is the "--with-mpfr-include" flag used in CLFS necessary? (https://www.linuxquestions.org/questions/linux-from-scratch-13/why-is-the-with-mpfr-include-flag-used-in-clfs-necessary-4175644425/)

Unturned3 12-17-2018 01:31 AM

Why is the "--with-mpfr-include" flag used in CLFS necessary?
 
Hello,
I've read both of the LFS and CLFS books and I have a question regarding the different procedures used in the two books when building the GCC compiler.

In the both the LFS & CLFS books, the "mpfr", "gmp", and "mpc" packages are extracted into the GCC source directory. However, the CLFS book specifies the "--with-mpfr-include=$(pwd)/../gcc-x.y.z/mpfr/src" option when configuring GCC, while the LFS book didn't use this option at all. Why is this option necessary? I thought that the GCC build system will automatically build gmp, mpfr, and mpc if they are present inside the source directory. And, if for some reason the location of mpfr needs to be specified manually in CLFS, why is there no need to specify the location of mpc and gmp?

Thanks!

business_kid 12-18-2018 06:41 AM

They put a lot of work into CLFS to get it going and have the procedure down fairly well. The book usually explains the options in detail. What does the explanation say?

CLFS is radically different because LFS can rely on your local stuff in /usr/include, /usr/lib, etc. CLFS is different because /usr/include and /usr/lib are hostile territory, and you have to exclude them at any cost. Think of the situation where you're using an (x86-64) gcc-arm and compiling for arm64. Very different machines that have to be totally separate. They've probably learned the hard way. Disobey them, and you can learn the hard way too :scratch:

knudfl 12-18-2018 11:27 AM

The last gcc requiring "--with-mpfr-include" was gcc-4.8.4
... Your question doesn't specify gcc version.

gcc configure, overview https://drive.google.com/drive/folde...nO?usp=sharing

Unturned3 12-18-2018 10:13 PM

Hello,
Regarding the "--with-mpfr-include" option, the CLFS book just said that it "Tells configure how to find the mpfr headers". I'm using the CLFS book from here. In the book they are using GCC-6.2.0
I mean, if the mpfr paths were explicitly specified to avoid contamination from the host, then shouldn't the paths to mpc and gmp be specified as well?

Thanks for the help!

business_kid 12-19-2018 04:44 AM

That is a generic book. You no doubt have seen the abbreviation FBBG. It means "Follow Book, Book Good." Your build is raising questions in your head. That's good. The time to post here is when you follow the book and it doesn't work. It prtobably hasd to do with what they're installing, as the source will get deleted later.

Unturned3 12-19-2018 08:11 AM

Ok thanks. I have a few other questions related to the general build process of LFS. Should I post them in this forum? They aren't related to any specific problems that I encountered while following the book, just about how the build process works.

Unturned3 12-19-2018 08:17 AM

Ok thanks. I have a few other questions related to the general build process of LFS. Should I post them in this forum? They aren't related to any specific problems that I encountered while following the book, just about how the build process works.

hazel 12-19-2018 11:29 AM

Quote:

Originally Posted by Unturned3 (Post 5939007)
Ok thanks. I have a few other questions related to the general build process of LFS. Should I post them in this forum? They aren't related to any specific problems that I encountered while following the book, just about how the build process works.

Fire away.

Unturned3 12-19-2018 07:01 PM

@hazel Thanks!
I found some information from https://gcc.gnu.org/install/configure.html and here's what it says:
Quote:

--with-gmp=pathname
--with-gmp-include=pathname
--with-gmp-lib=pathname
--with-mpfr=pathname
--with-mpfr-include=pathname
--with-mpfr-lib=pathname
--with-mpc=pathname
--with-mpc-include=pathname
--with-mpc-lib=pathname

If you want to build GCC but do not have the GMP library, the MPFR library and/or the MPC library installed in a standard location and do not have their sources present in the GCC source tree then you can explicitly specify the directory where they are installed (‘--with-gmp=gmpinstalldir’, ‘--with-mpfr=mpfrinstalldir’, ‘--with-mpc=mpcinstalldir’). The --with-gmp=gmpinstalldir option is shorthand for --with-gmp-lib=gmpinstalldir/lib and --with-gmp-include=gmpinstalldir/include. Likewise the --with-mpfr=mpfrinstalldir option is shorthand for --with-mpfr-lib=mpfrinstalldir/lib and --with-mpfr-include=mpfrinstalldir/include, also the --with-mpc=mpcinstalldir option is shorthand for --with-mpc-lib=mpcinstalldir/lib and --with-mpc-include=mpcinstalldir/include. If these shorthand assumptions are not correct, you can use the explicit include and lib options directly. You might also need to ensure the shared libraries can be found by the dynamic linker when building and using GCC, for example by setting the runtime shared library path variable (LD_LIBRARY_PATH on GNU/Linux and Solaris systems).

These flags are applicable to the host platform only. When building a cross compiler, they will not be used to configure target libraries.
Since the CLFS/LFS books unpacked the mpfr/mpc/gmp packages into GCC's source tree, I guess that we can say the "--with-mpfr-include" flags used in the CLFS book isn't strictly needed? What's your view on this?


All times are GMT -5. The time now is 01:38 PM.