On Sun, 2010-12-05 at 16:56 +0100, Matthias Klose wrote:
> Package: shogun
> Version: 0.9.3-4
> Severity: normal
> User: ubuntu-de...@lists.ubuntu.com
> Usertags: origin-ubuntu natty
> User: debian-...@lists.debian.org
> Usertags: ld-as-needed
> 
> I didn't debug the build system too much, a build with ld --as-needed fails 
> with:
> 
> c++ -Xlinker --no-undefined -lm -pthread -lhdf5 -llapack -lcblas -lglpk -lm 
> -llzo2 -lz -llzma -L../libshogun -lshogun -shared -L /usr/lib/octave-3.2.4 
> -loctinterp -loctave -lcruft  -o Classifier.oct Classifier_wrap.cxx.o 
> sg_print_functions.cpp.o -L../libshogun -lshogun
> Classifier_wrap.cxx.o: In function `SWIG_check_num_args':
> /build/buildd/shogun-0.9.3/src/octave_modular/Classifier_wrap.cxx:785: 
> undefined 
> reference to `error(char const*, ...)'
> /build/buildd/shogun-0.9.3/src/octave_modular/Classifier_wrap.cxx:783: 
> undefined 
> reference to `error(char const*, ...)'
> Classifier_wrap.cxx.o: In function `octave_swig_ref::operator new(unsigned 
> int)':
> /build/buildd/shogun-0.9.3/src/octave_modular/Classifier_wrap.cxx:1727: 
> undefined reference to `octave_allocator::alloc(unsigned int)'
> Classifier_wrap.cxx.o: In function 
> `octave_value_typeinfo::lookup_binary_op(octave_value::binary_op, int, int)':
> /usr/include/octave-3.2.4/octave/ov-typeinfo.h:138: undefined reference to 
> `octave_value_typeinfo::instance'
> [further undefined reference messages omitted]
> 
> the reason is that objects and local libraries have to appear on the command 
> line first, like:
> 
> c++ -Xlinker --no-undefined -shared \
>      -o Classifier.oct \
>      Classifier_wrap.cxx.o \
>      -L../libshogun -lshogun \
>      -lm -pthread -lhdf5 -llapack -lcblas -lglpk -lm -llzo2 -lz -llzma \
>      -L /usr/lib/octave-3.2.4 -loctinterp -loctave -lcruft
> 
> any hint where to fix this properly?

Shogun generates a .config file upon configure with all the link flags
being in LINKFLAGS, LINKFLAGS_INTERFACE, and PRELINKFLAGS
POSTLINKFLAGS .

And linking takes place in Makefile.template with the PRE / LINKFLAGS /
POSTLINKFLAGS.

So the fix should be to modify configure and replace LINKFLAGS_OCTAVE
with POSTLINKFLAGS_OCTAVE in this section:


                if darwin
                then
                    LINKFLAGS_OCTAVE="-bundle -Wl,-flat_namespace 
-L`octave-config -p OCTLIBDIR` -loctinterp -loctave -lcruft $LINKFLAGS_OCTAVE"
                else
                    if sunos
                    then
                        OCTLIBDIR=`octave-config -p OCTLIBDIR`
                        LINKFLAGS_OCTAVE="-G -L $OCTLIBDIR -loctinterp -loctave 
-lcruft $LINKFLAGS_OCTAVE"
                    else
                        OCTLIBDIR=`octave-config -p OCTLIBDIR`
                        LINKFLAGS_OCTAVE="-shared -L $OCTLIBDIR -loctinterp 
-loctave -lcruft $LINKFLAGS_OCTAVE"
                    fi
                fi
                OCTAVE_TARGET="sg.oct"
                INCLUDES_OCTAVE="$INCLUDES_OCTAVE -I`octave-config -p 
OCTINCLUDEDIR` -I`octave-config -p INCLUDEDIR`"
                COMPFLAGS_CPP_OCTAVE="$COMPFLAGS_CPP -fPIC"
                COMPFLAGS_C_OCTAVE="$COMPFLAGS_C -fPIC"
            
                echocheck "Octave Developer Files"
                if LD_LIBRARY_PATH=`octave-config -p OCTLIBDIR` cxx_check_so 
$COMPFLAGS_CPP_OCTAVE $INCLUDES_OCTAVE $LINKFLAGS_OCTAVE


HTH,
Soeren
-- 
For the one fact about the future of which we can be certain is that it
will be utterly fantastic. -- Arthur C. Clarke, 1962

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to