emilk / emilk/egui

Static Binaries

Open
#2,144 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
30.6k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
72

Description

First off, thank you for all of your work!

I had a look at [issue #339](https://github.com/emilk/egui/issues/339).

I am presuming that things have changed with egui's dependencies, because `ldd` shows that the binaries are dynamic:

```
linux-vdso.so.1 (0x00007fff6adfe000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00007f991c3cf000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x00007f991c37f000)
libexpat.so.1 => /usr/lib/libexpat.so.1 (0x00007f991c354000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f991c334000)
libm.so.6 => /usr/lib/libm.so.6 (0x00007f991b118000)
libc.so.6 => /usr/lib/libc.so.6 (0x00007f991af31000)
/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f991c4e7000)
libz.so.1 => /usr/lib/libz.so.1 (0x00007f991c318000)
libbz2.so.1.0 => /usr/lib/libbz2.so.1.0 (0x00007f991c305000)
libpng16.so.16 => /usr/lib/libpng16.so.16 (0x00007f991aef8000)
libharfbuzz.so.0 => /usr/lib/libharfbuzz.so.0 (0x00007f991ae0d000)
libbrotlidec.so.1 => /usr/lib/libbrotlidec.so.1 (0x00007f991adff000)
libgraphite2.so.3 => /usr/lib/libgraphite2.so.3 (0x00007f991addd000)
libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0x00007f991aca0000)
libbrotlicommon.so.1 => /usr/lib/libbrotlicommon.so.1 (0x00007f991ac7d000)
libpcre2-8.so.0 => /usr/lib/libpcre2-8.so.0 (0x00007f991abe2000)
```

I tried compiling with [cross](https://github.com/cross-rs/cross) using: `env RUST_FONTCONFIG_DLOPEN=on cross build --target x86_64-unknown-linux-musl`

I have a `Cross.toml` with the following contents:

```
[target.x86_64-unknown-linux-musl.env]
passthrough = ["RUST_FONTCONFIG_DLOPEN"]
```

I tried with `RUST_FONTCONFIG_DLOPEN=on`, as suggested [here](https://docs.rs/fontconfig/latest/fontconfig/).

Cross outputs these errors:

```
--- stderr
thread 'main' panicked at '`"pkg-config" "--libs" "--cflags" "fontconfig" "fontconfig >= 2.11.1"` did not exit successfully: exit status: 1
error: could not find system library 'fontconfig' required by the 'servo-fontconfig-sys' crate

--- stderr
Package fontconfig was not found in the pkg-config search path.
Perhaps you should add the directory containing `fontconfig.pc'
to the PKG_CONFIG_PATH environment variable
No package 'fontconfig' found
Package fontconfig was not found in the pkg-config search path.
Perhaps you should add the directory containing `fontconfig.pc'
to the PKG_CONFIG_PATH environment variable
No package 'fontconfig' found
', /cargo/registry/src/github.com-1ecc6299db9ec823/servo-fontconfig-sys-5.1.0/build.rs:34:17
```

Something similar, but not really helpful is [this issue](https://github.com/alacritty/alacritty/issues/5564)

Is there something obvious I am missing to get a static binary?

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the `cross build --target x86_64-unknown-linux-musl` command with the shown `Cross.toml` settings and inspect the `servo-fontconfig-sys` `build.rs` error. The work is done when the egui binary builds for the musl target and `ldd` confirms the intended static linking behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, rust
Domain
build-system, desktop-dev, operating-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.