GCC无法在macOS上编译任何内容

最近(自从发布Catalina并更新了xcode以来,但我仍在运行Mojave)我发现通过macports安装的gcc已损坏。我收到错误消息,指出找不到包含的系统:

ld: library not found for -lSystem

我在这里尝试了解决方案:Can't compile C program on a Mac after upgrade to Mojave-但是,当我安装macOS_SDK_headers_for_macOS_10.14.pkg时,它实际上并未在/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/中创建任何内容开发人员/ SDK;我看到的只有10.15(Catalina)SDK!

如果我只是将MacOSX10.14.sdk链接到MacOSX10.15.sdk(这可能不是一个好主意),我会得到一系列不同的错误:

In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/wchar.h:90,from /opt/local/include/gcc8/c++/cwchar:44,from /opt/local/include/gcc8/c++/bits/postypes.h:40,from /opt/local/include/gcc8/c++/iosfwd:40,from /opt/local/include/gcc8/c++/ios:38,from /opt/local/include/gcc8/c++/ostream:38,from /opt/local/include/gcc8/c++/iostream:39,from /Users/pae9/soft/src/cmake/LIGO_support/restrictHealMap.cpp:4:
/opt/local/lib/gcc8/gcc/x86_64-apple-darwin18/8.3.0/include-fixed/stdio.h:222:7: error: conflicting declaration of 'char* ctermid(char*)' with 'C' linkage
 char *ctermid(char *);

换句话说,现在看来macports标头与xcode标头冲突。

我从来没有遇到过问题;我认为这个问题可以追溯到最近的xcode更新(当前版本为11.2(11B52))

任何想法或建议都非常受欢迎-我真的很想能够回到使用gcc编译代码的地方!

仅供参考,我使用的是gcc7(来自macports),目的是与实际的实时系统linux服务器保持一致,但是我尝试使用gcc 8和9并获得相同的结果。

aws8v111g2r 回答:GCC无法在macOS上编译任何内容

cd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs /

sudo ln -s MacOSX10.15.sdk MacOSX10.14.sdk

,

好吧,看来,如果我像上面那样执行ln -s,并且还将#include移到我所有文件中的第一个include中,问题就消失了。

在我看来,这看起来像是Apple SDK标头中的一个严重问题,因为这样的定义肯定不会发生冲突...?

本文链接:https://www.f2er.com/3143831.html

大家都在问