[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: msys, swig, cmake, and undefined octave dll routines

From: Mike Miller
Subject: Re: msys, swig, cmake, and undefined octave dll routines
Date: Tue, 3 Jan 2017 09:47:52 -0800
User-agent: NeoMutt/20161126 (1.7.1)

On Tue, Jan 03, 2017 at 08:19:36 -0700, Brad Bell wrote:
> On 01/02/2017 06:33 PM, Mike Miller wrote:
> > On Mon, Jan 02, 2017 at 08:29:18 -0700, Brad Bell wrote:
> > > I am not sure if this is the right list for the question below ?
> > > 
> ... snip ...
> > > The python version works under mingw-msys, but I am having some trouble
> > > linking the octave version. For example, I get the message
> > >      swig_exampleOCTAVE_wrap.cxx:912: undefined reference to `
> > >      octave_value::octave_value(std::__cxx11::basic_string<char,
> > > std::char_traits<char>, std::allocator<char> > const&, char)'
> > Do the only link errors have some reference to
> > std::__cxx11::basic_string? I don't have access to Windows to verify,
> > but I think it is correct that these symbols are not in Octave's
> > liboctave and liboctinterp (at least in Octave 4.0).
> I thought that perhaps Octave uses its minor version number for bug fixes,
> so I advanced to octave-4.0.3 and still got the same error.
> Searching the library file to see what is there we have:
> nm /c/Octave/Octave-4.0.3/lib/octave/4.0.3/liboctinterp.dll.a > junk
> grep 'octave_value.*octave_value' junk | head -1
> 00000000 I __imp___ZNK20mxArray_octave_value15is_octave_valueEv
> So it appears to me that the library contains C++ information about the
> octave_value class.

But you didn't answer my question: do the link errors you obtain when
you try to build only refer to symbols that have to do with
std::__cxx11::basic_string? I suspect yes, see below.

> > Are you building your extension module using the gcc provided with
> > Octave or using a separate mingw-msys development environment?
> > 
> > If you are not using the gcc provided with the Octave 4.0.0 installer,
> > which gcc version is it?
> > 
> I am building in a separate msys install with
>     cppad_swig.git>gcc --version
>     gcc.exe (GCC) 5.3.0
>     ...

Are you aware that there was an ABI change in the gcc project? Any C++
code that was built with gcc 4.x may not be compatible with C++ built
with gcc 5.x or higher (I can't remember the exact version numbers where
the change was made by default). Any link error having to do with a
missing symbol containing "__cxx11" is a dead giveaway.

My best guess is that your mingw gcc 5.3 is attempting to build against
gcc's new C++11 ABI changes, while Octave 4.0.x was built with gcc 4.x
using gcc's older ABI (whatever the version of gcc in Octave's bin
directory is).

Try building your project with -D_GLIBCXX_USE_CXX11_ABI=0 (see for
more information). Of course, this may conflict with swig or other
libraries that were built with mingw's gcc 5 using only the new ABI.

If that also doesn't work, then you may want to try building swig itself
using only the toolchain provided with Octave. Or you may want to try
building Octave natively under your mingw environment instead of relying
on the official cross-build that may have been built with an
incompatible toolchain.

> I should mention that I had to change two include instructions that seem
> like typos to me
> (because the corresponding files could not be found).
> To be specific, in oct.h I changed
>     #include <config.h>
> to
>     #include "config.h"
> and in comment-list.h I changed
>     #include <base-list.h>
> to
>     #include "base_list.h"

Thanks, these are already fixed in Octave 4.2.0 (which may or may not
yet work with swig).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]