opencomputeproject / onie

Open Network Install Environment
https://opencomputeproject.github.io/onie
Other
606 stars 377 forks source link

/home/build/src/onie/build/crosstool-ng/crosstool-ng-1.24.0/ct-ng:261: recipe for target 'build' failed #972

Closed squeeb closed 3 years ago

squeeb commented 3 years ago

When building the all target for MACHINE=kvm_x86_64 within the dockerised Debian build environment, the build eventually fails with the following errors:

[INFO ]  =================================================================
[INFO ]  Installing C library headers & start files
[INFO ]    =================================================================
[INFO ]    Building for multilib 1/1: ''
[ERROR]      make[3]: *** [Makefile.in:164: ../..//extra/locale/c8tables.h] Error 1
[ERROR]      make[2]: *** [Makefile.in:185: headers] Error 2
[ERROR]
[ERROR]  >>
[ERROR]  >>  Build failed in step 'Building for multilib 1/1: '''
[ERROR]  >>        called in step 'Installing C library headers & start files'
[ERROR]  >>        called in step '(top-level)'
[ERROR]  >>
[ERROR]  >>  Error happened in: CT_DoExecLog[scripts/functions@376]
[ERROR]  >>        called from: uClibc_backend_once[scripts/build/libc/uClibc.sh@141]
[ERROR]  >>        called from: CT_IterateMultilibs[scripts/functions@1586]
[ERROR]  >>        called from: uClibc_backend[scripts/build/libc/uClibc.sh@36]
[ERROR]  >>        called from: uClibc_start_files[scripts/build/libc/uClibc.sh@10]
[ERROR]  >>        called from: do_libc_start_files[scripts/build/libc.sh@28]
[ERROR]  >>        called from: main[scripts/crosstool-NG.sh@696]
[ERROR]  >>
[ERROR]  >>  For more info on this error, look at the file: 'build.log'
[ERROR]  >>  There is a list of known issues, some with workarounds, in:
[ERROR]  >>      '/home/build/src/onie/build/crosstool-ng/crosstool-ng-1.24.0/docs/manual/B_Known_issues.md'
[ERROR]  >>
[ERROR]  >> NOTE: You configuration uses non-default patch sets. Please
[ERROR]  >> select 'bundled' as the set of patches applied and attempt
[ERROR]  >> to reproduce this issue. Issues reported with other patch
[ERROR]  >> set selections (none, local, bundled+local) are going to be
[ERROR]  >> closed without explanation.
[ERROR]  >>
[ERROR]  >>  If you feel this is a bug in crosstool-NG, report it at:
[ERROR]  >>      https://github.com/crosstool-ng/crosstool-ng/issues/
[ERROR]  >>
[ERROR]  >>  Make sure your report includes all the information pertinent to this issue.
[ERROR]  >>  Read the bug reporting guidelines here:
[ERROR]  >>      http://crosstool-ng.github.io/support/
[ERROR]
[ERROR]  (elapsed: 102:59.11)
/home/build/src/onie/build/crosstool-ng/crosstool-ng-1.24.0/ct-ng:261: recipe for target 'build' failed
make[1]: *** [build] Error 2
make[1]: Leaving directory '/home/build/src/onie/build/x-tools/x86_64-g8.3.0-lnx5.4.86-uClibc-ng-1.0.38/build'
rm: cannot remove '/home/build/src/onie/build/x-tools/x86_64-g8.3.0-lnx5.4.86-uClibc-ng-1.0.38/build/.config.2': No such file or directory
make/xtools.make:144: recipe for target '/home/build/src/onie/build/x-tools/x86_64-g8.3.0-lnx5.4.86-uClibc-ng-1.0.38/stamp/xtools-build' failed
make: *** [/home/build/src/onie/build/x-tools/x86_64-g8.3.0-lnx5.4.86-uClibc-ng-1.0.38/stamp/xtools-build] Error 1
build@051c405135d4:~/src/onie/build-config$

The command used to build was:

make -j MACHINE=kvm_x86_64 all

The container is running in Docker Desktop for macOS and the Docker VM has 24 CPU threads, 16GB of memory and 32GB of storage assigned to it.

The container has an APFS case-sensitive dedicated hard drive bind mounted to /home/build/src as I found that trying to build with a case-insensitive filesystem resulted in errors.

This appears to be localised to crosstool-NG, or maybe the xtools build although it is unclear why.

Running the make target for xtools completes successfully:

build@051c405135d4:~/src/onie/build-config$ make -j MACHINE=kvm_x86_64 xtools
====  Building xtools for x86_64-g8.3.0-lnx5.4.86-uClibc-ng-1.0.38 in /home/build/src/onie/build/x-tools/x86_64-g8.3.0-lnx5.4.86-uClibc-ng-1.0.38/build ====
make[1]: Entering directory '/home/build/src/onie/build/x-tools/x86_64-g8.3.0-lnx5.4.86-uClibc-ng-1.0.38/build'
make[1]: 'build' is up to date.
make[1]: Leaving directory '/home/build/src/onie/build/x-tools/x86_64-g8.3.0-lnx5.4.86-uClibc-ng-1.0.38/build'

Running the all build a second time fails for a new reason:

build@051c405135d4:~/src/onie/build-config$ make -j MACHINE=kvm_x86_64 all
==== Building cross linux ====
==== Preparing a new development sysroot ====
bash: /home/build/src/onie/build/x-tools/x86_64-g8.3.0-lnx5.4.86-uClibc-ng-1.0.38/install/x86_64-onie-linux-uclibc/bin/x86_64-onie-linux-uclibc-gcc: No such file or directory
cp: missing destination file operand after '/home/build/src/onie/build/user/x86_64-g8.3.0-lnx5.4.86-uClibc-ng-1.0.38/dev-sysroot'
Try 'cp --help' for more information.
make/sysroot.make:70: recipe for target '/home/build/src/onie/build/user/x86_64-g8.3.0-lnx5.4.86-uClibc-ng-1.0.38/stamp/dev-sysroot-init' failed
make: *** [/home/build/src/onie/build/user/x86_64-g8.3.0-lnx5.4.86-uClibc-ng-1.0.38/stamp/dev-sysroot-init] Error 1
make: *** Waiting for unfinished jobs....
make[1]: Entering directory '/home/build/src/onie/build/kvm_x86_64-r0/kernel/linux-5.4.86'
Makefile:632: include/config/auto.conf: No such file or directory
Makefile:678: include/config/auto.conf.cmd: No such file or directory
make[1]: x86_64-onie-linux-uclibc-gcc: Command not found
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/confdata.o
  HOSTCC  scripts/kconfig/expr.o
  LEX     scripts/kconfig/lexer.lex.c
  YACC    scripts/kconfig/parser.tab.[ch]
  HOSTCC  scripts/kconfig/preprocess.o
  HOSTCC  scripts/kconfig/symbol.o
  HOSTCC  scripts/kconfig/lexer.lex.o
  HOSTCC  scripts/kconfig/parser.tab.o
  HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf  --syncconfig Kconfig
scripts/Kconfig.include:35: compiler 'x86_64-onie-linux-uclibc-gcc' not found
scripts/kconfig/Makefile:73: recipe for target 'syncconfig' failed
make[3]: *** [syncconfig] Error 1
Makefile:590: recipe for target 'syncconfig' failed
make[2]: *** [syncconfig] Error 2
Makefile:696: recipe for target 'include/config/auto.conf.cmd' failed
make[1]: *** [include/config/auto.conf.cmd] Error 2
make[1]: Leaving directory '/home/build/src/onie/build/kvm_x86_64-r0/kernel/linux-5.4.86'
make/kernel.make:114: recipe for target '/home/build/src/onie/build/kvm_x86_64-r0/stamp/kernel-build' failed
make: *** [/home/build/src/onie/build/kvm_x86_64-r0/stamp/kernel-build] Error 2

Any help on this would be great. Not sure if my build environment isn't correct, but seeing how it's containerized and the container is from the supplied Dockerfile, this leads me to believe that there may be something wrong with the build itself.

ehdoyle commented 3 years ago

Hi first off, I definitely need to update the documentation, as what I'm about to suggest should definitely be front and center and people are getting burned on this when it could be avoided. Second - thanks for taking the time to provide a bunch of context with the bug report. Now looking at this, a couple of things come to mind: Try building off the 2021.08br branch - the version of KVM there will build in a Debian 9 Dedicated User Environment container. If you're looking for the latest KVM build with Secure boot and the emulation tools ( see the git commit history for some useful information on that) you'll want a Debian 10 Dedicated User Environment container - that definitely works. The DUE link has information about creating the containers. They should be the same as the ones I use for development and releases. ( this is not entirely flawless, as people have had issues with firewalls, or building on filesystems that the host remote mounts, but we can burn that bridge when we come to it...) I'd also suggest a 'make distclean' to remove any partially built targets. ONIE is pretty clean about recognizing partially built code, but not every component it builds does.

Also see This bug which may be related/helpful Let me know if any of the above helps...

squeeb commented 3 years ago

Interesting, I wasn't aware of DUE. I was being lazy and just used the build environment in contrib/build-env to build the container and build inside.

I ended up building 2021.05 and limiting make to a single job using -j1.

It took eons to complete but eventually spat out an image for KVM.

Thanks for the info. I'll go and figure out DUE and have a go at the bleeding edge KVM build.

ehdoyle commented 3 years ago

Cool - glad you got it to work. -j4 should work with the 2021.05 build, but I understand the importance of getting a build to work with no competing build targets to establish a functional baseline. Getting the documentation updated is definitely the next priority, If everything is OK, I can close this out, or leave it open for a bit in case there are additonal issues. Thoughts?

squeeb commented 3 years ago

Happy to close. Thanks for your help! :)

tchandramohan commented 2 years ago

Also, check out this FIX https://github.com/opencomputeproject/onie/issues/1012 if you encounter the same problem