Compiling L-BFGS-B nonlinear optimizer for mac os x

Just running:


make

on the fortran source code of L-BFGS-B gave me linker errors on my mac OS X 10.6 machine:


invalid parameter driver1.o
Undefined symbols:
  "_s_wsle", referenced from:
      _subsm_ in routines.o
    ....

I fixed this by installing g77, following these instructions.

Then changed the value of F77 in the makefile of L-BFGS-B:


#FC = f77
FC = g77

Then running


make

produced i386 executables and object files.

Note: I’m not sure what you would need to change to produce x86_64 files, luckily for me I wanted i386 all along.

Update: So the examples that g77 creates above work fine. But when I tried to call the fortran subroutines from c or cpp code I got weird errors. To solve this I switched gears and opted to use f2c/f77 and universal binaries, this so far is working much better.

Tags: , , , , , , ,

Leave a Reply