Difference between revisions of "Infrastructure/software/glibc"

From Nordic Language Processing Laboratory
Jump to: navigation, search
(Background)
(Usage)
Line 33: Line 33:
  
 
= Usage =
 
= Usage =
 +
 +
To make a binary use our custom installation of the GNU C Library, we need to
 +
make sure the modern version of the dynamic linker is used, with the location
 +
of the modern C Library at the front of the dynamic library load path.
 +
For example:
 +
<pre>
 +
#!/bin/sh
 +
 +
exec /projects/nlpl/software/glibc/2.18/lib/ld-linux-x86-64.so.2 \
 +
  --library-path /projects/nlpl/software/glibc/2.18/lib:${LD_LIBRARY_PATH} \
 +
  /projects/nlpl/software/tensorflow/1.11/bin/.python3.5 "$@"
 +
</pre>
 +
 +
We should generalize the above a little more, i.e. make the script determine
 +
the actual binary to be invoked as a function of <tt>$0</tt>.

Revision as of 15:10, 19 September 2018

Background

The operating system on Abel dates back to the original year of installation (2012, for all we recall). While many development tools and libraries are available in newer versions (through the module system), the version of the basic GNU C Library is intricately linked to the Linux kernel. Some packages that are distributed in pre-compiled form (typically as Python wheels) require more recent versions of the C Library. A little bit of trickery makes it possible to get these binaries to execute on Abel, using a custom, NLPL-specific installation of the GNU C Library and its dynamic linker.

Installation

wget https://ftp.gnu.org/gnu/glibc/glibc-2.18.tar.bz2
tar jpSxf glibc-2.18.tar.bz2
cd glibc-2.18
mkdir build
cd build
module purge
module load gcc/4.9.2 cuda/8.0
../configure --prefix=/projects/nlpl/software/glibc/2.18
make -j 8
make install
make localedata/install-locales
cp -pr /etc/ld.so.conf* /projects/nlpl/software/glibc/2.18/etc
/projects/nlpl/software/glibc/2.18/sbin/ldconfig 
ln -s /usr/share/zoneinfo/Europe/Oslo /projects/nlpl/software/glibc/2.18/etc/localtime

Usage

To make a binary use our custom installation of the GNU C Library, we need to make sure the modern version of the dynamic linker is used, with the location of the modern C Library at the front of the dynamic library load path. For example:

#!/bin/sh

exec /projects/nlpl/software/glibc/2.18/lib/ld-linux-x86-64.so.2 \
  --library-path /projects/nlpl/software/glibc/2.18/lib:${LD_LIBRARY_PATH} \
  /projects/nlpl/software/tensorflow/1.11/bin/.python3.5 "$@"

We should generalize the above a little more, i.e. make the script determine the actual binary to be invoked as a function of $0.