I spent about an hour today getting Carlos Becker’s SQBLib package for gradient boosted tree regression in matlab working. The issue is that it depends on liblbfgs, and following the instruction Carlos gave for compiling liblbfgs resulted in errors when MATLAB tried to link liblbfgs into his code.
Specifically, I got a mysterious error like
/usr/bin/ld: /home/agittens/Downloads/liblbfgs-1.10/lib/lbfgs.o: relocation R_X86_64_32S against `.text' can not be used when making a shared object; recompile with -fPIC.
See the original install instructions. Here’s the fix that worked for me on a 64-bit Linux box:
./configure --disable-shared --enable-static --enable-sse2from the liblbfgs root directory
make --dry-runto find the gcc command that generates liblbfgs.o and modify it to add the
-fPICcompiler option. In my case, that resulted in the line
gcc -DHAVE_CONFIG_H -I.. -I. -I../include -msse2 -DUSE_SSE -O3 -ffast-math -fPIC -Wall -c lbfgs.c -o lbfgs.o'
- Move into the lib/ directory and execute this commnad
- Edit the
GLN...case of the switch statement in the compileMex.m file to replace the current
%s/lib/.libs/lbfgs.oportion of the mex call with
compileMex(<liblbfgs root directory>)