Skip to content

Conversation

@joncinque
Copy link
Contributor

Problem

The current build scripts run as normal commands in CI machines, which means that certain shared libraries are linked into binaries. For the most part, this is fine, but some binaries, such as solana-lldb, have a few extra shared libs:

~/.c/s/v/p/l/bin> ldd lldb
        linux-vdso.so.1 (0x00007fea34cba000)
        liblldb.so.19.1-rust-dev => /home/jon/.cache/solana/v1.51/platform-tools/llvm/bin/../lib/liblldb.so.19.1-rust-dev (0x00007fea2dc00000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007fea2d800000)
        libm.so.6 => /usr/lib/libm.so.6 (0x00007fea2daf2000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007fea2dac5000)
        libc.so.6 => /usr/lib/libc.so.6 (0x00007fea2d400000)
        /lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007fea34cbc000)
        libpython3.10.so.1.0 => not found
        libpanel.so.6 => not found
        libncurses.so.6 => not found
        libtinfo.so.6 => /usr/lib/libtinfo.so.6 (0x00007fea2d791000)
        libxml2.so.2 => /usr/lib/libxml2.so.2 (0x00007fea2d643000)
        libedit.so.2 => not found
        liblzma.so.5 => /usr/lib/liblzma.so.5 (0x00007fea2d3cc000)
        libz.so.1 => /usr/lib/libz.so.1 (0x00007fea2daac000)
        libicuuc.so.76 => /usr/lib/libicuuc.so.76 (0x00007fea2d000000)
        libicudata.so.76 => /usr/lib/libicudata.so.76 (0x00007fea2b000000)

On my local machine, you'll see that a few of these libraries aren't found. This isn't a good experience for users.

Also, when packaging the platform tools for nix, we have to do a lot of extra patching:

https://github.com/arijoon/solana-nix/blob/65a7cc4a9fff662fc6077b8b49bca6d3c96883c8/solana-platform-tools.nix#L92

Summary of changes

Build rust and cargo using nix, which ensures static linking of executables. This mostly impacts llvm bins, and the size for all bins is roughly the same. Some are slightly bigger or smaller, within 1% of the size.

This will also make it much easier to package the bins in nix.

#### Problem

The current build scripts run as normal commands in CI machines, which
means that certain shared libraries are linked into binaries. For the
most part, this is fine, but some binaries, such as `solana-lldb`, have
a few extra shared libs:

```
~/.c/s/v/p/l/bin> ldd lldb
        linux-vdso.so.1 (0x00007fea34cba000)
        liblldb.so.19.1-rust-dev => /home/jon/.cache/solana/v1.51/platform-tools/llvm/bin/../lib/liblldb.so.19.1-rust-dev (0x00007fea2dc00000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007fea2d800000)
        libm.so.6 => /usr/lib/libm.so.6 (0x00007fea2daf2000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007fea2dac5000)
        libc.so.6 => /usr/lib/libc.so.6 (0x00007fea2d400000)
        /lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007fea34cbc000)
        libpython3.10.so.1.0 => not found
        libpanel.so.6 => not found
        libncurses.so.6 => not found
        libtinfo.so.6 => /usr/lib/libtinfo.so.6 (0x00007fea2d791000)
        libxml2.so.2 => /usr/lib/libxml2.so.2 (0x00007fea2d643000)
        libedit.so.2 => not found
        liblzma.so.5 => /usr/lib/liblzma.so.5 (0x00007fea2d3cc000)
        libz.so.1 => /usr/lib/libz.so.1 (0x00007fea2daac000)
        libicuuc.so.76 => /usr/lib/libicuuc.so.76 (0x00007fea2d000000)
        libicudata.so.76 => /usr/lib/libicudata.so.76 (0x00007fea2b000000)
```

On my local machine, you'll see that a few of these libraries aren't
found. This isn't a good experience for users.

Also, when packaging the platform tools for nix, we have to do a lot of
extra patching:

https://github.com/arijoon/solana-nix/blob/65a7cc4a9fff662fc6077b8b49bca6d3c96883c8/solana-platform-tools.nix#L92

#### Summary of changes

Build rust and cargo using nix, which ensures static linking of
executables. This mostly impacts llvm bins, and the size for all bins is
roughly the same. Some are slightly bigger or smaller, within 1% of the
size.

This will also make it much easier to package the bins in nix.
joncinque added a commit to joncinque/rust that referenced this pull request Sep 22, 2025
#### Problem

More information at anza-xyz/platform-tools#109,
but Rust is currently built with a few additional shared libraries.

#### Summary of changes

Add a `--nix` flag to build.sh to optionally build with nix-shell.
joncinque added a commit to joncinque/cargo that referenced this pull request Sep 22, 2025
#### Problem

More information at anza-xyz/platform-tools#109,
but cargo is currently built with a few shared libraries.

#### Summary of changes

Add a shell.nix file for creating a nix-shell environment.
joncinque added a commit to joncinque/cargo that referenced this pull request Oct 15, 2025
#### Problem

More information at anza-xyz/platform-tools#109,
but cargo is currently built with a few shared libraries.

#### Summary of changes

Add a shell.nix file for creating a nix-shell environment.
LucasSte pushed a commit to anza-xyz/cargo that referenced this pull request Oct 17, 2025
#### Problem

More information at anza-xyz/platform-tools#109,
but cargo is currently built with a few shared libraries.

#### Summary of changes

Add a shell.nix file for creating a nix-shell environment.
LucasSte pushed a commit to anza-xyz/rust that referenced this pull request Oct 17, 2025
* build: Add `--nix` flag to build rust in nix-shell

#### Problem

Recreation of #139.

More information at anza-xyz/platform-tools#109,
but Rust is currently built with a few additional shared libraries.

#### Summary of changes

Add a `--nix` flag to build.sh to optionally build with nix-shell.

* Wrap arg parsing in while loop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant