Skip to content

[SR-11427] Swift Package cannot depend on libxml2 from SDK reliably #4666

@swift-ci

Description

@swift-ci
Previous ID SR-11427
Radar rdar://problem/55066672
Original Reporter mremond (JIRA User)
Type Bug
Environment

XCode 11.0 beta 6 (11M392r) on Mac.

Swift version 5.0.2 (swift-5.0.2-RELEASE) on Linux.

Additional Detail from JIRA
Votes 1
Component/s Package Manager
Labels Bug
Assignee None
Priority Medium

md5: 2f9c0246a74459b446772053d0c4d921

Issue Description:

I have a library (Swift package) depending on libxml2.

The project builds properly under Xcode 11 beta, but cannot be build with SwiftPM without manually passing the include dir of the libxml2 headers.

If I issue just swift build it fails with the following error:

/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.0.sdk/usr/include/libxml2/libxml/HTMLparser.h:15:10: 'libxml/xmlversion.h' file not found

I have to use the following commands to build the project from command-line:

  • On MacOs:

    swift build -Xcc -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/libxml2
  • On Linux:

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

    The project is public and available here: https://github.com/FluuxIO/XMPP

I expect that given the fact that I defined libxml2 as a dependency in the target, with linkerSettings, SwiftPM would know how to find one of its system library (from the SDK).

Here is the Package.swift that I used: https://github.com/FluuxIO/XMPP/blob/master/Package.swift

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions