Files
goose/run_cross_local.md
Bradley Axen 1c9a7c0b05 feat: V1.0 (#734)
Co-authored-by: Michael Neale <michael.neale@gmail.com>
Co-authored-by: Wendy Tang <wendytang@squareup.com>
Co-authored-by: Jarrod Sibbison <72240382+jsibbison-square@users.noreply.github.com>
Co-authored-by: Alex Hancock <alex.hancock@example.com>
Co-authored-by: Alex Hancock <alexhancock@block.xyz>
Co-authored-by: Lifei Zhou <lifei@squareup.com>
Co-authored-by: Wes <141185334+wesrblock@users.noreply.github.com>
Co-authored-by: Max Novich <maksymstepanenko1990@gmail.com>
Co-authored-by: Zaki Ali <zaki@squareup.com>
Co-authored-by: Salman Mohammed <smohammed@squareup.com>
Co-authored-by: Kalvin C <kalvinnchau@users.noreply.github.com>
Co-authored-by: Alec Thomas <alec@swapoff.org>
Co-authored-by: lily-de <119957291+lily-de@users.noreply.github.com>
Co-authored-by: kalvinnchau <kalvin@block.xyz>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Rizel Scarlett <rizel@squareup.com>
Co-authored-by: bwrage <bwrage@squareup.com>
Co-authored-by: Kalvin Chau <kalvin@squareup.com>
Co-authored-by: Alice Hau <110418948+ahau-square@users.noreply.github.com>
Co-authored-by: Alistair Gray <ajgray@stripe.com>
Co-authored-by: Nahiyan Khan <nahiyan.khan@gmail.com>
Co-authored-by: Alex Hancock <alexhancock@squareup.com>
Co-authored-by: Nahiyan Khan <nahiyan@squareup.com>
Co-authored-by: marcelle <1852848+laanak08@users.noreply.github.com>
Co-authored-by: Yingjie He <yingjiehe@block.xyz>
Co-authored-by: Yingjie He <yingjiehe@squareup.com>
Co-authored-by: Lily Delalande <ldelalande@block.xyz>
Co-authored-by: Adewale Abati <acekyd01@gmail.com>
Co-authored-by: Ebony Louis <ebony774@gmail.com>
Co-authored-by: Angie Jones <jones.angie@gmail.com>
Co-authored-by: Ebony Louis <55366651+EbonyLouis@users.noreply.github.com>
2025-01-24 13:04:43 -08:00

113 lines
3.0 KiB
Markdown

---
draft: true
---
# Instructions for running cross to test release builds locally
## Prerequisites
Before start, check the comments in `Cross.toml` to turn on some commented configs for the target you want to build.
## Targets
### aarch64-unknown-linux-gnu
#### Build release
```sh
CROSS_BUILD_OPTS="--platform linux/amd64 --no-cache" CROSS_CONTAINER_OPTS="--platform linux/amd64" cross build --release --target aarch64-unknown-linux-gnu
```
#### Inspect container created by cross for debugging
```sh
docker run --platform linux/amd64 -it <image-id> /bin/bash
```
#### Testing the binary
1. Download docker image for testing environment
```sh
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker pull arm64v8/ubuntu
```
2. Run the container
pwd is the directory contains the binary built in the previous step on your host machine
```sh
docker run -v $(pwd):/app -it arm64v8/ubuntu /bin/bash
```
3. Install dependencies in the container and set up api testing environment
```sh
apt update
apt install libxcb1 libxcb1-dev libdbus-1-3 nvi
mkdir -p ~/.config/goose
# create goose config file
# set api key env variable
```
### x86_64-unknown-linux-gnu
#### Build release
```sh
CROSS_BUILD_OPTS="--platform linux/amd64 --no-cache" CROSS_CONTAINER_OPTS="--platform linux/amd64" cross build --release --target x86_64-unknown-linux-gnu
```
#### inspect container created by cross for debugging
```sh
docker run --platform linux/amd64 -it <image-id> /bin/bash
```
#### Testing the binary
1. Download docker image for testing environment
```sh
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker pull --platform linux/amd64 debian:latest
```
2. Run the container
pwd is the directory contains the binary built in the previous step on your host machine
```sh
docker run --platform linux/amd64 -it -v "$(pwd)":/app debian:latest /bin/bash
```
3. Install dependencies in the container and set up api testing environment
```sh
apt update
apt install libxcb1 libxcb1-dev libdbus-1-3 nvi
mkdir -p ~/.config/goose
# create goose config file
# set api key env variable
```
### aarch64-apple-darwin
#### build release
```sh
cross build --release --target aarch64-apple-darwin
```
There is no docker image available for aarch64-apple-darwin. It will fall back to your host machine for building the binary if your host machine matches.
#### testing the build
If the binary is signed with a certificate, run
```sh
xattr -d com.apple.quarantine goose
````
### x86_64-apple-darwin
#### build release
```sh
cross build --release --target x86_64-apple-darwin
```
There is no docker image available for x86_64-apple-darwin. It will fall back to your host machine for building the binary if your host machine matches.
#### testing the build
1. If the binary is signed with a certificate, run
```sh
xattr -d com.apple.quarantine goose
````
2. If you are on Apple Silicon (ARM), you can use Rosetta to test the binary
```sh
softwareupdate --install-rosetta # make sure Rosetta 2 is installed
```
```sh
arch -x86_64 ./goose help
```