dslm4515 / Musl-LFS

Linux From Scratch using Musl as Libc
GNU General Public License v3.0
167 stars 21 forks source link

[stable-5.00] step 11, toolchain kernel headers fails to install #6

Closed gottaeat closed 5 years ago

gottaeat commented 5 years ago

i've followed the build steps with extreme caution but i'm given this error at step 11:

[07:04] mlfs /mnt/mss/apathymusl/sources/files/linux-5.2.11: make mrproper
[07:04] mlfs /mnt/mss/apathymusl/sources/files/linux-5.2.11: MLFS_ARCH=${MLFS_CPU} make INSTALL_HDR_PATH=dest headers_install
  HOSTCC  scripts/basic/fixdep
scripts/basic/fixdep.c:97:10: fatal error: sys/types.h: No such file or directory
   97 | #include <sys/types.h>
      |          ^~~~~~~~~~~~~
compilation terminated.
make[1]: *** [scripts/Makefile.host:90: scripts/basic/fixdep] Error 1
make: *** [Makefile:504: scripts_basic] Error 2

can provide any extra details if desired.

gottaeat commented 5 years ago

following these steps from stable-4.0.0 fixes the problem:

make mrproper

PATH=/bin:/usr/bin:/cross-tools/bin:/tools/bin \
MLFS_ARCH=x86 make INSTALL_HDR_PATH=dest headers_install

find dest/include \( -name .install -o -name ..install.cmd \) -delete

cp -rv dest/include/* /tools/include
gottaeat commented 5 years ago

this time another header issue but with binutils pass 2 at step 14:

Making info in doc
make[3]: Entering directory '/mnt/mss/apathymusl/sources/files/binutils-2.32/build/bfd/doc'
gcc -o chw$$  \
    -I.. -I../../../bfd/doc/.. -I../../../bfd/doc/../../include -I../../../bfd/doc/../../intl -I../../intl ../../../bfd/doc/chew.c;
\
/bin/sh ../../../bfd/doc/../../move-if-change \
  chw$$ chew; \
touch chew.stamp
../../../bfd/doc/chew.c:85:10: fatal error: assert.h: No such file or directory
   85 | #include <assert.h>
      |          ^~~~~~~~~~
compilation terminated.
mv: cannot stat 'chw22032': No such file or directory
./chew -f ../../../bfd/doc/doc.str < ../../../bfd/doc/../aoutx.h >aoutx.tmp
/bin/sh: ./chew: No such file or directory
make[3]: *** [Makefile:952: aoutx.stamp] Error 127
make[3]: Leaving directory '/mnt/mss/apathymusl/sources/files/binutils-2.32/build/bfd/doc'
make[2]: *** [Makefile:1641: info-recursive] Error 1
make[2]: Leaving directory '/mnt/mss/apathymusl/sources/files/binutils-2.32/build/bfd'
make[1]: *** [Makefile:2691: all-bfd] Error 2
make[1]: Leaving directory '/mnt/mss/apathymusl/sources/files/binutils-2.32/build'
make: *** [Makefile:850: all] Error 2
[07:42] mlfs /mnt/mss/apathymusl/sources/files/binutils-2.32/build:
dslm4515 commented 5 years ago

I just uploaded comit 8a6713d6a4ae2db7fda798a608f2993985f08b05 that fixed a number of typos, including step 11. Correct command: ARCH=${MLFS_CPU} make INSTALL_HDR_PATH=dest headers_install with ${MLFS_CPU} set to x86 (x86_64 & i686) or arm for arm CPU's.

With the commit i just submitted, creating a GCC specs file for /cross-tools seems to fix that issue where in step 11 the $PATH has to be reversed.

stable-4.00 supposedly builds fine after the /tools tool-chain is properly built... I completed a build on a i686 machine (HP nc6400) that already uses musl. I did not realize stable-4.00 fails to build on non-musl hosts.

dslm4515 commented 5 years ago

Step 10 [TC: GCC Pass1] still requires a reversal of $PATH to complete build. I am still unsure why.

Also I noticed if binutils or GCC fails to build/install while building /tools, /tools has to be rebuilt after changes are made to build instructions. Don't forget to set the cross-compiling environment if logging out and loggin back in as mlfs user.

So far I got CT(/cross-tools) and TC(/tools) to build fine on an x86_64-glibc host (Toshiba m400) and a armv7l-glibc host (Odroid Xu4) using the latest commit.

gottaeat commented 5 years ago

looks like the last changes you've made fixed that problem but also introduced a new one:

 [07:11] mlfs /mnt/mlfs/sources/files/linux-5.2.11: ARCH=${MLFS_CPU} make INSTALL_HDR_PATH=dest head
 ers_install
 Makefile:649: arch/x86-64/Makefile: No such file or directory
 make: *** No rule to make target 'arch/x86-64/Makefile'.  Stop.
 [07:11] mlfs /mnt/mlfs/sources/files/linux-5.2.11: echo $MLFS_CPU
 x86-64

there's no x86_64 under arch/, resulting in this error. passing just x86 or not setting the ARCH variable fixes it and headers get installed to dist fine.

gottaeat commented 5 years ago

can confirm that with my 5th attempt at this in the last 2 months, i've managed to build the toolchain successfully. thanks for sharing your experiments. looking forward to the actual system build.