Jump to Navigation

Examples

Introduction

Here you can find several examples of using the newly created glibc-2 compilation environment.

Creating native glibc2 binutils

In the third step of the installation, we have created some binary cross-utilities. These binary utilities operate on glibc-2 files, but the utilities themselves are libc-5 executables. It is very easy to recompile them and install them as glibc-2 executables: they will then be native utilities instead of cross-utilities (this is of course only possible because our platform can execute both formats).

I will assume you use bash as shell; if not, some commands may slightly differ. I will explain each step. Note that this is a global overview, and more extensive explanations can be found at the main binutils page. Remember to apply the patches on that page first - except for the third patch (softlinks), as they will do more harm than good in this case.

export PATH="/usr/i486-linux-libc6/bin:$PATH"

Enter the glibc-2 compilation environment.

./configure i486-pc-linux-gnu \
--enable-targets=i486-pc-linux-gnulibc1,i486-pc-linux-gnu \
--verbose --prefix=/usr \
--libdir=/usr/i486-linux-libc6/lib \
--includedir=/usr/i486-linux-libc6/include \
--bindir=/usr/i486-linux-libc6/bin

Our host format is i486-pc-linux-gnu, as we are now in the glibc-2 compilation environment. Our target format must also be i486-pc-linux-gnu. The --prefix and --whateverdir arguments are fairly typical, if you are configuring in the libc6-environment. Basically, you want everything installed on the usual places, except for the libraries and include files. In this specific case, the binaries also go into another directory, but usually you should not specify it.

Now edit ld/Makefile to change the tdir* variables.

make target_alias=i486-linux-libc6

This is the same command we used when creating the cross-utilties.

make install install-info target_alias=i486-linux-libc6
install -o root -g root -m 755 binutils/{ar,ranlib} /usr/i486-linux-libc6/bin
install -o root -g root -m 755 gprof/gprof /usr/i486-linux-libc6/bin
install -o root -g root -m 755 gas/as-new /usr/i486-linux-libc6/bin/as
install -o root -g root -m 755 gas/gasp-new /usr/i486-linux-libc6/bin/gasp
install -o root -g root -m 755 ld/ld-new /usr/i486-linux-libc6/bin/ld
install -o root -g root -m 755 binutils/nm-new /usr/i486-linux-libc6/bin/nm
install -o root -g root -m 755 binutils/strip-new /usr/i486-linux-libc6/bin/strip

There is a slight problem with the install target in the Makefiles, which inhibits the installation of most binaries if the tooldir is the same as the bindir. It would not be difficult to write a patch for it, but installing things by hand is not so bad either.

That's all! The only big difference lies in the places we install the files, and of course how we specify our host machine for configure.

If you wanted to, you could even generate cross-utilties which operate on libc-5 files, but are themselves glibc-2 executables, though I do not recommend it until glibc-2 is out of beta testing (hint: use the same configure line as above, but add --target=i486-pc-linux-gnulibc1).



Historic_content | by Dr. Radut