Skip to content

Commit 9d4b14b

Browse files
committed
Use static linking to avoid possible runtime issues
1 parent fd88e1a commit 9d4b14b

6 files changed

Lines changed: 110 additions & 38 deletions

File tree

.cargo/config.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[build]
2+
target = "x86_64-unknown-linux-musl"

.github/workflows/build-and-test.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,18 @@ jobs:
2626

2727
steps:
2828
- uses: actions/checkout@v6
29+
30+
- name: Install musl tools
31+
run: sudo apt-get install -y musl-tools
32+
2933
- name: Build
3034
run: cargo build
35+
3136
- name: Run tests
3237
run: cargo test
38+
3339
- name: Check formatting
3440
run: cargo fmt --check
41+
3542
- name: Run linting
3643
run: cargo clippy

.github/workflows/make-release.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,16 @@ jobs:
1414
steps:
1515
- uses: actions/checkout@v6
1616

17+
- name: Install musl tools
18+
run: sudo apt-get install -y musl-tools
19+
1720
- name: Build Release Binaries
1821
run: cargo build --release
1922

2023
- uses: actions/upload-artifact@v7
2124
with:
2225
name: litterbox
23-
path: target/release/litterbox
26+
path: target/x86_64-unknown-linux-musl/release/litterbox
2427

2528
release:
2629
needs: build

Cargo.lock

Lines changed: 90 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,7 @@ N.B. it is again emphasised that Litterbox does not come with any warranties or
3636

3737
## Dependencies
3838

39-
Litterbox is a mostly static binary and only links to a few very standard shared libraries (that should exist on most Linux systems) as shown below:
40-
41-
```bash
42-
gerhard@big-desktop:~$ ldd $(which litterbox)
43-
linux-vdso.so.1 (0x00007bef700a4000)
44-
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007bef70060000)
45-
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007bef6eef3000)
46-
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007bef6ec00000)
47-
/lib64/ld-linux-x86-64.so.2 (0x00007bef700a6000)
48-
```
49-
50-
It also depends on `podman` being installed on your system and the `mknod` command being available.
39+
Litterbox is a mostly static binary and therefore does not depend on any system libraries. However,it depends on `podman` being installed on your system and the `mknod` command being available.
5140

5241
Hence, almost any modern Linux distro on which you can install `podman` should work. In the future, the goal is to also take advantage of `Landlock` for added security on systems where it is available (i.e. most modern distros).
5342

@@ -69,6 +58,8 @@ cd litterbox
6958
cargo build --release
7059
```
7160

61+
You will also need to have `musl-gcc` installed on your system as this is required for stating linking.
62+
7263
## Usage
7364

7465
### 1. Define

rust-toolchain.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[toolchain]
2+
channel = "stable"
3+
targets = ["x86_64-unknown-linux-musl"]
4+
components = ["rustfmt", "clippy"]

0 commit comments

Comments
 (0)