Make musl-gcc from scratch (#828)

This commit is contained in:
Evan Simkowitz 2024-09-24 19:41:58 -07:00 committed by GitHub
parent 84673c945c
commit e7a510c0d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 41 additions and 12 deletions

View File

@ -37,7 +37,17 @@ jobs:
if: matrix.platform == 'linux'
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y libarchive-tools libopenjp2-tools rpm squashfs-tools musl
sudo apt-get install --no-install-recommends -y libarchive-tools libopenjp2-tools rpm squashfs-tools build-essential
# We use musl-gcc instead of glibc for cgo compilation as it is more-easily statically linked
- name: Setup musl-gcc (Linux only)
if: matrix.platform == 'linux'
run: |
git clone https://git.musl-libc.org/git/musl
cd musl
./configure
make
sudo make install
# The pre-installed version of the AWS CLI has a segfault problem so we'll install it via Homebrew instead.
- name: Upgrade AWS CLI (Mac only)

View File

@ -56,13 +56,6 @@ jobs:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: stable
cache-dependency-path: |
go.sum
- uses: actions/setup-node@v4
with:
node-version: ${{env.NODE_VERSION}}
@ -71,6 +64,23 @@ jobs:
corepack enable
yarn install
- name: Setup Go (Go only)
if: matrix.language == 'go'
uses: actions/setup-go@v5
with:
go-version: stable
cache-dependency-path: |
go.sum
# We use musl-gcc instead of glibc for cgo compilation as it is more-easily statically linked
- name: Setup musl-gcc (Go only)
if: matrix.language == 'go'
run: |
git clone https://git.musl-libc.org/git/musl
cd musl
./configure
make
sudo make install
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
@ -95,7 +105,6 @@ jobs:
- name: Build (Go only)
if: matrix.language == 'go'
run: |
sudo apt update && sudo apt install -y musl
task build:server
task build:wsh

View File

@ -25,13 +25,23 @@ sudo apt install build-essential zip
Fedora:
```sh
sudo dnf install make automake gcc gcc-c++ kernel-devel
sudo dnf install make automake gcc gcc-c++ kernel-devel zip
```
Arch:
```sh
sudo pacman -S base-devel
sudo pacman -S base-devel zip
```
We also require `musl-gcc` for statically linking CGO. Run the following from wherever you keep your source code:
```sh
git clone https://git.musl-libc.org/git/musl
cd musl
./configure
make
sudo make install
```
#### Windows

View File

@ -95,7 +95,7 @@ tasks:
ARCHS:
sh: echo {{if eq "arm" ARCH}}arm64{{else}}{{ARCH}}{{end}}
GO_LDFLAGS: -linkmode 'external' -extldflags=-static
GO_ENV_VARS: CC=musl-gcc
GO_ENV_VARS: CC=/usr/local/musl/bin/musl-gcc
build:server:internal:
requires: