So you want to test out a glibc build, and you don't want to install it over your existing system glibc. Here are some tips:

building glibc without installing

Do "configure" and "make", but don't run "make install". Compile your test program, and invoke it with the loader you built. This is also how the "make check" runs tests. Note: if the executable under test resides in the current directory, don't forget to use "./" before the name.

GLIBC=<path to the GLIBC build directory>

GCONV_PATH=${GLIBC}/iconvdata LC_ALL=C     \
${GLIBC}/elf/ld.so.1 --library-path \
${GLIBC}:\
${GLIBC}/math:\
${GLIBC}/elf:\
${GLIBC}/dlfcn:\
${GLIBC}/nss:\
${GLIBC}/nis:\
${GLIBC}/rt:\
${GLIBC}/resolv:\
${GLIBC}/crypt:\
${GLIBC}/nptl:\
${GLIBC}/dfp \
<executable to test>

building glibc with installing

Do "configure" with a --prefix install directory that you can write to, then "make" and "make install". Compile your test program and give some extra options to gcc to use the install directory as the sysroot, and some options to the linker to set the shared library search path and dynamic linker. It is a good idea to verify the location of the dynamic linker using "readelf" and the library search paths with "ldd". (See loader tips and tricks)

SYSROOT=<path to the GLIBC install directory>

gcc ... \
  --sysroot=${SYSROOT} \
  -Wl,--rpath=${SYSROOT}/lib \
  -Wl,--dynamic-linker=${SYSROOT}/lib/ld.so.1

None: Testing/Builds (last edited 2008-07-10 00:00:32 by PeteEberlein)