Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix "error: no member named 'fancy_abort' in namespace 'std::__1'; did you mean simply 'fancy_abort'? _VSTD::abort();"

Tags:

macos

gcc

Platform: Macos Catalina 10.15.2
Xcode version: Xcode 11

I have tried many times to make-all gcc to build my source code. However, I have encountered a problem:

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

I have tried to install another version of Xcode. I have installed Xcode6 but it still did not work, and I found a solution of this issue. But when I download Xcode8.3.3, it is not compatible with Catalina 10.15.2.

like image 716
rookieVee Avatar asked Nov 15 '22 19:11

rookieVee


1 Answers

I ran in to this issue while using crosstools-ng on mac (mojave 10.14) to compile cross-platform toolchain with gcc 4.9.

Solution: Edit .build/src/gcc-4.9.4/gcc/system.h to add #include <map> in #ifdef __cplusplus block where other include statements are.

The problem is that is included (via ) after abort has been defined as a macro to fancy_abort. And thus when the C++ standard headers try to call std::abort, they end up calling std::fancy_abort, which of course doesn't exist.

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

like image 177
NSaran Avatar answered Dec 27 '22 14:12

NSaran