From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Warren Date: Tue, 31 Mar 2015 09:45:54 -0600 Subject: [U-Boot] [PATCH] kbuild: move ARCH, CPU, etc. to top Makefile to fix random build error In-Reply-To: <1427803341-28286-1-git-send-email-yamada.masahiro@socionext.com> References: <1427803341-28286-1-git-send-email-yamada.masahiro@socionext.com> Message-ID: <551AC132.3030509@wwwdotorg.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 03/31/2015 06:02 AM, Masahiro Yamada wrote: > Since the Kconfig conversion, some developers have reported that > Kbuild sometimes fails completely at random. According to the error > reports, it seems to occur for any target board, but only on very > fast computers. > > The log message for the fail case is like this: > > make[1]: *** No rule to make target `../arch//cpu/u-boot.lds', > needed by `u-boot.lds'. Stop. > > It looks like the top config.mk has not been included for *some* > reason, and $(ARCH) has been left blank. > > I suspect "autoconf_is_current" is not working in some situation. > > This commit moves the definition of ARCH, CPU, SOC, etc. to the > top Makefile, so they are surely set. This doesn't solve the issue for me, although it improves the chance of success and changes the error I get. With and without this patch, I ran: CROSS_COMPILE=arm-linux-gnueabi- ./MAKEALL rpi_2 ... until whichever of success/fail had the fewest "hits" had at least 5 "hits". Without this patch, the build failed 6 out of 11 runs with: ====================================================================== boards.cfg is up to date. Nothing to do. Building rpi_2 board... arm-linux-gnueabi-size: './u-boot': No such file make: *** No rule to make target `arch//cpu/u-boot.lds', needed by `u-boot.lds'. Stop. make: *** Waiting for unfinished jobs.... --------------------- SUMMARY ---------------------------- Boards compiled: 1 Boards with warnings but no errors: 1 ( rpi_2 ) ---------------------------------------------------------- ====================================================================== With this patch, the build failed 5 out of 28 runs with: ====================================================================== boards.cfg is up to date. Nothing to do. Building rpi_2 board... arm-linux-gnueabi-size: './u-boot': No such file make: *** [prepare1] Error 1 Your architecture does not support generic board. Please undefine CONFIG_SYS_GENERIC_BOARD in your board config file. make: *** [prepare1] Error 1 --------------------- SUMMARY ---------------------------- Boards compiled: 1 Boards with errors: 1 ( rpi_2 ) ---------------------------------------------------------- ====================================================================== This feels more like a missing dependency or similar timing issue than an issue with the order of variable setup in the makefile. I tried to repro this on a couple of VM services (Linode 8192, and EC2 c3.2xlarge) with the idea you could debug on those systems, but could not repro on those. Unfortunately the machine I have which repros the issue is on my work network, so I can't give you access. One comment on the patch below: > diff --git a/Makefile b/Makefile > +ARCH = $(CONFIG_SYS_ARCH:"%"=%) > +CPU = $(CONFIG_SYS_CPU:"%"=%) > +SOC = $(CONFIG_SYS_SOC:"%"=%) > +VENDOR = $(CONFIG_SYS_VENDOR:"%"=%) > +BOARD = $(CONFIG_SYS_BOARD:"%"=%) > +CPUDIR = arch/$(ARCH)/cpu$(if $(CPU),/$(CPU),) > +BOARDDIR = $(if $(BOARD),$(if $(VENDOR),$(VENDOR)/)$(BOARD)) > diff --git a/scripts/Makefile.autoconf b/scripts/Makefile.autoconf > +ARCH = $(CONFIG_SYS_ARCH:"%"=%) > +CPU = $(CONFIG_SYS_CPU:"%"=%) > +SOC = $(CONFIG_SYS_SOC:"%"=%) > +VENDOR = $(CONFIG_SYS_VENDOR:"%"=%) > +BOARD = $(CONFIG_SYS_BOARD:"%"=%) > +CPUDIR = arch/$(ARCH)/cpu$(if $(CPU),/$(CPU),) > +BOARDDIR = $(if $(BOARD),$(if $(VENDOR),$(VENDOR))) Duplicating that doesn't seem like a good idea. Could it at least be included from a shared foo.mk file?