s i s t e m a o p e r a c i o n a l m a g n u x l i n u x | ~/ · documentação · suporte · sobre |
Next
Previous
Contents
6. Compiling with the non-primary libc.
There are times you will want to use an alternate library to compile your programs with. This section explains how to accomplish this, using the directories and installation names used in the examples in the previous two sections. Remember to change the names to fit your setup.
6.1 A warning when using non-primary libcs.
Before compiling any programs which is used in the system boot process,
remember that if the program is dynamically linked and is used before the
non-root partitions are mounted, all linked libraries must be on the root
partition. Following the installation process in the previous section
for installing glibc as your primary C library, the old libc is left in
6.2 Compiling programs with a test glibc.
To compile a program with a test-install glibc, you need to reset the
include paths to point to the glibc includes. Specifying
"-nostdinc" will negate the normal paths, and
"-I/usr/i486-linuxglibc2/include" will point
to the glibc includes. You will also need to specify the gcc includes,
which are found in To link a program with a test-install glibc, you need to specify the gcc setup. This is done by using the option "-b i486-linuxglibc2". For most programs, you can specify these new options by adding them to the
If you are using a configure script, define the $CFLAGS
and $LDFLAGS shell variables (by using env/setenv for
csh/tcsh, or set/export for sh/bash/etc) before running configure. The
makefiles generated by this should contain the proper $CFLAGS
and $LDFLAGS . Not all configure scripts
will pick up the variables, so you should check after running configure
and edit the makefiles by hand if necessary.
If the programs you are compiling only call gcc (and not cpp or binutils directly), you can use the following script to save having to specify all of the options each time:
You can then use this script instead of "gcc" when compiling.
6.3 Compiling programs with libc 5 when glibc is primary library.To compile a program with your old libraries when you have installed glibc as your main library, you need to reset the include paths to the old includes. Specifying "-nostdinc" will negate the normal paths, and "-I/usr/i486-linuxlibc5/include" will point to the glibc includes. You must also specify "-I/usr/lib/gcc-lib/i486-linuxlibc5/2.7.2.2/include" to include the gcc specific includes. Remember to adjust these paths based on the what you named the new directories and your gcc version. To link a program with your old libc, you need to specify the gcc setup. This is done by using the option "-b i486-linuxlibc5". For most programs, you can specify these new options by appending them
to the
If you are using a configure script, define the $CFLAGS
and $LDFLAGS shell variables (by using env/setenv for
csh/tcsh, or set/export for sh/bash/etc) before running configure. The
makefiles generated by this should contain the proper
$CFLAGS and $LDFLAGS . Not all configure
scripts will pick up the variables, so you should check after running
configure and edit the makefiles by hand if necessary.
If the programs you are compiling only call gcc (and not cpp or binutils directly), you can use the following script to save having to specify all of the options each time:
You can then use this script instead of "gcc" when compiling.
Next Previous Contents |