Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Readme instructions for cross platform build #122

Merged
merged 1 commit into from
Nov 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,25 @@ Once WSL is setup, follow the usual Go and OpenGL installation instructions for

Finally, add `export LIBGL_ALWAYS_INDIRECT=0` to your ~/.bashrc (or equivalent) if you see an error like `Error: creating window failed: VersionUnavailable: GLX: Failed to create context: GLXBadFBConfig` when attempting to launch an OpenGL application from WSL.

## Cross Platform Build

Go supports cross platform build targets natively, but because pixel depends on [CGo](https://pkg.go.dev/cmd/cgo) it is necessary to specify a C cross-compiler that is compatible with the target.

### Linux to Windows

To build a windows executable on linux, you will need to install a windows C compiler, such as mingw. The following commands can be used to build for an amd64 architecture on windows.

Install mingw on linux with apt:
```sh
sudo apt update
sudo apt install gcc-mingw-w64
```

Build for windows amd64
```sh
GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CXX=x86_64-w64-mingw32-g++ CC=x86_64-w64-mingw32-gcc go build
```

## Contributing

Join us in the [Discord Chat!](https://discord.gg/n2Y8uVneK6)
Expand Down
Loading