Messing with the Dynamic Linker to run Old Versions of Maple

Currently our funds are a little lacking for upgrading licenses at $WORK. Fortunately many of our users don't need the functionality in the newer versions of the math software we provide in the department. Unfortunately for me, that means I needed to figure out a way to keep really old versions of Maple running on newer equipment.

For practical purposes, here are the steps to sandbox such an app, with old versions of libc, the dynamic linker, and some other libraries it needs.

Illustrating the difference between the architectures and kernels

root@newmapleserver# uname -a
Linux 2.6.32-358.23.2.el6.x86_64 #1 SMP Wed Oct 16 18:37:12 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

root@oldmapleserver# uname -a 
Linux newton 2.6.8-4-686-smp #1 SMP Mon Apr 30 08:15:22 UTC 2007 i686 GNU/Linux

Copy the installed maple distribution from the old server to the new server

root@newmapleserver# rsync -av root@oldmapleserver:/usr/local/maple/ /usr/local/maple/

Copy some of the necessary libraries

# Make a new place for the copied libraries from the old system 
root@newmapleserver# mkdir -p /usr/local/maple/syslib

# Copy the libs
root@newmapleserver# scp -r "root@oldmapleserver:/lib/" /usr/local/maple/syslibs/
root@newmapleserver# scp -r "root@oldmapleserver:/lib/" /usr/local/maple/syslibs/
root@newmapleserver# scp -r "root@oldmapleserver:/lib/" /usr/local/maple/syslibs/
root@newmapleserver# scp -r "root@oldmapleserver:/lib/" /usr/local/maple/syslibs/

Modify the runner scripts to include our freshly-downloaded old libraries

# in /usr/local/maple/bin/maple find the line exporting LD_LIBRARY_PATH 
# and add $MAPLE/syslib to the beginning


Now the fun part

The actual binaries are located in ${MAPLE}/bin.IBM_INTEL_LINUX and are hard-coded to use /lib/ which is much newer than maple expects. It appears that there was some symbol shuffling somewhere along the way which gives the following error:

root@newmapleserver# /usr/local/maple/bin/maple
cmaple: relocation error: /usr/local/maple/syslib/ symbol _dl_out_of_memory, version GLIBC_PRIVATE not defined in file with link time reference

To fix this we need a way to use our own dynamic linker ( to run the executable.

Let's create our own dynamic linker to use with maple:

# We have already downloaded from oldmapleserver and put it in
# syslibs so we just need to put it in /lib (We will find out why in a
# moment)
root@newmapleserver# ln -svf /usr/local/maple/syslibs/ /lib/
`/lib/' -> `/usr/local/maple/syslibs/'

Now find all the binaries that use

root@newmapleserver# cd /usr/local/maple/bin.IBM_INTEL_LINUX
root@newmapleserver# grep -l '' ./*

All of these binaries contain a hard-coded reference to /lib/ somewhere. To make them run properly we need a copy of the correct dynamic linker and we need the full path name (including the filename) to be the same number of characters as /lib/ (i.e. we have 18 chars to work with). Otherwise, the executable would be off by a few bytes somewhere and would likely result in segfaults. Luckily the symlink we created above, /lib/, has 18 characters so we can use that.

# still in /usr/local/maple/bin.IBM_INTEL_LINUX
root@newmapleserver# sed '' -i ./*

Just as a test, we can run the maple binary just as the script would by setting the correct env variables

root@newmapleserver# MAPLE=/usr/local/maple \

    |\^/|     Maple 7 (IBM INTEL LINUX)
._|\|   |/|_. Copyright (c) 2001 by Waterloo Maple Inc.
 \  MAPLE  /  All rights reserved. Maple is a registered trademark of
 <____ ____>  Waterloo Maple Inc.
      |       Type ? for help.
> 1+2;

Et VoilĂ 

We now have a working Maple install on modern hardware

Copyright © 2012-2014 Brian Stinson. All Rights Reserved