QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 3185|回复: 4

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

[复制链接]
发表于 2009-4-27 18:11:30 | 显示全部楼层 |阅读模式
  1. RPM_OPT_FLAGS=" -O0 -g "
  2. CC=gcc
  3. OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/\(-Wp,\)\?-D_FORTIFY_SOURCE=[12]//g'`
  4. OPT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-m64//g;s/-m32//g;s/-m31//g'`
  5. OPT_FLAGS=`echo "$OPT_FLAGS" | sed -e 's/[[:blank:]]\+/ /g'`
  6. case "$OPT_FLAGS" in
  7.   *-fasynchronous-unwind-tables*)
  8.     sed -i -e 's/-fno-exceptions /-fno-exceptions -fno-asynchronous-unwind-tables/' \
  9.       ../gcc/Makefile.in
  10.     ;;
  11. esac
  12. CC="$CC" CFLAGS="$OPT_FLAGS" CXXFLAGS="`echo $OPT_FLAGS | sed 's/ -Wall / /g'`" XCFLAGS="$OPT_FLAGS" TCFLAGS="$OPT_FLAGS" \
  13.         GCJFLAGS="$OPT_FLAGS" \
  14.         ../configure --prefix=%{_prefix} --mandir=%{_mandir} --infodir=%{_infodir} \
  15.         --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap \
  16.         --enable-shared --enable-threads=posix --enable-checking=release \
  17.         --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions \
  18.         --enable-languages=c,c++,objc,obj-c++ \
  19.         --disable-libgcj --enable-c99 --enable-long-long --with-abi=64 \
  20.         --enable-clocale=gnu --disable-libstdcxx-pch --disable-multilib

  21. make BOOT_CFLAGS="$OPT_FLAGS" bootstrap -j1
复制代码
这里的 RPM_OPT_FLAGS=" -O0 -g " 如果等于 -O2 -g
会出现
  1. config.status: creating config.h
  2. config.status: executing default commands
  3. make[3]: Entering directory `/usr/src/redhat/BUILD/gcc-4.4.0/obj-mips64el-unknown-linux-gnu/build-mips64el-unknown-linux-gnu/libiberty'
  4. if [ x"" != x ] && [ ! -d pic ]; then \
  5.           mkdir pic; \
  6.         else true; fi
  7. touch stamp-picdir
  8. if [ x"" != x ]; then \
  9.           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; \
  10.         else true; fi
  11. 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
  12. ../../../libiberty/regex.c:130: warning: function declaration isn't a prototype
  13. ../../../libiberty/regex.c:130: warning: conflicting types for built-in function 'malloc'
  14. ../../../libiberty/regex.c:131: warning: function declaration isn't a prototype
  15. ../../../libiberty/regex.c:131: warning: conflicting types for built-in function 'realloc'
  16. In file included from /usr/include/bits/string2.h:1299,
  17.                  from /usr/include/string.h:423,
  18.                  from ../../../libiberty/regex.c:149:
  19. /usr/include/stdlib.h:471: error: conflicting types for 'malloc'
  20. ../../../libiberty/regex.c:130: note: previous declaration of 'malloc' was here
  21. In file included from ../../../libiberty/regex.c:638:
  22. ../../../libiberty/regex.c: In function 'byte_regex_compile':
  23. ../../../libiberty/regex.c:2439: warning: implicit declaration of function 'free'
  24. ../../../libiberty/regex.c:2439: warning: incompatible implicit declaration of built-in function 'free'
  25. ../../../libiberty/regex.c:2500: warning: incompatible implicit declaration of built-in function 'free'
  26. ../../../libiberty/regex.c:2533: warning: incompatible implicit declaration of built-in function 'free'
  27. ../../../libiberty/regex.c:2640: warning: incompatible implicit declaration of built-in function 'free'
  28. ../../../libiberty/regex.c:3643: warning: incompatible implicit declaration of built-in function 'free'
  29. ../../../libiberty/regex.c:4150: warning: incompatible implicit declaration of built-in function 'free'
  30. ../../../libiberty/regex.c: In function 'byte_re_compile_fastmap':
  31. ../../../libiberty/regex.c:4835: warning: implicit declaration of function 'abort'
  32. ../../../libiberty/regex.c:4835: warning: incompatible implicit declaration of built-in function 'abort'
  33. ../../../libiberty/regex.c: In function 'byte_re_match_2_internal':
  34. ../../../libiberty/regex.c:7421: warning: incompatible implicit declaration of built-in function 'abort'
  35. ../../../libiberty/regex.c: In function 'xregcomp':
  36. ../../../libiberty/regex.c:7975: warning: incompatible implicit declaration of built-in function 'free'
  37. ../../../libiberty/regex.c: In function 'xregexec':
  38. ../../../libiberty/regex.c:8050: warning: incompatible implicit declaration of built-in function 'free'
  39. ../../../libiberty/regex.c: In function 'xregerror':
  40. ../../../libiberty/regex.c:8078: warning: incompatible implicit declaration of built-in function 'abort'
  41. ../../../libiberty/regex.c: In function 'xregfree':
  42. ../../../libiberty/regex.c:8112: warning: incompatible implicit declaration of built-in function 'free'
  43. make[3]: *** [regex.o] Error 1
  44. make[3]: Leaving directory `/usr/src/redhat/BUILD/gcc-4.4.0/obj-mips64el-unknown-linux-gnu/build-mips64el-unknown-linux-gnu/libiberty'
  45. make[2]: *** [all-build-libiberty] Error 2
  46. make[2]: Leaving directory `/usr/src/redhat/BUILD/gcc-4.4.0/obj-mips64el-unknown-linux-gnu'
  47. make[1]: *** [stage1-bubble] Error 2
  48. make[1]: Leaving directory `/usr/src/redhat/BUILD/gcc-4.4.0/obj-mips64el-unknown-linux-gnu'
  49. make: *** [bootstrap] Error 2
  50. error: Bad exit status from /var/tmp/rpm-tmp.FAzaKQ (%build)


  51. RPM build errors:
  52.     Bad exit status from /var/tmp/rpm-tmp.FAzaKQ (%build)
  53. [root@localhost SPECS]#
复制代码
但如果用 -O0 就没这个问题,可以编译成功!

为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!为什么?!
 楼主| 发表于 2009-4-27 18:21:26 | 显示全部楼层
  1. if [ x"-fPIC" != x ] && [ ! -d pic ]; then \
  2.           mkdir pic; \
  3.         else true; fi
  4. touch stamp-picdir
  5. if [ x"-fPIC" != x ]; then \
  6.           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; \
  7.         else true; fi
复制代码
很有区别?!
回复

使用道具 举报

 楼主| 发表于 2009-4-27 18:32:30 | 显示全部楼层
看样子是 make  bootstrap 时的问题。

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

使用道具 举报

 楼主| 发表于 2009-4-27 18:57:08 | 显示全部楼层
貌似不是这个问题……
回复

使用道具 举报

 楼主| 发表于 2009-4-27 20:27:09 | 显示全部楼层
受不了了。
手动编译 gcc 都不行。
修改 regex.c 编译结果依然遇到 bus error ……
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-3-29 00:32 , Processed in 0.051674 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表