Menu

#384 Python binding won't build if libsbml namespace is enabled.

libSBML-5.10.2
closed
nobody
None
2015-09-11
2014-10-13
No

We always use libsbml with the C++ namespace, this is the only way to avoid name collisions with commonly used terms such as "Parameter".

The python bindings however will not build with the namespace enabled, and we need to share a pointer to various libsbml objects between C++ and Python, so building one version of libsbml without namespace for Python and another with namespace for C++ will not work.

Discussion

  • Frank Bergmann

    Frank Bergmann - 2014-10-13

    I just tried a clean build, from libsbml-experimental on WIN32 using python 3.2 (32 bit) and C++ Namespace enabled. That worked just fine.

    So it would be nice if you could provide more information. Especially your CmakeCache.txt file. And all information about the system you are running on.

    Thanks
    Frank

     
  • Andy Somogyi

    Andy Somogyi - 2014-10-13

    This is building the libSBML-5.10.2-experimental release. Trying to build (On OSX 10.7) against Python 2.6 (yes, its ancient, but lots of users still use it).

    I didn't try it, but I'd guess that adding the libsbml:: namespace before the class names should work.

    [ 18%] Building CXX object libSBML-5.10.2-experimental-Source/src/bindings/python/CMakeFiles/binding_python_lib.dir/libsbml_wrap.cpp.o
    /Users/andy/src/rrtpclang_release/libSBML-5.10.2-experimental-Source/src/bindings/python/libsbml_wrap.cpp:23906:3: error: reference
          to 'SpeciesReference' is ambiguous
      SpeciesReference *result = 0 ;
      ^
    /Users/andy/src/roadrunner/third_party/libSBML-5.10.2-experimental-Source/src/sbml/conversion/SBMLReactionConverter.h:68:7: note:
          candidate found by name lookup is 'SpeciesReference'
    class SpeciesReference;
          ^
    /Users/andy/src/roadrunner/third_party/libSBML-5.10.2-experimental-Source/src/sbml/SpeciesReference.h:271:22: note: candidate found
          by name lookup is 'libsbml::SpeciesReference'
    class LIBSBML_EXTERN SpeciesReference : public SimpleSpeciesReference
                         ^
    /Users/andy/src/rrtpclang_release/libSBML-5.10.2-experimental-Source/src/bindings/python/libsbml_wrap.cpp:23914:3: error: use of
          undeclared identifier 'result'
      result = (SpeciesReference *)(arg1)->createReactant();
      ^
    /Users/andy/src/rrtpclang_release/libSBML-5.10.2-experimental-Source/src/bindings/python/libsbml_wrap.cpp:23914:13: error: reference
          to 'SpeciesReference' is ambiguous
      result = (SpeciesReference *)(arg1)->createReactant();
                ^
    /Users/andy/src/roadrunner/third_party/libSBML-5.10.2-experimental-Source/src/sbml/conversion/SBMLReactionConverter.h:68:7: note:
          candidate found by name lookup is 'SpeciesReference'
    class SpeciesReference;
          ^
    /Users/andy/src/roadrunner/third_party/libSBML-5.10.2-experimental-Source/src/sbml/SpeciesReference.h:271:22: note: candidate found
          by name lookup is 'libsbml::SpeciesReference'
    class LIBSBML_EXTERN SpeciesReference : public SimpleSpeciesReference
                         ^
    /Users/andy/src/rrtpclang_release/libSBML-5.10.2-experimental-Source/src/bindings/python/libsbml_wrap.cpp:23914:13: error: reference
          to 'SpeciesReference' is ambiguous
      result = (SpeciesReference *)(arg1)->createReactant();
                ^
    /Users/andy/src/roadrunner/third_party/libSBML-5.10.2-experimental-Source/src/sbml/conversion/SBMLReactionConverter.h:68:7: note:
          candidate found by name lookup is 'SpeciesReference'
    class SpeciesReference;
          ^
    /Users/andy/src/roadrunner/third_party/libSBML-5.10.2-experimental-Source/src/sbml/SpeciesReference.h:271:22: note: candidate found
          by name lookup is 'libsbml::SpeciesReference'
    class LIBSBML_EXTERN SpeciesReference : public SimpleSpeciesReference
                         ^
    /Users/andy/src/rrtpclang_release/libSBML-5.10.2-experimental-Source/src/bindings/python/libsbml_wrap.cpp:23915:50: error: use of
          undeclared identifier 'result'
      resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_SpeciesReference, 0 |  0 );
                                                     ^
    /Users/andy/src/rrtpclang_release/libSBML-5.10.2-experimental-Source/src/bindings/python/libsbml_wrap.cpp:3672:77: note: expanded
          from macro 'SWIG_as_voidptr'
    #define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a))
                                                                                ^
    /Users/andy/src/rrtpclang_release/libSBML-5.10.2-experimental-Source/src/bindings/python/libsbml_wrap.cpp:1166:89: note: expanded
          from macro 'SWIG_NewPointerObj'
    #define SWIG_NewPointerObj(ptr, type, flags)            SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
                                                                                            ^
    /Users/andy/src/rrtpclang_release/libSBML-5.10.2-experimental-Source/src/bindings/python/libsbml_wrap.cpp:23928:3: error: reference
          to 'SpeciesReference' is ambiguous
      SpeciesReference *result = 0 ;
      ^
    /Users/andy/src/roadrunner/third_party/libSBML-5.10.2-experimental-Source/src/sbml/conversion/SBMLReactionConverter.h:68:7: note:
          candidate found by name lookup is 'SpeciesReference'
    class SpeciesReference;
          ^
    /Users/andy/src/roadrunner/third_party/libSBML-5.10.2-experimental-Source/src/sbml/SpeciesReference.h:271:22: note: candidate found
          by name lookup is 'libsbml::SpeciesReference'
    class LIBSBML_EXTERN SpeciesReference : public SimpleSpeciesReference
                         ^
    /Users/andy/src/rrtpclang_release/libSBML-5.10.2-experimental-Source/src/bindings/python/libsbml_wrap.cpp:23936:3: error: use of
          undeclared identifier 'result'
      result = (SpeciesReference *)(arg1)->createProduct();
      ^
    /Users/andy/src/rrtpclang_release/libSBML-5.10.2-experimental-Source/src/bindings/python/libsbml_wrap.cpp:23936:13: error: reference
          to 'SpeciesReference' is ambiguous
      result = (SpeciesReference *)(arg1)->createProduct();
                ^
    /Users/andy/src/roadrunner/third_party/libSBML-5.10.2-experimental-Source/src/sbml/conversion/SBMLReactionConverter.h:68:7: note:
          candidate found by name lookup is 'SpeciesReference'
    class SpeciesReference;
          ^
    /Users/andy/src/roadrunner/third_party/libSBML-5.10.2-experimental-Source/src/sbml/SpeciesReference.h:271:22: note: candidate found
          by name lookup is 'libsbml::SpeciesReference'
    class LIBSBML_EXTERN SpeciesReference : public SimpleSpeciesReference
                         ^
    /Users/andy/src/rrtpclang_release/libSBML-5.10.2-experimental-Source/src/bindings/python/libsbml_wrap.cpp:23936:13: error: reference
          to 'SpeciesReference' is ambiguous
      result = (SpeciesReference *)(arg1)->createProduct();
                ^
    /Users/andy/src/roadrunner/third_party/libSBML-5.10.2-experimental-Source/src/sbml/conversion/SBMLReactionConverter.h:68:7: note:
          candidate found by name lookup is 'SpeciesReference'
    class SpeciesReference;
          ^
    /Users/andy/src/roadrunner/third_party/libSBML-5.10.2-experimental-Source/src/sbml/SpeciesReference.h:271:22: note: candidate found
          by name lookup is 'libsbml::SpeciesReference'
    class LIBSBML_EXTERN SpeciesReference : public SimpleSpeciesReference
                         ^
    /Users/andy/src/rrtpclang_release/libSBML-5.10.2-experimental-Source/src/bindings/python/libsbml_wrap.cpp:23937:50: error: use of
          undeclared identifier 'result'
      resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_SpeciesReference, 0 |  0 );
                                                     ^
    /Users/andy/src/rrtpclang_release/libSBML-5.10.2-experimental-Source/src/bindings/python/libsbml_wrap.cpp:3672:77: note: expanded
          from macro 'SWIG_as_voidptr'
    #define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a))
                                                                                ^
    /Users/andy/src/rrtpclang_release/libSBML-5.10.2-experimental-Source/src/bindings/python/libsbml_wrap.cpp:1166:89: note: expanded
          from macro 'SWIG_NewPointerObj'
    #define SWIG_NewPointerObj(ptr, type, flags)            SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
                                                                                            ^
    /Users/andy/src/rrtpclang_release/libSBML-5.10.2-experimental-Source/src/bindings/python/libsbml_wrap.cpp:28367:3: error: reference
          to 'SpeciesReference' is ambiguous
      SpeciesReference *result = 0 ;
      ^
    /Users/andy/src/roadrunner/third_party/libSBML-5.10.2-experimental-Source/src/sbml/conversion/SBMLReactionConverter.h:68:7: note:
          candidate found by name lookup is 'SpeciesReference'
    class SpeciesReference;
          ^
    /Users/andy/src/roadrunner/third_party/libSBML-5.10.2-experimental-Source/src/sbml/SpeciesReference.h:271:22: note: candidate found
          by name lookup is 'libsbml::SpeciesReference'
    class LIBSBML_EXTERN SpeciesReference : public SimpleSpeciesReference
                         ^
    /Users/andy/src/rrtpclang_release/libSBML-5.10.2-experimental-Source/src/bindings/python/libsbml_wrap.cpp:28386:3: error: use of
          undeclared identifier 'result'
      result = (SpeciesReference *)(arg1)->getSpeciesReference((std::string const &)*arg2);
      ^
    /Users/andy/src/rrtpclang_release/libSBML-5.10.2-experimental-Source/src/bindings/python/libsbml_wrap.cpp:28386:13: error: reference
          to 'SpeciesReference' is ambiguous
      result = (SpeciesReference *)(arg1)->getSpeciesReference((std::string const &)*arg2);
                ^
    /Users/andy/src/roadrunner/third_party/libSBML-5.10.2-experimental-Source/src/sbml/conversion/SBMLReactionConverter.h:68:7: note:
          candidate found by name lookup is 'SpeciesReference'
    class SpeciesReference;
          ^
    /Users/andy/src/roadrunner/third_party/libSBML-5.10.2-experimental-Source/src/sbml/SpeciesReference.h:271:22: note: candidate found
          by name lookup is 'libsbml::SpeciesReference'
    class LIBSBML_EXTERN SpeciesReference : public SimpleSpeciesReference
                         ^
    /Users/andy/src/rrtpclang_release/libSBML-5.10.2-experimental-Source/src/bindings/python/libsbml_wrap.cpp:28386:13: error: reference
          to 'SpeciesReference' is ambiguous
      result = (SpeciesReference *)(arg1)->getSpeciesReference((std::string const &)*arg2);
                ^
    /Users/andy/src/roadrunner/third_party/libSBML-5.10.2-experimental-Source/src/sbml/conversion/SBMLReactionConverter.h:68:7: note:
          candidate found by name lookup is 'SpeciesReference'
    class SpeciesReference;
          ^
    /Users/andy/src/roadrunner/third_party/libSBML-5.10.2-experimental-Source/src/sbml/SpeciesReference.h:271:22: note: candidate found
          by name lookup is 'libsbml::SpeciesReference'
    class LIBSBML_EXTERN SpeciesReference : public SimpleSpeciesReference
                         ^
    /Users/andy/src/rrtpclang_release/libSBML-5.10.2-experimental-Source/src/bindings/python/libsbml_wrap.cpp:28387:50: error: use of
          undeclared identifier 'result'
      resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_SpeciesReference, 0 |  0 );
                                                     ^
    /Users/andy/src/rrtpclang_release/libSBML-5.10.2-experimental-Source/src/bindings/python/libsbml_wrap.cpp:3672:77: note: expanded
          from macro 'SWIG_as_voidptr'
    #define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a))
                                                                                ^
    /Users/andy/src/rrtpclang_release/libSBML-5.10.2-experimental-Source/src/bindings/python/libsbml_wrap.cpp:1166:89: note: expanded
          from macro 'SWIG_NewPointerObj'
    #define SWIG_NewPointerObj(ptr, type, flags)            SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
                                                                                            ^
    /Users/andy/src/rrtpclang_release/libSBML-5.10.2-experimental-Source/src/bindings/python/libsbml_wrap.cpp:28405:3: error: reference
          to 'SpeciesReference' is ambiguous
      SpeciesReference *result = 0 ;
      ^
    /Users/andy/src/roadrunner/third_party/libSBML-5.10.2-experimental-Source/src/sbml/conversion/SBMLReactionConverter.h:68:7: note:
          candidate found by name lookup is 'SpeciesReference'
    class SpeciesReference;
          ^
    /Users/andy/src/roadrunner/third_party/libSBML-5.10.2-experimental-Source/src/sbml/SpeciesReference.h:271:22: note: candidate found
          by name lookup is 'libsbml::SpeciesReference'
    class LIBSBML_EXTERN SpeciesReference : public SimpleSpeciesReference
                         ^
    /Users/andy/src/rrtpclang_release/libSBML-5.10.2-experimental-Source/src/bindings/python/libsbml_wrap.cpp:28424:3: error: use of
          undeclared identifier 'result'
      result = (SpeciesReference *)((Model const *)arg1)->getSpeciesReference((std::string const &)*arg2);
    
      ^
    /Users/andy/src/rrtpclang_release/libSBML-5.10.2-experimental-Source/src/bindings/python/libsbml_wrap.cpp:28424:13: error: reference
          to 'SpeciesReference' is ambiguous
      result = (SpeciesReference *)((Model const *)arg1)->getSpeciesReference((std::string const &)*arg2);
                ^
    /Users/andy/src/roadrunner/third_party/libSBML-5.10.2-experimental-Source/src/sbml/conversion/SBMLReactionConverter.h:68:7: note:
          candidate found by name lookup is 'SpeciesReference'
    class SpeciesReference;
          ^
    /Users/andy/src/roadrunner/third_party/libSBML-5.10.2-experimental-Source/src/sbml/SpeciesReference.h:271:22: note: candidate found
          by name lookup is 'libsbml::SpeciesReference'
    class LIBSBML_EXTERN SpeciesReference : public SimpleSpeciesReference
                         ^
    /Users/andy/src/rrtpclang_release/libSBML-5.10.2-experimental-Source/src/bindings/python/libsbml_wrap.cpp:28424:13: error: reference
          to 'SpeciesReference' is ambiguous
      result = (SpeciesReference *)((Model const *)arg1)->getSpeciesReference((std::string const &)*arg2);
                ^
    /Users/andy/src/roadrunner/third_party/libSBML-5.10.2-experimental-Source/src/sbml/conversion/SBMLReactionConverter.h:68:7: note:
          candidate found by name lookup is 'SpeciesReference'
    class SpeciesReference;
          ^
    /Users/andy/src/roadrunner/third_party/libSBML-5.10.2-experimental-Source/src/sbml/SpeciesReference.h:271:22: note: candidate found
          by name lookup is 'libsbml::SpeciesReference'
    class LIBSBML_EXTERN SpeciesReference : public SimpleSpeciesReference
                         ^
    fatal error: too many errors emitted, stopping now [-ferror-limit=]
    20 errors generated.
    
     
  • Frank Bergmann

    Frank Bergmann - 2014-10-13

    Can you please also verify, that the libsbml-namespace.h is read from the libSBML binary dir in src/sbml/common/ (and that it has the statement #define LIBSBML_USE_CPP_NAMESPACE 1) in there?

    (This could be easily achieved by an #error statement in the file).

    This error could be caused, by a conflicting file on your system. In old versions of libSBML, that file was part of the src/sbml/common dir, which would cause the problem.

     
  • Sarah Keating

    Sarah Keating - 2015-09-11

    Closing this as there has been no further response

     
  • Sarah Keating

    Sarah Keating - 2015-09-11
    • status: open --> closed
    • Priority: -->
     

Log in to post a comment.