helje5/swiftywasmer
A Swift API for the
Wasmer Installation for Swift
This works on either Intel or M1 Macs.
Installing Wasmer itself is easy:
curl https://get.wasmer.io -sSfL | shOr install a tarball: Wasmer 1.0.0 wherever you like.
To work, the Swift Package Manager requires a pkg-config file in a system location. Fortunately wasmer config can generate one for you:
wasmer config --pkg-config > /usr/local/lib/pkgconfig/wasmer.pcUnfortunately the generated file is a little b0rked in 1.0.0. Open up the file in your favorite editor:
emacs /usr/local/lib/pkgconfig/wasmer.pc
mate /usr/local/lib/pkgconfig/wasmer.pc
open /usr/local/lib/pkgconfig/wasmer.pcAnd adjust two little things:
- remove the
/wasmerfrom theCflagsline, it should then read:
Cflags: -I/Users/helge/.wasmer/include
- add
-lffito theLibsline, it should then read:
Libs: -L/Users/helge/.wasmer/lib -lwasmer -lffi
(the latter is only required when linking static libs, but doesn't hurt either way).
To link statically (recommended), move libwasmer.dylib out of the way:
mv ~/.wasmer/lib/libwasmer.dylib ~/.wasmer/lib/libwasmer.dylib-away(Dynamic linking should also work, but you'd need to ensure that the dylib is in the dynamic library lookup path.)
Links
- Documentation - Wasmer C API
- SwiftWasm (compiling Swift to Wasm)
Who
SwiftyWasmer is brought to you by the Always Right Institute and ZeeZide. We like feedback, GitHub stars, cool contract work, presumably any form of praise you can think of.
Package Metadata
Repository: helje5/swiftywasmer
Default branch: main
README: README.md