包含带有 LLVM 模块映射的 libxml2

Including libxml2 with a LLVM module map

当尝试构建我创建的 Swift 包时,它使用 LLVM 模块映射来包含来自 /usr/include/libxml2/ 的 libxml2,我收到以下错误:

Compiling Swift Module 'foo' (1 sources)
<module-includes>2:9: note: in file included from <module-includes>:2: 
#import "/usr/include/libxml2/libxml/catalog.h"

/usr/include/libxml2/libxml/catalog.h:22:10: error: 'libxml/xmlversion.h' file not found

这是我的模块图:

module Clibxml2 [system] {

    umbrella "/usr/include/libxml2"
    export *
}

我的虚拟 main.swift 文件现在只尝试导入模块:

import Clibxml2

它在我尝试使用另一个 header 路径/伞(例如 /usr/include/CommonCrypto)时编译。我确认 xmlversion.h 确实存在于 /usr/include/libxml2/libxml 中。我错过了什么吗?

Swift 现在有一个 -Xcc option,可用于传递额外的编译器标志:

swift build -Xcc -I/usr/include/libxml2