5

平台:Macos Catalina 10.15.2
Xcode 版本:Xcode 11

我已经尝试过很多次make-all gcc来构建我的源代码。但是,我遇到了一个问题:

In file included from ../.././gcc/c/c-objc-common.c:33: 
In file included from /Applications/Xcode11.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/new:85: 
/Applications/Xcode11.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/exception:181:5: error:
      no member named 'fancy_abort' in namespace 'std::__1'; did you mean simply 'fancy_abort'?
    _VSTD::abort();
    ^~~~~~~ /Applications/Xcode11.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:873:15: note:
      expanded from macro '_VSTD'  # _VSTD std::_LIBCPP_ABI_NAMESPACE
              ^ ../.././gcc/system.h:685:13: note: 'fancy_abort' declared here extern void fancy_abort (const char *, int, const char
*) ATTRIBUTE_NORETURN;
            ^ 
1 error generated. 
make[1]: *** [c/c-objc-common.o] Error 1  
make: *** [all-gcc] Error 2

我试图安装另一个版本的 Xcode。我已经安装了 Xcode6 但它仍然没有工作,我找到了这个问题的解决方案。但是当我下载 Xcode8.3.3 时,它与 Catalina 10.15.2 不兼容。

4

1 回答 1

0

我在 mac(mojave 10.14)上使用 crosstools-ng 使用 gcc 4.9 编译跨平台工具链时遇到了这个问题。

解决方案:编辑 .build/src/gcc-4.9.4/gcc/system.h 以添加其他包含语句所在#include <map>的块。#ifdef __cplusplus

问题是在 abort 被定义为 fancy_abort 的宏之后包含(通过)。因此,当 C++ 标准头文件尝试调用 std::abort 时,它们最终会调用 std::fancy_abort,这当然不存在。

来源:https ://gcc.gnu.org/legacy-ml/gcc-bugs/2017-09/msg00154.html

于 2021-01-15T02:23:21.937 回答