Re: copy lfs build to older CPU

"Xi Ruoyao" ([email protected] via lfs-support Mailing List) <[email protected]> Fri, 26 Sep 2025 23:13:18 +0800
Newsgroups gmane.linux.lfs.support
Message-ID <[email protected]>
On Fri, 2025-09-26 at 23:09 +0800, Xi Ruoyao wrote:

/* snip */

> Oh-oh.  I found something in MPFR:
> 
> configure:4602: checking for CC and CFLAGS in gmp.h
> configure:4635: result: CC=gcc CFLAGS=-O2 -fomit-frame-pointer -m64 -mtune=nehalem -march=nehalem
> 
> So the problem seems MPFR has inherited the -march= option used when GMP
> was built, thus MPFR itself can contain instructions that the target CPU
> does not support.
> 
> The book says:
> 
>    If you want to deploy the LFS system onto a system with a different
>    CPU, when you build Section 8.22, “GMP-6.3.0” and Section 8.51,
>    “Libffi-3.5.2” you must follow the notes about overriding the
>    architecture-specific optimization to produce libraries suitable for
>    both the host system and the system(s) where you'll deploy the LFS
>    system. Otherwise you'll get Illegal Instruction errors running LFS.
>    
> If you strictly follow it there won't be a problem: if you built GMP with -
> -host=none-linux-gnu in the first place, gmp.h would not contain -
> march=xxxx so MPFR will be built fine.
> 
> But if you've already finish the book, simply rebuilding GMP will not be
> enough.  You'll need to rebuild at least MPFR ("at least" because we don't
> know if there are more packages reading CFLAGS from gmp.h).

P.S. and simply making a DESTDIR installation of GMP would be also not
enough.  When you rebuild MPFR the gmp.h must be from the new GMP build
so the CFLAGS in gmp.h won't contain offending a -march= flag.


-- 
Xi Ruoyao <[email protected]>

-- 
http://lists.linuxfromscratch.org/sympa/info/lfs-support
Unsubscribe: See the above information page