Swift Build Error
in 技术 with 0 comment

Swift Build Error

in 技术 with 0 comment
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "Headers/CoreFoundation.h"
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:43:10: note: in file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:43:
#include <CoreFoundation/CFBase.h>
         ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:72:10: note: in file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:72:
#include <Block.h>
         ^
/usr/local/include/Block.h:16:3: error: Never include this file directly. Use <lzma.h> instead.
#       error Never include this file directly. Use <lzma.h> instead.
        ^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "Headers/CoreFoundation.h"

问题

执行swift build 或者生成 xcode 项目文件的时候,就会报上面的错误。

原因

因为 Xcode 和相关文件是从其它 Mac 电脑复制过来的。这种情况往往出现在新建 Mac 电脑新用户的时候,从其它电脑迁移了应用程序和数据。

解决办法

$sudo mv /usr/local/include /usr/local/include_old

Responses