This is an old issue and everyone was baffled before, but I still need to
get this to work. To reiterate: I built a typical swig wrapper around some
algorithms we use that employ OpenBabel. Everything compiles and links.
But when I try to run it, I get this:
$ ./swig_wrapper_test.pl
==============================
*** Open Babel Error in OBDefine
Failed to make an instance CompoundFilter
... plus a lot of other similar messages. It's pretty clear to me that
OpenBabel isn't finding its plug-ins directory. But setting environment
variables doesn't help. I recompiled it today with the latest version of
OB, but it makes no difference at all.
There is one function in the module that doesn't use OpenBabel at all, and
that function works correctly. I suspect the problem is that the C++ class
initializers aren't being called. If anyone has any thoughts, I'd sure
appreciate it.
Does the OpenBabel swig interface for Perl actually work? My recollection
is that it had fallen behind. I suppose I could use it as a starting point.
Thanks,
Craig
On Thu, Apr 4, 2013 at 8:26 AM, Noel O'Boyle <baoille...@gmail.com> wrote:
> I'm all out. Have you looked at the output of ldd on the various
> library files? This shows which libraries will be dynamically loaded,
> or whether they cannot be found.
>
> - Noel
>
> On 4 April 2013 16:20, Craig James <cja...@emolecules.com> wrote:
> > Hi Noel,
> >
> >
> > On Thu, Apr 4, 2013 at 6:08 AM, Noel O'Boyle <baoille...@gmail.com>
> wrote:
> >>
> >> Long shot: Are there any files in your current directory with the same
> >> names as files in Open Babel's data directory? This is a nice way to
> >> confuse Open Babel. Have you altered any files in Open Babel's data
> >> directory?
> >
> >
> > No, nothing like that, no .txt files at all. One thing unusual: I have
> two
> > versions of OpenBabel installed:
> >
> > /usr/local/openbabel-2.2.1
> > /usr/local/openbabel-2.3.2
> > /usr/local/openbabel --> /usr/local/openbabel-2.3.2 (symlink)
> >
> > When I set BABEL_LIBDIR and BABEL_DATADIR to bogus values (e.g. to /tmp),
> > obabel fails as expected; when I set them to the correct directories,
> obabel
> > works again, so I'm pretty sure they're right.
> >
> >>
> >>
> >> Just a note: with Open Babel we moved away from using Makefile.PL as
> >> it just wasn't capable enough. CMake is setting various properties on
> >> the library files it creates, but these aren't passed through to the
> >> perl module library unless you get CMake to build that also (which we
> >> now do).
> >
> >
> > Well, that's good information. I suspect the problem is that the
> particular
> > g++ command that puts the .so together is missing something, resulting in
> > the C++ class-initialization code not being invoked when Perl starts
> > running. I'll dig into that a bit more.
> >
> >>
> >> Useless anecdotal evidence for different system: It works for me with
> >> Python on Linux for a C++ project that links to Open Babel.
> >
> >
> > I use swig for a pure-C module with no problems, but I'm not having luck
> > with an almost-identical module that links to OpenBabel. In fact,
> there's
> > one function in my OpenBabel module that doesn't call OpenBabel at all,
> and
> > that function works.
> >
> > Craig
> >
> >>
> >>
> >> - Noel
> >>
> >> On 3 April 2013 19:00, Craig James <cja...@emolecules.com> wrote:
> >> > This problem is driving me crazy. I have some functions written in
> C++
> >> > with
> >> > a C wrapper that I need to make available from Perl. I wrote a swig
> >> > interface for them, and got it to compile and run. But OpenBabel
> can't
> >> > seem
> >> > to initialize itself.
> >> >
> >> > ./test/swig_wrapper_test.pl
> >> > ==============================
> >> > *** Open Babel Error in OBDefine
> >> > Failed to make an instance CompoundFilter
> >> > ==============================
> >> > *** Open Babel Error in OBDefine
> >> > Failed to make an instance SmartsDescriptor
> >> > ==============================
> >> > *** Open Babel Error in OBDefine
> >> > Failed to make an instance SmartsDescriptor
> >> > ==============================
> >> > *** Open Babel Error in OBDefine
> >> > Failed to make an instance SmartsDescriptor
> >> > ==============================
> >> > *** Open Babel Error in OBDefine
> >> > Failed to make an instance SmartsDescriptor
> >> > ==============================
> >> > *** Open Babel Error in OBDefine
> >> > Failed to make an instance SmartsDescriptor
> >> > ==============================
> >> > *** Open Babel Error in OBDefine
> >> > Failed to make an instance SmartsDescriptor
> >> > ==============================
> >> > *** Open Babel Error in OBDefine
> >> > Failed to make an instance OBGroupContrib
> >> >
> >> > Looking at the code (ops/loader.cpp) it seems like it can't find its
> >> > .txt
> >> > files. But other programs, such as obabel and C++ programs that I
> >> > compiled
> >> > without swig, all work fine. LD_LIBRARY_PATH is correct, and
> defining
> >> > BABEL_DATADIR doesn't make any difference.
> >> >
> >> > I'm wondering if it's related to C versus C++ internal initialization
> >> > ...
> >> > like maybe the C++ initialization code isn't being called. I used g++
> >> > for
> >> > the "CC" and "LD" in Makefile.PL, but it made no difference.
> >> >
> >> > Any ideas? Guesses?
> >> >
> >> > Thanks,
> >> > Craig
> >> >
> >> >
> >> >
> >> >
> ------------------------------------------------------------------------------
> >> > Minimize network downtime and maximize team effectiveness.
> >> > Reduce network management and security costs.Learn how to hire
> >> > the most talented Cisco Certified professionals. Visit the
> >> > Employer Resources Portal
> >> > http://www.cisco.com/web/learning/employer_resources/index.html
> >> > _______________________________________________
> >> > OpenBabel-Devel mailing list
> >> > OpenBabel-Devel@lists.sourceforge.net
> >> > https://lists.sourceforge.net/lists/listinfo/openbabel-devel
> >> >
> >
> >
>
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
OpenBabel-Devel mailing list
OpenBabel-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-devel