I’m trying to do this with the system freetype library, but it’s not working. why?
targets:
[
...
.systemLibrary(name: "FreeType", pkgConfig: "freetype2"),
...
]
error: could not find source files for target(s): FreeType; use the 'path'
property in the Swift 4 manifest to set a custom target path
This is what I get when i do pkg-config
$ pkg-config --cflags --libs freetype2
-I/usr/include/freetype2 -I/usr/include/libpng16 -lfreetype
nvm apparently you need a source folder with a module.modulemap in it from this bug. this should really be documented somewhere
2 Likes
Isn't this documented here?
that’s the old method where you had to create and tag an empty git repository.
1 Like
Ah, got it. I was confused by your link to the bug, which included a link to a commit with fixes to both Usage.md and the addition of PackageDescriptionV4_2.md describing .systemLibrary. I guess they weren't unified/updated at that time, though. You might want to file a documentation bug.
yeah i was confused by that too. i feel like the invocations in the code examples were updated, but the recipe as a whole wasn’t updated, so all those unnecessary steps are still being documented. weird
I’ve written up a short guide documenting the new process and opened a pull request here.
3 Likes
alexanderUV
(Alexander Ubillus)
8
I have this setup and while compilation is working, linking is not.
I can see pkg-config returning the right parameters for --libs but swift build is failing:
ld: warning: Could not find auto-linked library 'SDL2'
Undefined symbols for architecture x86_64:
"_SDL_Init", referenced from:
_$S14codemaker_sdl26WindowC10initializeyyF in Window.swift.o
ld: symbol(s) not found for architecture x86_64
:0: error: link command failed with exit code 1 (use -v to see invocation)
error: terminated(1): /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build-tool -f /Users/alexander/dev/swift-project/codemaker-sdl2/.build/debug.yaml main output:
alexanderUV
(Alexander Ubillus)
9
I changed my toolchain to use the latest trunk and now it works fine 
I don't know how I would have figured all of this without your help. Thank you VERY MUCH.
2 Likes