Bug 6568 - gcc-cross_4.9: do_compile failed occasionally while make enabled parallel
Summary: gcc-cross_4.9: do_compile failed occasionally while make enabled parallel
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: devtools / tool chain (show other bugs)
Version: 1.7
Hardware: x86 Multiple
: Medium normal
Target Milestone: 1.7 M2
Assignee: Hongxu Jia
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2014-07-23 08:36 UTC by Hongxu Jia
Modified: 2014-08-04 02:26 UTC (History)
4 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Don't know


Attachments
do_compile failure (331.93 KB, application/octet-stream)
2014-07-23 08:36 UTC, Hongxu Jia
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hongxu Jia 2014-07-23 08:36:27 UTC
Created attachment 2053 [details]
do_compile failure

...
g++  -c   -isystem/home/nxadm/nx/pek-blade17.1/builds-2014-07-20-024149/qemuarma9_std_sdk/bitbake_build/tmp/sysroots/x86_64-linux/usr/include -O2 -pipe  -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE  -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wwrite-strings -Wcast-qual -Wmissing-format-attribute   -DHAVE_CONFIG_H -I. -I. -I/home/nxadm/nx/pek-blade17.1/builds-2014-07-20-024149/qemuarma9_std_sdk/bitbake_build/tmp/work-shared/gcc-4.9.0-r0/gcc-4.9.0/gcc -I/home/nxadm/nx/pek-blade17.1/builds-2014-07-20-024149/qemuarma9_std_sdk/bitbake_build/tmp/work-shared/gcc-4.9.0-r0/gcc-4.9.0/gcc/. -I/home/nxadm/nx/pek-blade17.1/builds-2014-07-20-024149/qemuarma9_std_sdk/bitbake_build/tmp/work-shared/gcc-4.9.0-r0/gcc-4.9.0/gcc/../include -I/home/nxadm/nx/pek-blade17.1/builds-2014-07-20-024149/qemuarma9_std_sdk/bitbake_build/tmp/work-shared/gcc-4.9.0-r0/gcc-4.9.0/gcc/../libcpp/include -I/home/nxadm/nx/pek-blade17.1/builds-2014-07-20-024149/qemuarma9_std_sdk/bitbake_build/tmp/sysroots/x86_64-linux/usr/include  -I/home/nxadm/nx/pek-blade17.1/builds-2014-07-20-024149/qemuarma9_std_sdk/bitbake_build/tmp/work-shared/gcc-4.9.0-r0/gcc-4.9.0/gcc/../libdecnumber -I/home/nxadm/nx/pek-blade17.1/builds-2014-07-20-024149/qemuarma9_std_sdk/bitbake_build/tmp/work-shared/gcc-4.9.0-r0/gcc-4.9.0/gcc/../libdecnumber/dpd -I../libdecnumber -I/home/nxadm/nx/pek-blade17.1/builds-2014-07-20-024149/qemuarma9_std_sdk/bitbake_build/tmp/work-shared/gcc-4.9.0-r0/gcc-4.9.0/gcc/../libbacktrace    -o errors.o -MT errors.o -MMD -MP -MF ./.deps/errors.TPo /home/nxadm/nx/pek-blade17.1/builds-2014-07-20-024149/qemuarma9_std_sdk/bitbake_build/tmp/work-shared/gcc-4.9.0-r0/gcc-4.9.0/gcc/errors.c
...
|tmp/work-shared/gcc-4.9.0-r0/gcc-4.9.0/gcc/system.h:506: error:
declaration of C function 'const char* strsignal(int)' conflicts\
with /usr/include/string.h:359: error: previous declaration 'char*
strsignal(int)' here
...
|tmp/work-shared/gcc-4.9.0-r0/gcc-4.9.0/gcc/hwint.h:342: error:
'CHAR_BIT' was not declared in this scope
...
|make[1]: *** [errors.o] Error 1
|make[1]: *** Waiting for unfinished jobs....
Comment 1 Hongxu Jia 2014-07-23 08:37:41 UTC
The errors.c requires config.h and auto-host.h, and gcc-nm.c
and errors.c were compiling at the same time.

Build Success:
config.h     Modify: 2014-07-21 11:49:07.121882182 +0800
auto-host.h  Modify: 2014-07-21 11:49:06.529882182 +0800
errors.o     Modify: 2014-07-21 11:49:08.905882181 +0800
gcc-nm.o     Modify: 2014-07-21 11:49:09.025882181 +0800

Build Failure (compile error.o failed):
config.h     Modify: 2014-07-20 03:40:40.000000000 +0800
auto-host.h  Modify: 2014-07-20 03:40:38.000000000 +0800
gcc-nm.o     Modify: 2014-07-20 03:40:40.000000000 +0800

It was the parallel building issue
Comment 2 Hongxu Jia 2014-07-23 08:38:42 UTC
In subdir 'gcc', Most C source files included config.h which was
generated by a rule. But no related prerequisites was added to
the C source compiling rule. There was potential building failure
while makefile enabled parallel.

The C source compiling rule used suffix rule '.c.o', but the suffix
rule doesn't support prerequisites.
https://www.gnu.org/software/make/manual/html_node/Suffix-Rules.html

We used the pattern rule '%.o : %.c' to instead, and add the config.h
as its prerequisite

We also moved the '%.o : %.c' rule down to the 'build/%.o :' rule, which
makes '%.o : %.c' rule doesn't override 'build/%.o :'.
Comment 3 Hongxu Jia 2014-07-24 01:50:50 UTC
Test Steps:

1. For reproducing the issue every time, manually modify
gcc/Makefile.in to delay the generation of config.h:
...
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index c4daf69..c502898 100644
--- gcc-4.9.0/gcc/Makefile.in
+++ gcc-4.9.0/gcc/Makefile.in
@@ -1622,9 +1622,12 @@ tm.h: cs-tm.h ; @true
 tm_p.h: cs-tm_p.h ; @true
 
 cs-config.h: Makefile
+   @echo "start to generate config.h `date`"
+   sleep 10
    TARGET_CPU_DEFAULT="" \
    HEADERS="$(host_xm_include_list)" DEFINES="$(host_xm_defines)" \
    $(SHELL) $(srcdir)/mkconfig.sh config.h
+   @echo "config.h generated `date`"
 
 cs-bconfig.h: Makefile
    TARGET_CPU_DEFAULT="" \
...

2. bitbake gcc-cross-arm

//Hongxu
Comment 4 Hongxu Jia 2014-08-04 02:26:02 UTC
Module: openembedded-core.git
Branch: master
Commit: aea4b2d58856226c471922dfa40650cba2f5a36a
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=aea4b2d58856226c471922dfa40650cba2f5a36a