Skip to content

Commit 90900be

Browse files
jodoshamattn
authored andcommitted
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
1 parent be28dec commit 90900be

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Diff for: README.md

+4-5
Original file line numberDiff line numberDiff line change
@@ -218,14 +218,13 @@ This library can be cross-compiled.
218218
In some cases you are required to the `CC` environment variable with the cross compiler.
219219

220220
## Cross Compiling from MAC OSX
221-
The simplest way to cross compile from OSX is to use [xgo](https://github.com/karalabe/xgo).
221+
The simplest way to cross compile from OSX is to use [musl-cross](https://github.com/FiloSottile/homebrew-musl-cross).
222222

223223
Steps:
224-
- Install [xgo](https://github.com/karalabe/xgo) (`go get github.com/karalabe/xgo`).
225-
- Ensure that your project is within your `GOPATH`.
226-
- Run `xgo local/path/to/project`.
224+
- Install [musl-cross](https://github.com/FiloSottile/homebrew-musl-cross) (`brew install FiloSottile/musl-cross/musl-cross`).
225+
- 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"`.
227226

228-
Please refer to the project's [README](https://github.com/karalabe/xgo/blob/master/README.md) for further information.
227+
Please refer to the project's [README](https://github.com/FiloSottile/homebrew-musl-cross#readme) for further information.
229228

230229
# Google Cloud Platform
231230

0 commit comments

Comments
 (0)