在我的Mac上运行gdb 7.6时出现了make错误。

4

当我在我的运行OS X 10.8.5的i7处理器Mac上运行配置后,运行make gdb时出现以下错误:

gcc版本为

$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --withgxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.76) (based on LLVM 3.3svn    
Target: x86_64-apple-darwin12.5.0
Thread model: posix

错误:

/Users/sbala/Downloads/gdb-7.6/opcodes/i386-dis.c:12078:18: error: adding 'char' to a string does not append to the string [-Werror,-Wstring-plus-int]
  oappend ("%st" + intel_syntax);
           ~~~~~~^~~~~~~~~~~~~~
/Users/sbala/Downloads/gdb-7.6/opcodes/i386-dis.c:12078:18: note: use array indexing to silence this warning
  oappend ("%st" + intel_syntax);
                 ^
           &     [             ]
/Users/sbala/Downloads/gdb-7.6/opcodes/i386-dis.c:12609:23: error: adding 'char' to a string does not append to the string [-Werror,-Wstring-plus-int]
      oappend ("%cs:" + intel_syntax);
               ~~~~~~~^~~~~~~~~~~~~~
/Users/sbala/Downloads/gdb-7.6/opcodes/i386-dis.c:12609:23: note: use array indexing to silence this warning
      oappend ("%cs:" + intel_syntax);
                      ^
               &      [             ]
/Users/sbala/Downloads/gdb-7.6/opcodes/i386-dis.c:12614:23: error: adding 'char' to a string does not append to the string [-Werror,-Wstring-plus-int]
      oappend ("%ds:" + intel_syntax);
               ~~~~~~~^~~~~~~~~~~~~~
/Users/sbala/Downloads/gdb-7.6/opcodes/i386-dis.c:12614:23: note: use array indexing to silence this warning
      oappend ("%ds:" + intel_syntax);
                      ^
               &      [             ]
/Users/sbala/Downloads/gdb-7.6/opcodes/i386-dis.c:12619:23: error: adding 'char' to a string does not append to the string [-Werror,-Wstring-plus-int]
      oappend ("%ss:" + intel_syntax);
               ~~~~~~~^~~~~~~~~~~~~~
/Users/sbala/Downloads/gdb-7.6/opcodes/i386-dis.c:12619:23: note: use array indexing to silence this warning
      oappend ("%ss:" + intel_syntax);
                      ^
               &      [             ]
/Users/sbala/Downloads/gdb-7.6/opcodes/i386-dis.c:12624:23: error: adding 'char' to a string does not append to the string [-Werror,-Wstring-plus-int]
      oappend ("%es:" + intel_syntax);
               ~~~~~~~^~~~~~~~~~~~~~
/Users/sbala/Downloads/gdb-7.6/opcodes/i386-dis.c:12624:23: note: use array indexing to silence this warning
      oappend ("%es:" + intel_syntax);
                      ^
               &      [             ]
/Users/sbala/Downloads/gdb-7.6/opcodes/i386-dis.c:12629:23: error: adding 'char' to a string does not append to the string [-Werror,-Wstring-plus-int]
      oappend ("%fs:" + intel_syntax);
               ~~~~~~~^~~~~~~~~~~~~~
/Users/sbala/Downloads/gdb-7.6/opcodes/i386-dis.c:12629:23: note: use array indexing to silence this warning
      oappend ("%fs:" + intel_syntax);
                      ^
               &      [             ]
/Users/sbala/Downloads/gdb-7.6/opcodes/i386-dis.c:12634:23: error: adding 'char' to a string does not append to the string [-Werror,-Wstring-plus-int]
      oappend ("%gs:" + intel_syntax);
               ~~~~~~~^~~~~~~~~~~~~~
/Users/sbala/Downloads/gdb-7.6/opcodes/i386-dis.c:12634:23: note: use array indexing to silence this warning
      oappend ("%gs:" + intel_syntax);
                      ^
               &      [             ]
/Users/sbala/Downloads/gdb-7.6/opcodes/i386-dis.c:13973:19: error: adding 'char' to a string does not append to the string [-Werror,-Wstring-plus-int]
  oappend ("%es:" + intel_syntax);
           ~~~~~~~^~~~~~~~~~~~~~
/Users/sbala/Downloads/gdb-7.6/opcodes/i386-dis.c:13973:19: note: use array indexing to silence this warning
  oappend ("%es:" + intel_syntax);
                  ^
           &      [             ]
8 errors generated.
make[4]: *** [i386-dis.lo] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-opcodes] Error 2
make: *** [all] Error 2"

如果你需要更多细节,请告诉我。

2个回答

6

看起来在OSX上构建gdb-7.6.1时,默认启用了--enable-werror。

./configure --disable-werror
make

对我来说运行良好。


5
编译器过于严格,因此对涉及字符串字面量的指针算术发出警告。此外,您可能已经使用了--enable-werror或者-Werror来配置, 因此这些无害的警告被转化为错误。(您只显示了编译器的配置标志,而没有的配置标志)。
解决方案:关闭-Werror,或者特别使用-Wno-string-plus-int(添加到CFLAGS),以消除这个警告。

我尝试通过 ./configure 然后 make 再然后是 make install 安装 gdb。但我一直得到同样的错误。那么我应该如何关闭 -Werror 呢? - donkey

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接