在启用了c ++的OSX 10.9上编译GMP库

时间:2013-07-02 05:27:52

标签: c++ macos clang gmp

我无法在OSX 10.9上编译GMP。我不完全确定,如果问题是OSX 10.9具体但发生了什么是编译成功但make check失败。

请注意,如果我不使用--enable-cxx汇编,make check都会成功。

完整错误是:

c++ -DHAVE_CONFIG_H -I. -I../.. -I../.. -I../../tests    -O2 -pedantic -fomit-frame-pointer -m64 -mtune=corei7 -march=corei7 -c -o t-cast.o t-cast.cc
brew: superenv removed: -O2 -pedantic -m64 -mtune=corei7 -march=corei7
In file included from t-cast.cc:20:
In file included from ../../gmp.h:51:
/Applications/Xcode5-DP2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/cstddef:51:9: error: no member named
      'ptrdiff_t' in the global namespace
using ::ptrdiff_t;
      ~~^
In file included from t-cast.cc:21:
In file included from ../../gmpxx.h:29:
In file included from /Applications/Xcode5-DP2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/algorithm:594:
In file included from /Applications/Xcode5-DP2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:596:
/Applications/Xcode5-DP2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/iterator:386:13: error: unknown type name
      'ptrdiff_t'
    typedef ptrdiff_t difference_type;
            ^
/Applications/Xcode5-DP2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/iterator:413:56: error: unknown type name
      'ptrdiff_t'
template<class _Category, class _Tp, class _Distance = ptrdiff_t,                                                       ^/Applications/Xcode5-DP2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/iterator:720:66: error: unknown type name
      'ptrdiff_t'          class _Traits = char_traits<_CharT>, class _Distance = ptrdiff_t>
                                                                 ^
/Applications/Xcode5-DP2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/iterator:720:54: error: template parameter
      missing a default argument
          class _Traits = char_traits<_CharT>, class _Distance = ptrdiff_t>
                                                     ^
/Applications/Xcode5-DP2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/iterator:720:27: note: previous default
      template argument defined here          class _Traits = char_traits<_CharT>, class _Distance = ptrdiff_t>

1 个答案:

答案 0 :(得分:0)

删除__need_size_t中的gmp.h define和undef。它也会导入ptrdiff_t,而不仅仅是size_t