gcc 包括路径和符号链接

发布于 2024-10-26 09:40:23 字数 2036 浏览 1 评论 0原文

我正在尝试在 Snow Leopard 上编译 Macports,特别是文件 src/macports1.0/get_systemconfiguration_proxies.c。这个#includeCoreFoundation/CoreFoundation.h,其中#includeCoreFoundation/CFBase.h,其中... 尝试#include CoreServices/../Frameworks/CarbonCore.framework/Headers/MacTypes.h。现在, CoreServices 是一个符号链接:

$ ls -l CoreServices
lrwxr-xr-x  1 root  wheel  62 Mar 25 17:15 CoreServices -> ../../System/Library/Frameworks/CoreServices.framework/Headers

所以我怀疑目标是到达 ../../System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers /MacTypes.h,这是一件非常好的事情:

$ ls -l ../../System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/MacTypes.h 
-rw-r--r--  1 root  wheel  30291 Jun 24  2010 ../../System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/MacTypes.h

但是,gcc不喜欢它:

In file included from $INCLUDE/CoreFoundation/CFBase.h:48,
                 from $INCLUDE/CoreFoundation/CoreFoundation.h:38,
                 from get_systemconfiguration_proxies.c:42:
$INCLUDE/CoreServices/../Frameworks/CarbonCore.framework/Headers/MacTypes.h:20:42: error: CarbonCore/ConditionalMacros.h: No such file or directory

这让我怀疑

编辑:但是Tom Zych 指出我怀疑错误,因为我没有读完错误消息。)

gcc 可能无法解析符号链接,而是过度智能地崩溃 CoreServices/../Frameworks/CarbonCore。 Framework/Headers/MacTypes.hFrameworks/CarbonCore.framework/Headers/MacTypes.h,果然,它不存在:

$ ls -l Frameworks/CarbonCore.framework/Headers/MacTypes.h
ls: Frameworks/CarbonCore.framework/Headers/MacTypes.h: No such file or directory

我是否有可能解释了该错误正确吗?如果是这样,有什么方法可以让 gcccd'ing 到 .. 之前跟随符号链接吗?

I am trying to compile Macports on Snow Leopard—specifically, the file src/macports1.0/get_systemconfiguration_proxies.c. This #includes CoreFoundation/CoreFoundation.h, which #includes CoreFoundation/CFBase.h, which … tries to #include CoreServices/../Frameworks/CarbonCore.framework/Headers/MacTypes.h. Now, CoreServices is a symlink:

$ ls -l CoreServices
lrwxr-xr-x  1 root  wheel  62 Mar 25 17:15 CoreServices -> ../../System/Library/Frameworks/CoreServices.framework/Headers

so I suspect that the goal is to get to ../../System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/MacTypes.h, which is a perfectly fine thing to do:

$ ls -l ../../System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/MacTypes.h 
-rw-r--r--  1 root  wheel  30291 Jun 24  2010 ../../System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/MacTypes.h

However, gcc doesn't like it:

In file included from $INCLUDE/CoreFoundation/CFBase.h:48,
                 from $INCLUDE/CoreFoundation/CoreFoundation.h:38,
                 from get_systemconfiguration_proxies.c:42:
$INCLUDE/CoreServices/../Frameworks/CarbonCore.framework/Headers/MacTypes.h:20:42: error: CarbonCore/ConditionalMacros.h: No such file or directory

which leads me to suspect

(EDIT: But Tom Zych points out that I suspect wrongly, because I didn't finish reading the error message. Sigh.)

that gcc may not be resolving the symlink, and instead over-smartly collapsing CoreServices/../Frameworks/CarbonCore.framework/Headers/MacTypes.h to Frameworks/CarbonCore.framework/Headers/MacTypes.h, which, sure enough, doesn't exist:

$ ls -l Frameworks/CarbonCore.framework/Headers/MacTypes.h
ls: Frameworks/CarbonCore.framework/Headers/MacTypes.h: No such file or directory

Is it possible that I have interpreted the error correctly? If so, is there any way to talk gcc into following the symlink before cd'ing to ..?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

谁的年少不轻狂 2024-11-02 09:40:23

错误消息以以下内容结尾:

$INCLUDE/CoreServices/../Frameworks/CarbonCore.framework/Headers/MacTypes.h:20:42: \
error: CarbonCore/ConditionalMacros.h: No such file or directory

看来它能够读取并开始处理 MacTypes.h,因为它引用了其中的行号。它找不到的文件是CarbonCore/ConditionalMacros.h

我猜 CarbonCore 应该是 CarbonCore.framework。我不知道为什么这个问题很久没有出现并得到解决。也许这是最近的变化。

The error message ends with:

$INCLUDE/CoreServices/../Frameworks/CarbonCore.framework/Headers/MacTypes.h:20:42: \
error: CarbonCore/ConditionalMacros.h: No such file or directory

It appears that it was able to read and start processing MacTypes.h, since it's referring to line numbers therein. The file it can't find is CarbonCore/ConditionalMacros.h.

I would guess CarbonCore should be CarbonCore.framework. Why this hasn't long since come up and been fixed, I don't know. Perhaps it's a recent change.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文