今天遇到CFLAGS被改变导致编译出错的问题[已解决 原创] 但还有未理解的地方


//===================================================
$ emerge --info|grep FLAGS
CFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer"        <<<-----这里没有TAB
CXXFLAGS="-march=prescott        -O2 -pipe -fomit-frame-pointer"       <<<<=====竟然有个TAB
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS

$ grep FLAGS /etc/make.conf|grep -v "^#"
CFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"                 <<<<====================
LDFLAGS="-Wl,-O1 -Wl,--as-needed"

导致编译dev-util/insight 时发现CFLAGS出错的提示, CFLAGS被修改过,cd /var/tmp/portage/dev-util/insight-xxx/work/       && make  发现能编译通过,但emerge 就不行

//===================================================
########修改  CXXFLAGS 后
$ emerge --info|grep FLAGS
CFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS

$ grep FLAGS /etc/make.conf|grep -v "^#"
CFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"


http://gentoo-wiki.com/Safe_Cflags#Intel_Core_2_Duo.2FQuad_.2F_Xeon_51xx.2F53xx.2C_Pentium_Dual-Core_T23xx.2B.2FExxxx  按这里应该没问题,很多其他的包就没事

1: CXXFLAGS应该针对CPP的才对

[root@ibmgentoo temp] # pwd
/var/tmp/portage/dev-util/insight-6.7.1-r1/temp
[root@ibmgentoo temp] # ls
eclass-debug.log  environment  logging

[root@ibmgentoo temp] # grep march environment -n
7:CFLAGS=$'-march=prescott\t-O2 -pipe -fomit-frame-pointer'
15:CXXFLAGS=$'-march=prescott\t-O2 -pipe -fomit-frame-pointer'
2255:           replace-flags "-march=${1}" "-march=${newcpu}";
2338:           export ALLOWED_FLAGS="${ALLOWED_FLAGS} -O -O0 -O1 -O2 -mcpu -march -mtune";
3041:declare -x CFLAGS="-march=prescott       -O2 -pipe -fomit-frame-pointer"
3049:declare -x CXXFLAGS="-march=prescott       -O2 -pipe -fomit-frame-pointer"

打开 environment 第7行发现
CFLAGS=$'-march=prescott\t-O2 -pipe -fomit-frame-pointer'
为什么会有个 \t ? 难道就是这玩意在作怪? 不会是make.conf 里那行有tab没看到吧,:set list 查看未发现异常
重新设置为
CFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"          
再emerge --info 发现 CFLAGS和CXXFLAGS正常了

重新emerge -av dev-util/insight 安装成功

你可能感兴趣的:(#gentoo)