[swift-users] Wrapping ImageMagick in a Swift Package

Toni Suter tonisuter at me.com
Wed Oct 4 01:59:08 CDT 2017


Hi Ankit,

Thank you very much! It works now :-)

Best regards,
Toni

> Am 03.10.2017 um 21:50 schrieb Ankit Aggarwal <ankit_aggarwal at apple.com>:
> 
> Hi Toni,
> 
> You're not supposed to build the system module package (because there is nothing to build). Tag and add this package as a dependency and then try to import the `TestPkg` module that you defined in the modulemap. The error here is bogus and is tracked by https://bugs.swift.org/browse/SR-5383 <https://bugs.swift.org/browse/SR-5383>
> 
> On Tue, Oct 3, 2017 at 12:32 AM, Toni Suter via swift-users <swift-users at swift.org <mailto:swift-users at swift.org>> wrote:
> Hi,
> 
> I am trying to create a Swift Package that wraps the ImageMagick C API. So I installed ImageMagick using MacPorts and
> I was then able to build the sample program with the following commands:
> 
> export PKG_CONFIG_PATH=/opt/local/lib/pkgconfig
> cc main.c `pkg-config --cflags --libs MagickWand`
> 
> Then I created a package with the command "swift package init --type=system-module" and I modified Package.swift to look
> like this:
> 
> // swift-tools-version:4.0
> 
> import PackageDescription
> 
> let package = Package(
> 	name: "TestPkg",
> 	pkgConfig: "MagickWand"
> )
> 
> and I modified module.modulemap to the following:
> 
> module TestPkg [system] {
>   header "/opt/local/include/ImageMagick-6/wand/MagickWand.h"
>   link "MagickWand-6.Q16"
>   link "MagickCore-6.Q16"
>   export *
> }
> 
> Now when I run "swift build", I get the following error message:
> 
> <unknown>:0: error: unexpected 'commands' value (expected map)
> <unknown>:0: error: unable to load build file
> error: terminated(1): /Library/Developer/Toolchains/swift-4.0-DEVELOPMENT-SNAPSHOT-2017-08-27-a.xctoolchain/usr/bin/swift-build-tool -f /Users/tonisuter/Desktop/TestPkg/.build/debug.yaml main
> 
> Does anybody know how I can fix this error?
> 
> Thanks and best regards
> Toni
> 
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org <mailto:swift-users at swift.org>
> https://lists.swift.org/mailman/listinfo/swift-users <https://lists.swift.org/mailman/listinfo/swift-users>
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20171004/2a10281a/attachment.html>


More information about the swift-users mailing list