jiangtao9999 发表于 2009-4-27 18:11:30

mips64el编译gcc4.4的怪异问题……

RPM_OPT_FLAGS=" -O0 -g "
CC=gcc
OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/\(-Wp,\)\?-D_FORTIFY_SOURCE=//g'`
OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-m64//g;s/-m32//g;s/-m31//g'`
OPT_FLAGS=`echo "$OPT_FLAGS" | sed -e 's/[[:blank:]]\+/ /g'`
case "$OPT_FLAGS" in
*-fasynchronous-unwind-tables*)
    sed -i -e 's/-fno-exceptions /-fno-exceptions -fno-asynchronous-unwind-tables/' \
      ../gcc/Makefile.in
    ;;
esac
CC="$CC" CFLAGS="$OPT_FLAGS" CXXFLAGS="`echo $OPT_FLAGS | sed 's/ -Wall / /g'`" XCFLAGS="$OPT_FLAGS" TCFLAGS="$OPT_FLAGS" \
      GCJFLAGS="$OPT_FLAGS" \
      ../configure --prefix=%{_prefix} --mandir=%{_mandir} --infodir=%{_infodir} \
      --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap \
      --enable-shared --enable-threads=posix --enable-checking=release \
      --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions \
      --enable-languages=c,c++,objc,obj-c++ \
      --disable-libgcj --enable-c99 --enable-long-long --with-abi=64 \
      --enable-clocale=gnu --disable-libstdcxx-pch --disable-multilib

make BOOT_CFLAGS="$OPT_FLAGS" bootstrap -j1这里的 RPM_OPT_FLAGS=" -O0 -g " 如果等于 -O2 -g
会出现config.status: creating config.h
config.status: executing default commands
make: Entering directory `/usr/src/redhat/BUILD/gcc-4.4.0/obj-mips64el-unknown-linux-gnu/build-mips64el-unknown-linux-gnu/libiberty'
if [ x"" != x ] && [ ! -d pic ]; then \
          mkdir pic; \
      else true; fi
touch stamp-picdir
if [ x"" != x ]; then \
          gcc -c -DHAVE_CONFIG_H -O2 -g-I. -I../../../libiberty/../include-W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -pedantic   ../../../libiberty/regex.c -o pic/regex.o; \
      else true; fi
gcc -c -DHAVE_CONFIG_H -O2 -g-I. -I../../../libiberty/../include-W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -pedantic../../../libiberty/regex.c -o regex.o
../../../libiberty/regex.c:130: warning: function declaration isn't a prototype
../../../libiberty/regex.c:130: warning: conflicting types for built-in function 'malloc'
../../../libiberty/regex.c:131: warning: function declaration isn't a prototype
../../../libiberty/regex.c:131: warning: conflicting types for built-in function 'realloc'
In file included from /usr/include/bits/string2.h:1299,
               from /usr/include/string.h:423,
               from ../../../libiberty/regex.c:149:
/usr/include/stdlib.h:471: error: conflicting types for 'malloc'
../../../libiberty/regex.c:130: note: previous declaration of 'malloc' was here
In file included from ../../../libiberty/regex.c:638:
../../../libiberty/regex.c: In function 'byte_regex_compile':
../../../libiberty/regex.c:2439: warning: implicit declaration of function 'free'
../../../libiberty/regex.c:2439: warning: incompatible implicit declaration of built-in function 'free'
../../../libiberty/regex.c:2500: warning: incompatible implicit declaration of built-in function 'free'
../../../libiberty/regex.c:2533: warning: incompatible implicit declaration of built-in function 'free'
../../../libiberty/regex.c:2640: warning: incompatible implicit declaration of built-in function 'free'
../../../libiberty/regex.c:3643: warning: incompatible implicit declaration of built-in function 'free'
../../../libiberty/regex.c:4150: warning: incompatible implicit declaration of built-in function 'free'
../../../libiberty/regex.c: In function 'byte_re_compile_fastmap':
../../../libiberty/regex.c:4835: warning: implicit declaration of function 'abort'
../../../libiberty/regex.c:4835: warning: incompatible implicit declaration of built-in function 'abort'
../../../libiberty/regex.c: In function 'byte_re_match_2_internal':
../../../libiberty/regex.c:7421: warning: incompatible implicit declaration of built-in function 'abort'
../../../libiberty/regex.c: In function 'xregcomp':
../../../libiberty/regex.c:7975: warning: incompatible implicit declaration of built-in function 'free'
../../../libiberty/regex.c: In function 'xregexec':
../../../libiberty/regex.c:8050: warning: incompatible implicit declaration of built-in function 'free'
../../../libiberty/regex.c: In function 'xregerror':
../../../libiberty/regex.c:8078: warning: incompatible implicit declaration of built-in function 'abort'
../../../libiberty/regex.c: In function 'xregfree':
../../../libiberty/regex.c:8112: warning: incompatible implicit declaration of built-in function 'free'
make: *** Error 1
make: Leaving directory `/usr/src/redhat/BUILD/gcc-4.4.0/obj-mips64el-unknown-linux-gnu/build-mips64el-unknown-linux-gnu/libiberty'
make: *** Error 2
make: Leaving directory `/usr/src/redhat/BUILD/gcc-4.4.0/obj-mips64el-unknown-linux-gnu'
make: *** Error 2
make: Leaving directory `/usr/src/redhat/BUILD/gcc-4.4.0/obj-mips64el-unknown-linux-gnu'
make: *** Error 2
error: Bad exit status from /var/tmp/rpm-tmp.FAzaKQ (%build)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.FAzaKQ (%build)
# 但如果用 -O0 就没这个问题,可以编译成功!

为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!
:shock:

jiangtao9999 发表于 2009-4-27 18:21:26

if [ x"-fPIC" != x ] && [ ! -d pic ]; then \
          mkdir pic; \
      else true; fi
touch stamp-picdir
if [ x"-fPIC" != x ]; then \
          gcc -c -DHAVE_CONFIG_H -g -fkeep-inline-functions-I. -I../../libiberty/../include-W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -pedantic-fPIC ../../libiberty/regex.c -o pic/regex.o; \
      else true; fi很有区别?!

jiangtao9999 发表于 2009-4-27 18:32:30

看样子是 makebootstrap 时的问题。

make BOOT_CFLAGS="$OPT_FLAGS" bootstrap -j1
这个 BOOT_CFLAGS 是不是导致问题的根源?

jiangtao9999 发表于 2009-4-27 18:57:08

貌似不是这个问题……

jiangtao9999 发表于 2009-4-27 20:27:09

受不了了。
手动编译 gcc 都不行。
修改 regex.c 编译结果依然遇到 bus error ……
页: [1]
查看完整版本: mips64el编译gcc4.4的怪异问题……