Getting St George bank's WebPay library working under FreeBSD

St George supply a shared library for RedHat Linux 9 at https://www.ipg.stgeorge.com.au We want it to run it using FreeBSD for various reasons, the least of which is that RH9 hasn't been supported for more than a year. (Actually, the real reason is that we have a client using FreeBSD that doesn't want to use the Java API.)

The current version (released Jan 2004) will work under FreeBSD 4 with a few steps:

  1. Install the linux emulation ports:

    emulators/linux_base-rh-9
    devel/linux_devtools
    devel/linux-glib2

  2. Install the kerberos5 and openssl libaries using RPMs.

    RPMFLAGS="--root /compat/linux --dbpath /var/lib/rpm --nodeps --replacepkgs --ignoreos --ignorearch"
    rpm -U $RPMFLAGS krb5-libs-1.2.7-10.i386.rpm
    rpm -U $RPMFLAGS openssl-0.9.7a-20.2.i386.rpm

  3. Copy the webpay library to both usr/lib directories:

    cp -p libwebpayclient.so /compat/linux/usr/lib
    cp -p libwebpayclient.so /usr/lib

  4. Add kerberos to the dynamic linker path and run ldconfig:

    echo /usr/kerberos/lib >> /compat/linux/etc/ld.so.conf
    /compat/linux/sbin/ldconfig

  5. Override the compiler path to use the Linux version by including the following stuff in the webpayclient binary's Makefile:


    CC = /compat/linux/usr/bin/cc -B/usr/compat/linux/usr -B/usr/compat/linux/usr/local -B/usr/compat/linux/lib \
    -B/usr/compat/linux/usr/lib -I/usr/compat/linux/usr/include/g++

A make should now work, and the binary should run:

sushi:~/LinuxWebPayAPI/webpayC++-1.8# make doComp

Compiling BaseTest.cpp.

/compat/linux/usr/bin/cc -B/usr/compat/linux/usr  -B/usr/compat/linux/usr/local -B/usr/compat/linux/lib \
  -B/usr/compat/linux/kerberos/lib -B/usr/compat/linux/usr/lib   -I/usr/compat/linux/usr/include/g++ \
  BaseTest.cpp /compat/linux/lib/libwebpayclient.so -DLINUX -o baseTest
/usr/bin/ld: /lib/libgcc_s.so.1: warning: unexpected redefinition of `__divdi3@GLIBC_2.0'
/usr/bin/ld: /lib/libgcc_s.so.1: warning: unexpected redefinition of `__umoddi3@GLIBC_2.0'
/usr/bin/ld: /lib/libgcc_s.so.1: warning: unexpected redefinition of `__udivdi3@GLIBC_2.0'
/usr/bin/ld: /lib/libgcc_s.so.1: warning: unexpected redefinition of `__moddi3@GLIBC_2.0'
chmod u+x baseTest
chmod go-w baseTest

Compilation complete. baseTest created.

sushi:~/LinuxWebPayAPI/webpayC++-1.8# ./baseTest

Native Webpay Client Test
=========================
usage: BaseTest.exe <serverlist> <port> <clientid> <cert path> <cert pass> <ca_file> <num_iters> {"debug" or "no debug"}>

We're now free of RH9 - Cool :-)