[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
package "optim" compilation oddity
From: |
John W. Eaton |
Subject: |
package "optim" compilation oddity |
Date: |
Fri, 31 Aug 2012 12:03:15 -0400 |
On 31-Aug-2012, CdeMills wrote:
| Hello,
|
| I've got a version of octave which is somewhat functional on Mac OS X 10.5
| (it crashes at exit). I compiled a few packages from octave-forge, and the
| compilation failed for optim-1.2.0. From its Makefile:
|
| LFLAGS := $(shell $(MKOCTFILE) -p LFLAGS)
| OCTAVE_LFLAGS := $(LFLAGS)
| LFLAGS += $(LAPACK_LIBS)
| LFLAGS += $(BLAS_LIBS)
| OCTAVE_LFLAGS += $(OCTAVE_LAPACK_LIBS)
| OCTAVE_LFLAGS += $(OCTAVE_BLAS_LIBS)
|
| # __disna_optim__ should be linked to the same Lapack library as used by
| Octave
| __disna_optim__.oct: __disna_optim__.cc
| LFLAGS="$(OCTAVE_LFLAGS)" $(MKOCTFILE) -s __disna_optim__.cc
|
| The resulting invocation is:
|
| LFLAGS="-L/opt/local/lib/octave/3.7.0+ -L/opt/local/lib -llapack -lcblas
| -lf77blas -latlas" mkoctfile -s __disna_optim__.cc
| mkoctfile: stripping disabled on this platform
| Undefined symbols for architecture i386:
| "__gfortran_st_write", referenced from:
| _xerbla_ in libf77blas.a(xerbla.o)
|
| The trouble is that we are adding fortran code which itself requires fortran
| library. The cure is to compile with
| LFLAGS="-L/opt/local/lib/octave/3.7.0+ -L/opt/local/lib -llapack -lcblas
| -lf77blas -latlas -L/opt/local/lib/gcc47 -lgfortran"
| /opt/local/bin/mkoctfile-3.7.0+ -s __disna_optim__.cc
|
| The added components are
| - the used compiler path for internal libs
| - the fortran library
|
| This should not have been required if the base thing had be compiled with
| the fortran compiler. I don't know if this is a linker problem (missing
| dependency between f77blas and gfortran), a compiler problem (f77blas should
| include the few required routines of gfortran), a platform problem, ... Ben,
| do you see this issue ?
You should be able to get this list of options and libraries by using
"mkoctfile -p FLIBS" similar to the way you get the value of LFLAGS.
Or are you saying that mkoctfile should automatically add $FLIBS to
the link command? I don't know how it would know to do that if the
command used to link has no reference to any Fortran source files.
jwe