aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorLuca Guidi <me@lucaguidi.com>2022-09-08 10:47:51 +0200
committermattn <mattn.jp@gmail.com>2022-09-18 22:34:48 +0900
commit90900be5db1ac95537a83213e3d886f3df47e27a (patch)
tree2fad3e83f6f6f4108d32c782eb75153713aef868 /README.md
parentGolang's linker add mingwex and mingw32 automatically,so we don't need add th... (diff)
downloadgolite-90900be5db1ac95537a83213e3d886f3df47e27a.tar.gz
golite-90900be5db1ac95537a83213e3d886f3df47e27a.tar.xz
Cross Compiling for Mac OS via `musl-cross`
# Enhancement Update `README.md` with new instructions for Mac OS cross compiling. # Why? The current suggested solution `xgo` is no longer maintained (GitHub archived repository). # Credits Credits go to Pieter Claerhout (@pieterclaerhout) and his blog post: https://www.yellowduck.be/posts/cross-compile-a-go-package-which-uses-sqlite3
Diffstat (limited to 'README.md')
-rw-r--r--README.md9
1 files changed, 4 insertions, 5 deletions
diff --git a/README.md b/README.md
index 913bf6a..9db6da6 100644
--- a/README.md
+++ b/README.md
@@ -218,14 +218,13 @@ This library can be cross-compiled.
In some cases you are required to the `CC` environment variable with the cross compiler.
## Cross Compiling from MAC OSX
-The simplest way to cross compile from OSX is to use [xgo](https://github.com/karalabe/xgo).
+The simplest way to cross compile from OSX is to use [musl-cross](https://github.com/FiloSottile/homebrew-musl-cross).
Steps:
-- Install [xgo](https://github.com/karalabe/xgo) (`go get github.com/karalabe/xgo`).
-- Ensure that your project is within your `GOPATH`.
-- Run `xgo local/path/to/project`.
+- Install [musl-cross](https://github.com/FiloSottile/homebrew-musl-cross) (`brew install FiloSottile/musl-cross/musl-cross`).
+- Run `CC=x86_64-linux-musl-gcc CXX=x86_64-linux-musl-g++ GOARCH=amd64 GOOS=linux CGO_ENABLED=1 go build -ldflags "-linkmode external -extldflags -static"`.
-Please refer to the project's [README](https://github.com/karalabe/xgo/blob/master/README.md) for further information.
+Please refer to the project's [README](https://github.com/FiloSottile/homebrew-musl-cross#readme) for further information.
# Google Cloud Platform