| Summary: | gcc-cross_4.9: do_compile failed occasionally while make enabled parallel | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Build System, Metadata & Runtime] OE-Core | Reporter: | Hongxu Jia <hongxu.jia> | ||||
| Component: | devtools / tool chain | Assignee: | Hongxu Jia <hongxu.jia> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | Medium | CC: | liezhi.yang, meta.mr.watcher, meta.watcher, sgw | ||||
| Version: | 1.7 | ||||||
| Target Milestone: | 1.7 M2 | ||||||
| Hardware: | x86 | ||||||
| OS: | Multiple | ||||||
| Whiteboard: | |||||||
| OS type for building Yocto: | --- | Type of Regression: | --- | ||||
| Verified: | Documentation change: | Don't know | |||||
| Attachments: |
|
||||||
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 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 :'. 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
Module: openembedded-core.git Branch: master Commit: aea4b2d58856226c471922dfa40650cba2f5a36a URL: http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=aea4b2d58856226c471922dfa40650cba2f5a36a |
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....