做LFS,在装gcc时遇到了错误,那位大哥帮忙看看!多谢!

发布于 2022-10-01 01:44:48 字数 5243 浏览 14 评论 0

就是在执行下面的命令时出错了
你必须先打补丁,才能安装这个包。确认在运行下面的命令前,补丁已经解压了。

如果你把这个包缺省的优化参数(包括 -march 和 -mcpu参数)改变的话,它会有很不良的表现。最好不要优化这个包。因此,如果你定义了任何优化参数的话,比如CFLAGS 和 CXXFLAGS,我们劝你在编译GCC时unset或修改它们。警告过了哦!

下面的命令将安装 C和C++ 编译器,所以你需要解压 gcc-core和gcc-g++两个压缩包。gcc包里还有其它的编译器,编译它们的指导请看 http://beyond.linuxfromscratch.org/...eneral/gcc.html 。

patch -Np1 -i ../gcc-3.2.patch &&
mkdir ../gcc-build &&
cd ../gcc-build &&
../gcc-3.2/configure --prefix=/usr --enable-shared \
--enable-threads=posix --with-slibdir=/lib \
--enable-__cxa_atexit --enable-clocale=gnu &&
make bootstrap &&
make install &&
ln -s ../usr/bin/cpp /lib &&
ln -s ../bin/cpp /usr/lib &&
ln -s gcc /usr/bin/cc
错误信息如下:
../../gcc-3.2/libiberty/regex.c: In function `xregcomp':
../../gcc-3.2/libiberty/regex.c:8099: warning: signed and unsigned type in conditional expression
../../gcc-3.2/libiberty/regex.c: In function `xregerror':
../../gcc-3.2/libiberty/regex.c:8234: warning: unused parameter `preg'
if [ x"-fpic" != x ]; then \
  gcc -c -DHAVE_CONFIG_H -g -O2 -I. -I../../gcc-3.2/libiberty/../include  -W -Wall -Wtraditional -pedantic -fpic ../../gcc-3.2/libiberty/cplus-dem.c -o pic/cplus-dem.o; \
else true; fi
In file included from ../../gcc-3.2/libiberty/cplus-dem.c:41:
/static/lib/gcc-lib/i686-pc-linux-gnu/3.2/include/stdio.h:55: syntax error before "typedef"
/static/lib/gcc-lib/i686-pc-linux-gnu/3.2/include/stdio.h:60: parse error before "__USING_NAMESPACE_STD"
/static/lib/gcc-lib/i686-pc-linux-gnu/3.2/include/stdio.h: In function `__USING_NAMESPACE_STD':
/static/lib/gcc-lib/i686-pc-linux-gnu/3.2/include/stdio.h:71: storage class specified for parameter `__FILE'
In file included from /usr/include/_G_config.h:14,
                 from /usr/include/libio.h:32,
                 from /static/lib/gcc-lib/i686-pc-linux-gnu/3.2/include/stdio.h:81,
                 from ../../gcc-3.2/libiberty/cplus-dem.c:41:
/static/lib/gcc-lib/i686-pc-linux-gnu/3.2/include/stddef.h:294: storage class specified for parameter `wchar_t'
/static/lib/gcc-lib/i686-pc-linux-gnu/3.2/include/stddef.h:321: storage class specified for parameter `wint_t'
In file included from /usr/include/_G_config.h:24,
                 from /usr/include/libio.h:32,
                 from /static/lib/gcc-lib/i686-pc-linux-gnu/3.2/include/stdio.h:81,
                 from ../../gcc-3.2/libiberty/cplus-dem.c:41:
/usr/include/wchar.h:72: parse error before "wint_t"
/static/lib/gcc-lib/i686-pc-linux-gnu/3.2/include/stdio.h:71: parm types given
both in parmlist and separately
/static/lib/gcc-lib/i686-pc-linux-gnu/3.2/include/stdio.h:60: parameter name omitted
In file included from /usr/include/libio.h:32,
                 from /static/lib/gcc-lib/i686-pc-linux-gnu/3.2/include/stdio.h:81,
                 from ../../gcc-3.2/libiberty/cplus-dem.c:41:
/usr/include/_G_config.h:29: `__mbstate_t' undeclared (first use in this function)
/usr/include/_G_config.h:29: (Each undeclared identifier is reported only once
/usr/include/_G_config.h:29: for each function it appears in.)
/usr/include/_G_config.h:29: parse error before "__state"
/usr/include/_G_config.h: At top level:
/usr/include/_G_config.h:30: ISO C forbids data definition with no type or storage class
/usr/include/_G_config.h:34: parse error before "__mbstate_t"
/usr/include/_G_config.h:35: ISO C forbids data definition with no type or storage class
In file included from /usr/include/_G_config.h:44,
                 from /usr/include/libio.h:32,
                 from /static/lib/gcc-lib/i686-pc-linux-gnu/3.2/include/stdio.h:81,
                 from ../../gcc-3.2/libiberty/cplus-dem.c:41:
/usr/include/gconv.h:158: parse error before "__mbstate_t"
/usr/include/gconv.h:159: ISO C forbids data definition with no type or storage class
/usr/include/gconv.h:164: parse error before '}' token
/usr/include/gconv.h:172: field `__data' has incomplete type
/usr/include/gconv.h:173: confused by earlier errors, bailing out
make[1]: *** [cplus-dem.o] Error 1
make[1]: Leaving directory `/usr/src/gcc-build/libiberty'
make: *** [all-libiberty] Error 2

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

眼眸里的快感 2022-10-08 01:44:48

说什么语法错误,我也没见过这种情况,不懂

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文