Re: Scsh on 64-bit systems

"Trent W. Buck" <[email protected]> Thu, 20 Nov 2008 11:31:22 +1100
Newsgroups gmane.lisp.scheme.scsh
Message-ID <[email protected]>
On Wed, Nov 19, 2008 at 11:51:10PM +0800, Ebzzry wrote:
> Thank you for Scsh. I've been using it for quite some time now  and it
> is one tool that I always have wherever I go.
> 
> However, when I migrated to a newer system, I found that I can longer
> use Scsh the way it was before: x86_64 systems. I have been able to
> use Scsh inside a chroot and use some wrappers, but I'm not able to
> run programs in the 64-bit environment, say for example via `run'.

Short of chrooting, there are two ways to run scsh on AMD64:

1) you build scsh on a 32-bit system, change the relevant constants,
then rebuild the bootstrapping C code.  From there, you can prepare a
patch for the original tarball that changes it from assuming 32-bit to
assuming 64-bit.  I believe Taylor Campbell has done work on this.

2) you abuse AMD64's biarch support to run a 32-bit image.  This
   basically means installing the appropriate 32-bit libraries and
   cross-compiler, then building with -m32 in CFLAGS.

   Note that this approach does not work for all 64-bit systems!  Some
   other 64-bit architectures do not have biarch support.

   Here is the code I use to generate Debian scsh packages for AMD64.

    if test x86_64 = "$(uname -m)"
    then
        ## On AMD64, you need to jump through some hoops to get scsh working.
        ## Ensure your sources.list has deb-src entries for main and universe
        apt-get update
        apt-get build-dep scsh-0.6
        apt-get install libc6-dev-i386 ia32-libs gcc-multilib
        apt-get source scsh-0.6
        cd scsh-0.6*/
        sed -i '/CFLAGS = -g -Wall/ s/$/ -m32/' debian/rules
        sed -i '/Cpu:/ s/$/,amd64/' debian/control.in
        debian/rules debian/control
        dpkg-buildpackage -uc -us
        cd ..
        dpkg -i scsh*deb
    fi