Bug 3464

Summary: binutils-native-2.22-r17: do_compile failed on ubuntu 12.10
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Hongxu Jia <hongxu.jia>
Component: devtools / tool chainAssignee: Hongxu Jia <hongxu.jia>
Status: RESOLVED OBSOLETE QA Contact:
Severity: normal    
Priority: Medium CC: bogdan.a.marinescu, dvhart, liezhi.yang, meta.mr.watcher, meta.watcher, Qi.Chen, sgw, yi.zhao, zhenfeng.zhao
Version: 1.4   
Target Milestone: 1.4   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: ---
Attachments:
Description Flags
compile log none

Description Hongxu Jia 2012-11-20 02:20:46 UTC
Created attachment 943 [details]
compile log

Tree/Branch: Poky/Master
Poky Commit: 5a9b80bbb173408de779d74936a2f7050d6a6c19

1.Use "--enable-targets=all" option in binutils-native due to compile error. (The commit 5a9b80bbb173408de779d74936a2f7050d6a6c19); if the option is not used, all thing is ok.
2.The log shows that -Werror make all warning be treated as errors.
3.And "memset" in oasys.c:911 due to the warning

Log:(see attachment for detail)

bitbake binutils-native
...
| In file included from /usr/include/string.h:642:0,
|                  from /home/jiahongxu/yocto/build-20121119/tmp/work/x86_64-linux/binutils-native-2.22-r17/binutils-2.22/bfd/sysdep.h:44,
|                  from /home/jiahongxu/yocto/build-20121119/tmp/work/x86_64-linux/binutils-native-2.22-r17/binutils-2.22/bfd/oasys.c:25:
| In function 'memset',
|     inlined from 'oasys_write_object_contents' at /home/jiahongxu/yocto/build-20121119/tmp/work/x86_64-linux/binutils-native-2.22-r17/binutils-2.22/bfd/oasys.c:911:3:
| /usr/include/x86_64-linux-gnu/bits/string3.h:82:30: error: call to '__warn_memset_zero_len' declared with attribute warning: memset used with constant zero length parameter; this could be due to transposed parameters [-Werror]
| cc1: all warnings being treated as errors
| make[4]: *** [oasys.lo] Error 1

...
Comment 1 Hongxu Jia 2012-11-20 06:27:24 UTC
*Analysis
When using "--enable-targets=all", oasys.c included in "$all_backends" is compiled, and with option "-Werror", warning in oasys.c is treated as error.

*Resolution

1. Modify oasys.c:911 to remove warning:

-(void) memset (r.module_name + length, ' ', sizeof (r.module_name) - length);
+if (sizeof (r.module_name) > length)
+  (void) memset (r.module_name + length, ' ', sizeof (r.module_name) - length);


Or 2. Modify binutils_2.22.bb to ignore warning

Append option "--disable-werror" to EXTRA_OECONF_class-native in binutils_2.22.bb could ignore warning

-EXTRA_OECONF_class-native = "--enable-targets=all --enable-64-bit-bfd --enable-install-libbfd"
+EXTRA_OECONF_class-native = "--enable-targets=all --enable-64-bit-bfd --enable-install-libbfd --disable-werror"
Comment 2 Hongxu Jia 2012-12-03 07:14:03 UTC
Binutils has been updated to 2.23, and this bug has already fixed since there.