When trying to build a Swift package I created that uses a LLVM module map to include libxml2 from /usr/include/libxml2/
, I get the following error:
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
This is my module map:
module Clibxml2 [system] {
umbrella "/usr/include/libxml2"
export *
}
My dummy main.swift
file only tries to import the module for now:
import Clibxml2
It compiles when I try to use another header path / umbrella (e.g. /usr/include/CommonCrypto
). I verified that xmlversion.h
does exist in /usr/include/libxml2/libxml
. Am I missing something?
Swift has an -Xcc
option now which can be used to pass additional compiler flags:
swift build -Xcc -I/usr/include/libxml2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With