Jump to Navigation

Going on from here

Introduction

If you have followed all the steps in this guide, you will now have a working cross-compiler installed. So now you can generate programs which are linked against glibc-2. But before you go on, there are a couple of things which are useful to know.

Using libraries

If you want to link a program to both glibc-2 and another library, that other library must also have been linked against glibc-2. So you can not use your existing ncurses and X-libraries, for example; you must first generate copies which are linked against glibc-2 (and put them into /usr/i486-linux-libc6/lib).

Files to put under /usr/i486-linux-libc6

I have tried to setup things in such a way, that glibc-2 stuff and libc5 stuff are kept completely separate. The cross-compiler must, for example, only have access to include files for which the corresponding library is also available in glibc-2 format.

When you compile programs and libraries with the cross-compiler, you can safely put the binaries in /usr/bin instead of /usr/i486-linux-libc6/bin. In fact, /usr/i486-linux-libc6/bin would be a strange place to put them, because they would only be available if you put that in your path (presumably because you wish to use the cross-compiler). In fact, it does not contain glibc-2 executables, but regular libc-5 executables that do things with the glibc-2 format! But include files and libraries should always be put under respectively /usr/i486-linux-libc6/lib and /usr/i486-linux-libc6/include.

Configuring using the cross compiler

Lots of programs, especially all GNU programs, come with a configure command. When you have set the path to /usr/i486-linux-libc6/bin, you have a i486-pc-linux-gnu environment for all practical purposes. You can safely tell this to these programs.

Switching between compiler environments

I have written a small script (attached below) that facilitates switching between compilation environments. There is one draw-back though; it only works if you use bash(1) as your shell. You call switch.sh once, and after that you can use a new command switch to switch between environments:

. switch.sh       # the . is obligatory!
switch i486-linux-libc6

Local hierarchy

Subdirectories of /usr/local are often used to install things you have compiled yourself, and want to keep when the operating system and/or distribution is updated. Regrettably, the cross-compiler does not seek within this hierarchy for its include-files and library-files. You will have to use explicit switches to set the seekpath if you want to install libc6-libraries or libc6-include files locally and use them to compile other things with.



Historic_content | by Dr. Radut