gcc包括路径和符号链接

时间:2011-03-26 04:02:56

标签: gcc include symlink

我正在尝试在Snow Leopard上编译Macports,特别是文件src/macports1.0/get_systemconfiguration_proxies.c。这#include CoreFoundation/CoreFoundation.h #include CoreFoundation/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.h折叠为Frameworks/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之前跟踪符号链接..

1 个答案:

答案 0 :(得分:1)

错误消息以:

结尾
$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。为什么这个问题不久就出现了,我不知道。也许这是最近的改变。