I recently told someone I had done this and they suggested I post it cause some people seem to be have problems.
So for what it’s worth:
(& by the way, anyone on here in Tokyo)
I successfully build qml (latest version) and have it working with 32-bit kdb+/q
I’m on a 64-bit linux Ubuntu 14.04.2 LTS
Before starting, check if your GNU gcc compiler will successfully compile a c program to 32 bit, because you have to build qml to 32 bit version, as q is 32 bit.
gcc -m32 helloWorld.c -o helloWorld
if this doesn’t work, figure that out somehow. Google compiling to 32 bit on 64 bit architecture.
I pulled in the latest qml source https://github.com/zholos/qml by Download ZIP on the middle right side.
Unzip it by default to qml-master.
The parameters for the various qml make files are set by running the .configure script file.
And here’s the key, you can pass in parameters to it. (as documented in top of the configure file.)
./configure KXARCH=l32 FLAGS=-m32 --build-blas --build-lapack |& tee -a ~/logs/qmlconfigure.txt
Note 1
my KXARCH argument to the configure script is “l” because I’m on linux. If you are not linux, figure out which you should pass. have a look in configure file.
Note 2
FLAGS=-m32 sets this in various make files to build 32 bit version on QML. (That’s why I suggested you check if your gcc -m32 works first.)
Note 3
If you ask it to (i.e. using --build-blas --build-lapack) qml will actually pull in and build (a 32 bit version of) blas and lapack and link to them. And eventually, these are all wrapped up (32-bit qml, blas, lapack) in the final qml.so that gets generated. So it doesn’t matter if you have 64 bit version of blas and lapack elsewhere on your machine, or 32 bit versions for that matter either.
Note 4
the |& tee … just outputs to a log file, so you can see and keep the results. Mine are posted below.
If all good, with the configure output, then run
make |& tee -a ~/logs/qmlmake.txt
I’ve attached my qmlmake.txt log.
(I didn’t run make test or make install.)
If your make has run correctly, you’ll have got to the following which will create qml.so in the ./qml-master/src/ folder:
gcc -m32 -fPIC -pipe -shared -o qml.so const.o alloc.o util.o opt.o libm.o cephes.o lapack.o conmin.o conmax.o nlopt.o \
-L../lib -lprob -lconmax -lnlopt \
\
-llapack \
-lrefblas \
-Wl,-Bstatic -lgfortran -Wl,-Bdynamic \
-lm \
\
-Wl,–version-script,qml.mapfile
strip -s qml.so
make[1]: Leaving directory `/home/john/q/qml-master/src’
build complete.
If so, copy the qml.so to your q l32 folder, where q lives. In my case ~/q/l32/
then copy qml.q (which is also in the ./qml-master/src folder) to your q folder where q.k lives. Mine is ~/q/
Then load qml in q and a quick touch test by checking for .qml.pi
\l qml.q
.qml.pi
As per above, .configure was run with
./configure KXARCH=l32 FLAGS=-m32 --build-blas --build-lapack |& tee -a ~/logs/qmlconfigure.txt
q operating system… l64 (detected from host)
q version… 3 (default)
q home… /home/john/q (default)
looking for GNU make… make
looking for C compiler… gcc (default)
checking if C compiler compiles… yes
checking if C compiler links… yes
selecting C optimization options… -O2 -fno-strict-aliasing
selecting C floating-point options… -ffloat-store
looking for C compiler for build-time programs… gcc (default)
checking if build-time C compiler compiles… yes
checking if build-time C compiler links… yes
checking if build-time C compiler output runs… yes
looking for Fortran compiler… gfortran (default)
checking if Fortran compiler compiles… yes
checking if Fortran compiler links… yes
selecting Fortran optimization options… -O2
selecting Fortran floating-point options… -ffloat-store
selecting Fortran thread safety options… -frecursive
looking for binutils… ar (default)
selecting target options… -m32
selecting additional compiler options… -pipe
selecting shared library options… -fPIC
selecting how to export specific symbols… -Wl,–version-script
selecting additional libraries for Fortran… -lgfortran
selecting how to link a specific library statically… -Wl,-Bstatic
checking if Fortran locals are placed on stack… yes
will build BLAS
will build LAPACK
checking if patch program works… yes
looking for http downloader… wget
phoning home… just kidding
looking for sha256 program… sha256sum
writing configuration to config.mk
now run make