Linux HOWTOs

About | Home | Search


ERROR: Slooooow dooooown... this page load was delayed.

HOWTO: binutils
Description: Various GNU compilers, assemblers, linkers, debuggers, etc.
Click here for ChangeLog
NOTE: I use GNU tar >= 1.13.25 so it's -j for .tar.bz2 files,
it's safe to assume that make, gcc, binutils, fileutils/coreutils, gawk, sed, and grep are prerequisites for almost everything


# binutils
# ========
# Slackware 13.37: binutils 2.20.51.0.8
# Slackware 14.0: binutils 2.22.52.0.2
# Slackware 14.1: binutils 2.23.52.0.1
# Slackware 14.2: binutils 2.26

# In the past there have been two slightly different home pages for
# binutils, but as I write this, they're the same:
# http://www.gnu.org/software/binutils/
# http://sources.redhat.com/binutils/
# https://www.sourceware.org/binutils/

# If you have trouble with the download URL(s) below, try here:
# https://ftp.gnu.org/gnu/binutils
# ftp://ftp.gnu.org/gnu/binutils
# https://sourceware.org/pub/binutils/releases/

# I pass --disable-nls to configure below because I'm in the US and only
# read/write English (well).  If this is not the case for you, leave that
# off below.


# binutils 2.31.1 - latest stable
# ===============
# Prerequisites:
# Bison
# m4
# flex
# texinfo
# itself (you need as, ranlib, etc. to build this)

# Get it
cd
test -f installed/binutils-2.31.1.tar.bz2 &&
 mv installed/binutils-2.31.1.tar.bz2 .
test ! -f binutils-2.31.1.tar.bz2 &&
 wget http://ftpmirror.gnu.org/binutils/binutils-2.31.1.tar.bz2

# Verify tarball w/ sha1sum:
# (this came from my gpg-verified tarball)
echo "1c5b0801b4857031d5626d917808cbd5c6401a4b  binutils-2.31.1.tar.bz2" | \
sha1sum -c

# Verify tarball w/ gpg:
( gpg --recv-keys DD9E3C4F > /dev/null 2>&1 || gpg --verify DD9E3C4F ) &&
 wget -nc http://ftpmirror.gnu.org/binutils/binutils-2.31.1.tar.bz2.sig &&
  gpg --verify binutils-2.31.1.tar.bz2.sig && rm binutils-2.31.1.tar.bz2.sig

# Extract the source
mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "binutils-*" -exec rm -r {} \;
tar xjvf ~/binutils-2.31.1.tar.bz2
cd binutils-2.31.1
test $UID = 0 && chown -R root:root .

# Verify the extracted files with md5sum, if it outputs nothing, then
# they're all OK:
md5sum -c md5.sum | egrep -v ": OK$"

# Configure the build for 64-bit
test $(uname -m) = 'x86_64' &&
./configure --prefix=/usr --infodir=/usr/info --libdir=/usr/lib64 \
--mandir=/usr/man --disable-nls

# Configure the build for anything else
test $(uname -m) != 'x86_64' &&
./configure --prefix=/usr --infodir=/usr/info --mandir=/usr/man \
--disable-nls

# Build
make

# Become root to install it
su

# Remove the Slackware package
test -x /sbin/removepkg && /sbin/removepkg binutils
find /usr/share/locale -type f -name "binutils.mo" -exec rm {} \;

# Copy newly compiled binaries in place so we can use them to install this
cp binutils/ranlib binutils/strings /usr/bin/
cp gas/as-new /usr/bin/as
cp ld/ld-new /usr/bin/ld
cp binutils/strip-new /usr/bin/strip

# If you did not create and install a package
make install

# Make sure everything is owned by your non-root user (or root if you're
# doing this as root) so you'll be able to remove the source directory
# later.
chown -R $(logname) .
chmod -R u+rw .

# Become yourself again
exit

# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/binutils-*.tar.*
mv binutils-2.31.1.tar.bz2 installed/


# binutils 2.21.52.0.2 - latest beta
# ====================
## I'll leave this outdated section unchanged for now.  No more
## beta versions at ftp.kernel.org, will check out frequency of snapshots
## at sourceware.org vs removing this section in favor of the git
## repository

# Use this one with the latest kernels, but remember that it's a beta; you
# may have trouble building/linking/___ing certain things, not likely, but
# definitely possible.

# Check the release notes before installing it:
# release.binutils-2.21.52.0.2

cd
test -f installed/binutils-2.21.52.0.2.tar.bz2 &&
 mv installed/binutils-2.21.52.0.2.tar.bz2 .
test ! -f binutils-2.21.52.0.2.tar.bz2 &&
 wget http://ftp.kernel.org/pub/linux/devel/binutils/\
binutils-2.21.52.0.2.tar.bz2

# Verify tarball w/ md5sum:
# (this came from my gpg-verified tarball)
echo "680e4cdfecfa14f5590b994150aa5c7e  binutils-2.21.52.0.2.tar.bz2" \
 | md5sum -c

# Verify tarball w/ sha1sum:
# (this also came from my gpg-verified tarball)
echo "db1a4ac65d71cb1bcaa587aa7936ea5445355fac  \
binutils-2.21.52.0.2.tar.bz2" | sha1sum -c

# Verify tarball w/ gpg:
( gpg --list-keys 517D0F0E > /dev/null 2>&1 || gpg --recv-keys 517D0F0E ) &&
 wget -nc http://ftp.kernel.org/pub/linux/devel/binutils/\
binutils-2.21.52.0.2.tar.bz2.sign &&
  gpg --verify binutils-2.21.52.0.2.tar.bz2.sign &&
   rm binutils-2.21.52.0.2.tar.bz2.sign

mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "binutils-*" -exec rm -r {} \;
tar xjvf ~/binutils-2.21.52.0.2.tar.bz2
cd binutils-2.21.52.0.2
test $UID = 0 && chown -R root:root .

# Configure and build it
./configure --prefix=/usr --infodir=/usr/info --mandir=/usr/man \
--disable-nls
make

# Become root to install it
su

# Remove the Slackware package
test -x /sbin/removepkg && /sbin/removepkg binutils
find /usr/share/locale -type f -name "binutils.mo" -exec rm {} \;

# Copy newly compiled binaries in place so we can use them to install this
cp binutils/ranlib binutils/strings /usr/bin/
cp gas/as-new /usr/bin/as
cp ld/ld-new /usr/bin/ld
cp binutils/strip-new /usr/bin/strip

# Install it
make install

# Make sure everything is owned by your non-root user (or root if you're
# doing this as root) so you'll be able to remove the source directory
# later.
chown -R $USER .
chmod -R u+rw .

# Become yourself again
exit

cd
mkdir -p -m 0700 installed
rm -f installed/binutils-*.tar.*
mv binutils-2.21.52.0.2.tar.bz2 installed/

Back to the list


Last updated: Tue, 07 Aug 2018 12:06:17 -0400
Jason Englander <jason at englanders dot us>