Bug 5628 - Building libgcrypt failed if TMPDIR conatins '-O2' or '-Ofast'
Summary: Building libgcrypt failed if TMPDIR conatins '-O2' or '-Ofast'
Status: VERIFIED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: 1.5
Hardware: x86 Multiple
: Medium normal
Target Milestone: 1.6 M2
Assignee: Chen Qi
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2013-12-05 07:46 UTC by Chen Qi
Modified: 2014-01-15 09:33 UTC (History)
6 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chen Qi 2013-12-05 07:46:19 UTC
1. Error message (stripped for readability):

| i586-poky-linux-libtool: compile:  i586-poky-linux-gcc -m32 -march=i586 --sysroot=/home/chenqi/testdir/containing-O1-O1-O1-Os/sysroots/qemux86 -DHAVE_CONFIG_H -I. -I.. -I../src -I../src -I/home/chenqi/testdir/containing-O2-O1-O1-Os/sysroots/qemux86/usr/include -O2 -pipe -g -feliminate-unused-debug-types -fvisibility=hidden -Wall -c ./tiger.c  -fPIC -DPIC -o .libs/tiger.o
| ./tiger.c:24:19: fatal error: stdio.h: No such file or directory
|  #include <stdio.h>
|                    ^
| compilation terminated.
| make[2]: *** [tiger.lo] Error 1
| make[2]: *** Waiting for unfinished jobs....
| make[2]: Leaving directory `/home/chenqi/testdir/containing-O2-Ofast-O1-Os/work/i586-poky-linux/libgcrypt/1.5.3-r0/libgcrypt-1.5.3/cipher'

2. How to reproduce
set in local.conf:
TMPDIR = "/home/chenqi/testdir/containing-O2-Ofast-O1-Os"

3. Root cause
In cipher/Makefile.am, we have:

if ENABLE_O_FLAG_MUNGING
o_flag_munging = sed -e 's/-O\([2-9s][2-9s]*\)/-O1/' -e 's/-Ofast/-O1/g'
else
o_flag_munging = cat
endif


# We need to lower the optimization for this module.                                                                                                                                                            
tiger.o: $(srcdir)/tiger.c
        `echo $(COMPILE) -c $(srcdir)/tiger.c | $(o_flag_munging) `

tiger.lo: $(srcdir)/tiger.c
        `echo $(LTCOMPILE) -c $(srcdir)/tiger.c | $(o_flag_munging) `

The '-O2' is replaced by '-O1', thus this problem.
Comment 1 Chen Qi 2013-12-18 08:19:53 UTC
Module: openembedded-core.git
Branch: master-next
Commit: 84514834417e022660e7b3a540910d2d6fb12337
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=84514834417e022660e7b3a540910d2d6fb12337

//Chen Qi
Comment 2 Yi Zhao 2014-01-15 09:33:07 UTC
Verified with master/1b636173ca88e5ccca1992f9a12367a1189fa674

Steps:
1. Add the following line in conf/local.conf
    TMPDIR = "${TOPDIR}/containing-O2-Ofast-O1-Os"
2. bitbake libgcrypt

The package can be built out without errors.