gcc - 构建带有错误的 GCC 4.4.7(一些警告被视为错误)
问题描述
configure flags: --prefix=/nix/store/l06rvwfzdvpabvgzzad4d3zy0pk8rd45-gcc-4.4.7 --disable-multilib --with-ppl=/nix/store/qkydvl67jamj9k2538a7b7467gqx073i-ppl-1.2 --with-cloog=/nix/store/zbn4xs136ccagbjvl7ka8br3f3w9w1gj-cloog-ppl-0.15.11 --with-gmp=/nix/store/7mrq5v4nnqfkv1ka7a0kdw9mzvqs5w3c-gmp-6.1.2 --with-mpfr=/nix/store/9429azblcx1y9apas3azxxd38imcmsy0-mpfr-4.0.2 --disable-libstdcxx-pch --without-included-gettext --with-system-zlib --enable-languages=c\,c++
部分日志:
../../gcc-4.4.7/libcpp/macro.c:1730:8: error: format not a string literal and no format arguments [-Werror=format-security]
cpp_error (pfile, CPP_DL_ERROR, paste_op_error_msg);
^~~~~~~~~
../../gcc-4.4.7/libcpp/macro.c:1743:8: error: format not a string literal and no format arguments [-Werror=format-security]
cpp_error (pfile, CPP_DL_ERROR, paste_op_error_msg);
^~~~~~~~~
我已经尝试添加CFLAGS=-Wno-error
,但对它没有影响。我还绑定了使用 sed 替换Werror=format-security
,它也失败了。
解决方案
我的猜测是您正在使用更新版本的编译器(在 4.4.7 发布时不存在),并带有新的和加强的警告。
编写 GCC 的语言在某些时候已经从 C 更改为 C++。如果那是在 4.4 之前(不确定;将不得不检查),那么CFLAGS
无效的原因很清楚 - 也尝试设置CXXFLAGS
。
(为了保留一些历史:我最初发布的答案建议使用
CFLAGS_FOR_TARGET
,这是错误的,因为 libcpp 不是目标库,因此是用系统编译器构建的,而不是刚刚构建的)
推荐阅读
- django - 使用 docker 部署时,Celery、Django、Redis 遇到错误 99
- c# - EF Core 和 ASP.NET 未将子对象插入数组
- python - 在 Python 3.x 中,是否可以检查 Web URL 是否有涉及编辑日期的动态更改?
- c++ - 如何从列表中删除节点
- python - 在 Python Selenium 的 xpath 中使用变量时出错
- android - viewPager 适配器未更新
- php - 如何在php中计算9 GB文件的行数
- ios - 如何在 Swift 中缓存双精度数组
- javascript - 如何在 WebAssembly 中使用加载和存储
- python - 如果我覆盖默认的烧瓶引导头和脚本块会发生什么?