tid-kijyun / Kanna

Kanna(鉋) is an XML/HTML parser for Swift.
MIT License
2.42k stars 221 forks source link

Xcode 12: Redefinition of module 'libxml2' #240

Closed SlaunchaMan closed 4 years ago

SlaunchaMan commented 4 years ago

Description:

It looks like the Package.swift file for Kanna is duplicating libxml2 on Xcode 12:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/libxml/module.modulemap:1:8: error: redefinition of module 'libxml2'
module libxml2 [system] [extern_c] {
       ^
/path/to/project/.build/checkouts/Kanna/Modules/module.modulemap:1:8: note: previously defined here
module libxml2 [system] {

Interestingly, using swift build appears to work fine.

Installation method:

Kanna version (or commit hash):

5.2.2

swift --version

Apple Swift version 5.3 (swiftlang-1200.0.29.2 clang-1200.0.30.1)
Target: x86_64-apple-darwin19.6.0

Xcode version (optional):

Version 12.0.1 (12A7300)

djbe commented 4 years ago

Can confirm this. Removing the generated HEADER_SEARCH_PATHS for the Kanna target fixes this, which is set to: $(SRCROOT)/.build/checkouts/Kanna/Modules

djbe commented 4 years ago

With some further testing, removing the line

dependencies: ["libxml2"],

In the Package.swift fixes the issue. It still works with swift build and now also works with swift package generate-xcodeproj.

Maybe using the same trick as with pkgConfig and provider, checking the swift version (and platform?), could help here?

tid-kijyun commented 4 years ago

@djbe Thank you for the very useful information and PR.

@SlaunchaMan I've released a new version(5.2.3). Please try it.

SlaunchaMan commented 4 years ago

Works like a charm, thank you for the quick response!