On Wed, Aug 27, 2008 at 3:55 PM, Benjamin Lindner <[EMAIL PROTECTED]> wrote:
> I tried to build the optiminterp-0.3.1 package on octave-3.0.2/mingw32.
>
> I get a linker error of undefined references to a number
> "__gfortran_whatever" functions.
> Looking into the makefile, I see that the linking command is specified as
>
> optiminterp.oct: $(OBJECTS)
>        $(MKOCTFILE) -o $@ $(OBJECTS) $(LIBS)
>
> Now LIBS as returned from mkoctfile does not include the fortran
> libraries as set during configure stage when building octave. These are
> stored in FLIBS.
> Shouldn't the makefile read like
>
> optiminterp.oct: $(OBJECTS)
>        $(MKOCTFILE) -o $@ $(OBJECTS) $(LIBS) $(FLIBS)
>
> with FLIBS being set as the result of "mkoctfile -p FLIBS"?
>
> Should mkoctfile -p LIBS also return the fortran libraries?
> Or should mkoctfile automatically include FLIBS in linking if any source
> file is a fortran file? (how would mkoctfile know this?)

Hi Benjamin,

On Linux, mkoctfile adds the Fortran runtime libraries for any source
file during the link state. For example, to compile optiminterp the
following commands are executed:

$ make
mkoctfile -DHAVE_OCTAVE_ -v -c optiminterp.cc
g++ -c -fPIC -I/usr/include/octave-3.0.0
-I/usr/include/octave-3.0.0/octave -mieee-fp -O2 -DHAVE_OCTAVE_
optiminterp.cc -o optiminterp.o
FFLAGS="-O2" mkoctfile -DHAVE_OCTAVE_ -v -c optimal_interpolation.F90
gfortran -c -fPIC -O2 -DHAVE_OCTAVE_ optimal_interpolation.F90 -o
optimal_interpolation.o
FFLAGS="-O2" mkoctfile -DHAVE_OCTAVE_ -v -c optiminterp_wrapper.F90
gfortran -c -fPIC -O2 -DHAVE_OCTAVE_ optiminterp_wrapper.F90 -o
optiminterp_wrapper.o
mkoctfile -DHAVE_OCTAVE_ -v -o optiminterp.oct optiminterp.o
optimal_interpolation.o optiminterp_wrapper.o
g++ -shared -Wl,-Bsymbolic -o optiminterp.oct optiminterp.o
optimal_interpolation.o optiminterp_wrapper.o -L/usr/lib/octave-3.0.0
-loctinterp -loctave -lcruft -llapackgf-3 -lblas-3gf -lfftw3
-lreadline -lncurses -ldl -lhdf5 -lz -lm
-L/usr/lib/gcc/i486-linux-gnu/4.2.3
-L/usr/lib/gcc/i486-linux-gnu/4.2.3/../../../../lib -L/lib/../lib
-L/usr/lib/../lib -L/usr/lib/gcc/i486-linux-gnu/4.2.3/../../.. -lhdf5
-lz -lgfortranbegin -lgfortran -lm

The $FLIBS are thus not explicitly added in the makefile. Even for a
C++ file, those libraries are using for linking:

$ mkoctfile -v helloworld.cc
g++ -c -fPIC -I/usr/include/octave-3.0.0
-I/usr/include/octave-3.0.0/octave -mieee-fp -O2 helloworld.cc -o
helloworld.o
g++ -shared -Wl,-Bsymbolic -o helloworld.oct helloworld.o [...]
-lgfortranbegin -lgfortran -lm

Which version of mkoctfile are you using (the shell script or
mkoctfile.cc.in from msvs)? Maybe the envrinement variables FLIBS is
defined somewhere to an empty string and overriding its default value
?

Cheers,
Alex

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to