Article 55MCP LFS Systemd Raspberry Pi with GCC-10.1.0 and Glibc-2.31

LFS Systemd Raspberry Pi with GCC-10.1.0 and Glibc-2.31

by
Jon Wilder
from LinuxQuestions.org on (#55MCP)
I'm doing an LFS build with Binutils-2.34, GCC-10.1.0, and Glibc-2.31 on a Raspberry Pi 3B. My target triplet for the cross build is armv7l-lfs-linux-gnueabihf.

There is a required patch to math.h in the glibc package which I found the text for on another mailing list. I was able to successfully create the patch file and patch math.h.

Here's the interesting bit. I made a bash script that does the entire build of the cross toolchain from Binutils to Libstdc++-v3. When I run the script, it performs the entire cross build perfectly with no errors. From there I can build the rest of it by hand.

However, if I try to do everything by hand (and no I'm not mistyping anything), Glibc fails with a segmentation fault every time.

Below you will find my Bash script. You'll notice that Glibc and Libstdc++-v3 get installed into /usr. This is NOT the host system's /usr directory. This is a new build process used in the development version of Systemd LFS where you precreate the LFS system files /bin, /etc, /lib, /sbin, /usr, and /var and there is no /tools symlink (the $LFS/tools directory does exist and both cross Binutils and cross GCC install into it...just no symlink to it). On these packages, you issue make DESTDIR=$LFS install. This prepends the LFS root to /usr and thus installs it into the precreated $LFS/usr directory.

The failure happens whenever I issue the very same commands in the script by hand, but will build perfectly if you run it by issuing bash systemd-ch5-build.sh.

Any ideas?

Code:# Begin systemd-ch5-build.sh

PARALLEL_JOBS=4
RPI_MODEL=3

echo "5.2 Binutils-2.34 Pass 1"
tar -Jxf binutils-2.34.tar.xz
cd binutils-2.34
mkdir -v build
cd build
../configure --prefix=$LFS/tools \
--with-sysroot=$LFS \
--target=$LFS_TGT \
--disable-nls \
--disable-werror
make -j $PARALLEL_JOBS
make install
cd $LFS/sources
rm -rf binutils-2.34

echo "5.3 GCC-10.1.0 - Pass 1"
tar -Jxf gcc-10.1.0.tar.xz
cd gcc-10.1.0
tar -xf ../mpfr-4.0.2.tar.xz
mv -v mpfr-4.0.2 mpfr
tar -xf ../gmp-6.2.0.tar.xz
mv -v gmp-6.2.0 gmp
tar -xf ../mpc-1.1.0.tar.gz
mv -v mpc-1.1.0 mpc
mkdir -v build
cd build
../configure \
--target=$LFS_TGT \
--prefix=$LFS/tools \
--with-glibc-version=2.11 \
--with-sysroot=$LFS \
--with-newlib \
--without-headers \
--enable-initfini-array \
--disable-nls \
--disable-shared \
--disable-multilib \
--disable-decimal-float \
--disable-threads \
--disable-libatomic \
--disable-libgomp \
--disable-libquadmath \
--disable-libssp \
--disable-libvtv \
--disable-libstdcxx \
--enable-languages=c,c++
make
make install
cd ..
cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \
`dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/install-tools/include/limits.h
cd $LFS/sources
rm -rf gcc-10.1.0

echo "5.4 Raspberry Pi Linux API Headers"
tar -zxf rpi-4.19.y.tar.gz
cd linux-rpi-4.19.y
make mrproper
make headers_install
find usr/include -name '.*' -delete
rm usr/include/Makefile
cp -rv usr/include $LFS/usr
cd $LFS/sources

echo "5.5 Glibc-2.31"
tar -Jxf glibc-2.31.tar.xz
cd glibc-2.31
patch -Np1 -i ../glibc-2.31-math-Makefile-1.patch
patch -Np1 -i ../glibc-2.31-fhs-1.patch
mkdir -v build
cd build
../configure \
--prefix=/usr \
--host=$LFS_TGT \
--build=$(../scripts/config.guess) \
--enable-kernel=3.2 \
--with-headers=$LFS/usr/include \
libc_cv_slibdir=/lib
make -j $PARALLEL_JOBS
make DESTDIR=$LFS install
# Compatibility symlink for non ld-linux-armhf awareness
ln -sv ld-2.31.so $LFS/tools/lib/ld-linux.so.3
$LFS/tools/libexec/gcc/$LFS_TGT/10.1.0/install-tools/mkheaders
cd $LFS/sources
rm -rf glibc-2.31

echo "5.6 Libstdc++ from GCC-10.1.0, Pass 1"
tar -Jxf gcc-10.1.0.tar.xz
cd gcc-10.1.0
mkdir -v build
cd build
../libstdc++-v3/configure \
--host=$LFS_TGT \
--build=$(../config.guess) \
--prefix=/usr \
--disable-multilib \
--disable-nls \
--disable-libstdcxx-pch \
--with-gxx-include-dir=/tools/$LFS_TGT/include/c++/10.1.0
make -j $PARALLEL_JOBS
make DESTDIR=$LFS install
cd $LFS/sources
rm -rf gcc-10.1.0

echo "Chapter 5 Build Complete"latest?d=yIl2AUoC8zA latest?i=qP5B4Ca1pFg:9dwAqIZ0JjI:F7zBnMy latest?i=qP5B4Ca1pFg:9dwAqIZ0JjI:V_sGLiP latest?d=qj6IDK7rITs latest?i=qP5B4Ca1pFg:9dwAqIZ0JjI:gIN9vFwqP5B4Ca1pFg
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments