问题描述
我正在尝试从命令行编译zlib,并且在使用 -Wall -Wextra -Wconversion
时收到此消息(完整的交叉编译脚本是
I'm trying to compile zlib from the command line, and I'm getting this message when using -Wall -Wextra -Wconversion
(full cross-compile script is below):
以下是生成行的configure测试:
Here's the configure test that's generating the line:
cat > $test.c << EOF
int foo() { return 0; }
EOF
echo "Checking for obsessive-compulsive compiler options..." >> configure.log
if try $CC -c $CFLAGS $test.c; then
:
else
echo "Compiler error reporting is too harsh for $0 (perhaps remove -Werror)." | tee -a configure.log
leave 1
fi
尚不清楚我确切地被判断为太苛刻了(特别是因为 -Werror
不存在)。我也不太了解测试中使用的示例程序的功能,因此我不清楚判断编译器警告太苛刻的标准是什么。
Its not clear to me what exactly is being judged too harsh (especially since -Werror
is not present). I also don't quite understand what the sample program used in the test is doing, so its not clear to me what the criteria is for judging the compiler warnings "too harsh".
zlib抱怨什么太苛刻了?
What is zlib complaining is too harsh?
#! /bin/sh
export PATH="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:$PATH"
export CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
export CXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
export LD=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
export AR=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar
export RANLIB=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib
export CFLAGS="-Wall -Wextra -Wconversion --sysroot="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdks""
export CXXFLAGS="-Wall -Wextra -Wconversion --sysroot="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk""
推荐答案
我在一台新造的机器,我发现原因是我实际上没有安装适当的GNU C编译器()。因此,它抱怨编译器过于苛刻,仅仅是因为没有编译器。
I had the exact same problem on a newly built machine, and I found the cause was that I didn't actually have the appropriate GNU C compilers installed (reference). Therefore it's complaining that the compiler is too harsh simply because there is no compiler.
尝试运行:
sudo apt-get install build-essential
,然后尝试运行再次 ./ configure
。
这篇关于zlib,苛刻的编译器警告和配置测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!