Closed torkelrogstad closed 8 months ago
Suffixing a file is like an implicit build constraint. It's mentioned in the docs you linked:
If a file's name, after stripping the extension and a possible _test suffix, matches any of the following patterns:
_GOOS _GOARCH *_GOOS_GOARCH
(example: source_windows_amd64.go) where GOOS and GOARCH represent any known operating system and architecture values respectively, then the file is considered to have an implicit build constraint requiring those terms (in addition to any explicit constraints in the file).
Turns out there's more differences in cgo bindings between macOS, Linux and Windows. Instead of mucking around and trying to decipher the madness, we shove all differentiating cgo calls into separate calls for each platform.
Notes for getting Windows to build:
libdl.a
is not present on Windows by default, and this is needed for the Rust code to be used.ld
can find it.bash
shell (NOT through WSL, but a native Windowsbash
)./configure --prefix=/ --libdir=$PWD/libdir --incdir=$PWD/incdir && make
./libdir/libdl.a
. Place this file in a placeld
can find it.C:\ProgramData\mingw64\mingw64\lib