Last active
March 19, 2025 18:42
-
-
Save cfstras/9f94a710c90d0161f23d to your computer and use it in GitHub Desktop.
Build static versions of binutils, for example ld, gprof, nm, strip, objdump, ar, strings; with mingw or on *nix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
See the bash script below. :) | |
Tested on debian bookworm-slim (`docker pull debian:bookworm-slim`). | |
### Prerequisites | |
```bash | |
apt update | |
apt install -y build-essential wget bison | |
``` | |
### Build | |
```bash | |
wget https://gist.githubusercontent.com/cfstras/9f94a710c90d0161f23d/raw/build.sh | |
chmod a+x build.sh | |
./build.sh | |
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
VERSION=2.41 | |
[[ -s "binutils-$VERSION.tar.gz" ]] || wget "http://ftp.gnu.org/gnu/binutils/binutils-$VERSION.tar.gz" | |
tar xzf "binutils-$VERSION.tar.gz" | |
cd "binutils-$VERSION" | |
./configure --disable-nls --prefix="$(pwd)/bin" | |
make configure-host | |
make LDFLAGS="-all-static" | |
make install | |
echo "output in binutils-$VERSION/bin/bin:" | |
ls bin/bin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@rubyFeedback Just tested this successfully on Debian bookworm -- what OS and compiler are you using?