Wrap parsing failures on Ubuntu 13.10+/gcc 4.8.x/boost 1.53-54

Issue #25 new
Alex Cunningham created an issue

I've been doing testing on a different dev machine with a basically clean version of the latest version of Ubuntu, and at the moment wrap parsing/codegen isn't working. Interestingly, I get different results depending on whether using debug or release mode. The error messages are below.

There are two flags that the parser seems to miss - the "const" at the end of method definitions, and the pointer flag on returned pairs. The const flag can be ignored since it doesn't actually get used during codegen, but the pointer flag is generating bad code that doesn't compile.

My plan at the moment is to remove the is_const flag entirely, since it has no actual effect, and see about rewriting the parser rules for pairs, but I don't know why there are different results for debug and release versions, or why the parser doesn't behave the way it does on my other machine (Ubuntu 10.04/gcc 4.7/boost 1.49).

In debug mode, testWrap fails with these errors:

/home/alexgc/borg/gtsam/wrap/tests/testWrap.cpp:99: Failure: "m1.is_const_" 
/home/alexgc/borg/gtsam/wrap/tests/testWrap.cpp:112: Failure: "m2.is_const_" 
/home/alexgc/borg/gtsam/wrap/tests/testWrap.cpp:125: Failure: "m3.is_const_" 
/home/alexgc/borg/gtsam/wrap/tests/testWrap.cpp:203: Failure: "m1.is_const_" 
/home/alexgc/borg/gtsam/wrap/tests/testWrap.cpp:257: Failure: "m1.is_const_" 
/home/alexgc/borg/gtsam/wrap/tests/testWrap.cpp:276: Failure: "m2.returnVals.front().isPair" 
/home/alexgc/borg/gtsam/wrap/tests/testWrap.cpp:291: Failure: "arg1.is_ptr" 
/home/alexgc/borg/gtsam/wrap/tests/testWrap.cpp:299: Failure: "arg2.is_ptr" 
wrap: generating actual_namespaces/+ns1/ClassA.m
wrap: generating actual_namespaces/+ns1/ClassB.m
wrap: generating actual_namespaces/+ns2/ClassA.m
wrap: generating actual_namespaces/+ns2/+ns3/ClassB.m
wrap: generating actual_namespaces/+ns2/ClassC.m
wrap: generating actual_namespaces/ClassD.m
wrap: generating actual_namespaces/+ns1/aGlobalFunction.m
wrap: generating actual_namespaces/+ns2/aGlobalFunction.m
wrap: generating actual_namespaces/testNamespaces_wrapper.cpp
wrap: generating actual/Point2.m
wrap: generating actual/Point3.m
wrap: generating actual/Test.m
wrap: generating actual/aGlobalFunction.m
wrap: generating actual/geometry_wrapper.cpp
There were 8 failures

In release mode, testWrap passes without errors.

When building gtsam_wrapper, the release version fails to compile, throwing the error:

/home/alexgc/borg/gtsam/build_release/wrap/gtsam/gtsam_wrapper.cpp: In function ‘void gtsamnoiseModelConstrained_All_584(int, mxArray**, int, const mxArray**)’:
/home/alexgc/borg/gtsam/build_release/wrap/gtsam/gtsam_wrapper.cpp:7566:69: error: ‘gtsam::noiseModel::Constrained::shared_ptr’ has no member named ‘clone’
   out[0] = wrap_shared_ptr(gtsam::noiseModel::Constrained::All(dim).clone(),"gtsam.noiseModel.Constrained", true);

Compiling of gtsam_wrapper actually works in debug mode, though it fails on compiling gtsam_unstable_wrapper with this error:

In file included from /usr/include/c++/4.8/bits/stl_algobase.h:64:0,
                 from /usr/include/c++/4.8/list:60,
                 from /home/alexgc/borg/gtsam/gtsam/base/Vector.h:23,
                 from /home/alexgc/borg/gtsam/wrap/matlab.h:25,
                 from /home/alexgc/borg/gtsam/build/wrap/gtsam_unstable/gtsam_unstable_wrapper.cpp:1:
/usr/include/c++/4.8/bits/stl_pair.h: In instantiation of ‘std::pair<_T1, _T2>::pair(const std::pair<_U1, _U2>&) [with _U1 = gtsam::Mechanization_bRn2; _U2 = boost::shared_ptr<gtsam::GaussianDensity>; _T1 = gtsam::Mechanization_bRn2; _T2 = gtsam::GaussianDensity]’:
/home/alexgc/borg/gtsam/build/wrap/gtsam_unstable/gtsam_unstable_wrapper.cpp:4182:102:   required from here
/usr/include/c++/4.8/bits/stl_pair.h:119:39: error: no matching function for call to ‘gtsam::GaussianDensity::GaussianDensity(const boost::shared_ptr<gtsam::GaussianDensity>&)’
  : first(__p.first), second(__p.second) { }
                                       ^
/usr/include/c++/4.8/bits/stl_pair.h:119:39: note: candidates are:
In file included from /home/alexgc/borg/gtsam/gtsam/linear/KalmanFilter.h:22:0,
                 from /home/alexgc/borg/gtsam/gtsam_unstable/slam/AHRS.h:13,
                 from /home/alexgc/borg/gtsam/build/wrap/gtsam_unstable/gtsam_unstable_wrapper.cpp:27:
/home/alexgc/borg/gtsam/gtsam/linear/GaussianDensity.h:52:5: note: gtsam::GaussianDensity::GaussianDensity(gtsam::Key, const Vector&, const Matrix&, const SharedDiagonal&)
     GaussianDensity(Key key, const Vector& d, const Matrix& R, const SharedDiagonal& noiseModel = SharedDiagonal()) :
     ^
/home/alexgc/borg/gtsam/gtsam/linear/GaussianDensity.h:52:5: note:   candidate expects 4 arguments, 1 provided
/home/alexgc/borg/gtsam/gtsam/linear/GaussianDensity.h:45:5: note: gtsam::GaussianDensity::GaussianDensity(const gtsam::GaussianConditional&)
     GaussianDensity(const GaussianConditional& conditional) :
     ^
/home/alexgc/borg/gtsam/gtsam/linear/GaussianDensity.h:45:5: note:   no known conversion for argument 1 from ‘const boost::shared_ptr<gtsam::GaussianDensity>’ to ‘const gtsam::GaussianConditional&’
/home/alexgc/borg/gtsam/gtsam/linear/GaussianDensity.h:40:5: note: gtsam::GaussianDensity::GaussianDensity()
     GaussianDensity() :
     ^
/home/alexgc/borg/gtsam/gtsam/linear/GaussianDensity.h:40:5: note:   candidate expects 0 arguments, 1 provided
/home/alexgc/borg/gtsam/gtsam/linear/GaussianDensity.h:33:22: note: gtsam::GaussianDensity::GaussianDensity(const gtsam::GaussianDensity&)
   class GTSAM_EXPORT GaussianDensity : public GaussianConditional {
                      ^
/home/alexgc/borg/gtsam/gtsam/linear/GaussianDensity.h:33:22: note:   no known conversion for argument 1 from ‘const boost::shared_ptr<gtsam::GaussianDensity>’ to ‘const gtsam::GaussianDensity&’
make[2]: *** [gtsam_unstable/CMakeFiles/gtsam_unstable_wrapper.dir/__/wrap/gtsam_unstable/gtsam_unstable_wrapper.cpp.o] Error 1
make[1]: *** [gtsam_unstable/CMakeFiles/gtsam_unstable_wrapper.dir/all] Error 2

Comments (17)

  1. Jing Dong

    The third bug is already gone on my system, the first and second one still exist. i guess the first one may have already be fixed sometime... What's more, the gtsam_wrapper.cpp generated is debug and release mode is different, so cause the second error

     jing@jing-OptiPlex-7010:~/software$ diff gtsam_wrapper_debug.cpp gtsam_wrapper_release.cpp 
    10422c10422
    <   out[0] = wrap_shared_ptr(obj->at(idx),"gtsam.GaussianConditional", true);
    ---
    >   out[0] = wrap_shared_ptr(obj->at(idx).clone(),"gtsam.GaussianConditional", true);
    

    My system now is Ubuntu 13.10/gcc 4.8.1/boost 1.55

  2. Jing Dong

    Update: No bugs when compiled at Ubuntu 12.04/gcc 4.8.1/boost 1.46. Now looks like it's the issue of Boost. Give me one minute to wipe my machine to Ubuntu 14.04...

  3. Jing Dong

    I'm still testing the issue by isolate the wrapper, I think I still need some time. @cbeall3 could we still do pre-built matlab toolbox this time? If needed I can do that.

  4. Chris Beall

    We will continue to have pre-built toolboxes even after this bug is fixed. We offer the pre-built toolbox as a matter of convenience so people can use GTSAM in Matlab without having to compile anything at all.

  5. Alex Cunningham reporter

    One thing we might consider if there is one of debug/release versions that does codegen properly, we could consider forcing just the wrap tool to always be built in this mode. It's a bit of a hack, but from when I was trying to debug this problem, getting different outputs from the parser depending on the build parameters is likely a problem with boost.

  6. Jing Dong

    Yes that might works, but on my machine gcc 4.8/boost 1.46, both release/debug fail, and release fails randomly (about 10% of total runs). I cannot understand why I have different results in different runs...

  7. Jing Dong

    I don't think that issue is fixed now... The test still fails on my side, even worse the error message is longer. At the beginning the error still exists

    /home/jing/borg/gtsam/wrap/tests/testWrap.cpp:100: Failure: "m1.isConst()" 
    /home/jing/borg/gtsam/wrap/tests/testWrap.cpp:112: Failure: "m2.isConst()" 
    /home/jing/borg/gtsam/wrap/tests/testWrap.cpp:124: Failure: "m3.isConst()" 
    /home/jing/borg/gtsam/wrap/tests/testWrap.cpp:200: Failure: "m1.isConst()" 
    /home/jing/borg/gtsam/wrap/tests/testWrap.cpp:256: Failure: "m1.isConst()" 
    /home/jing/borg/gtsam/wrap/tests/testWrap.cpp:277: Failure: "m2.returnValue(0).isPair" 
    /home/jing/borg/gtsam/wrap/tests/testWrap.cpp:292: Failure: "arg1.is_ptr" 
    /home/jing/borg/gtsam/wrap/tests/testWrap.cpp:300: Failure: "arg2.is_ptr" 
    

    Afterwards there are many other failures, some are gtsam namespace issue

    31c42
    <     collector_Point2.erase(iter++);
    ---
    >     collector_gtsamPoint2.erase(iter++);
    

    Some still look at related to pointer issue

    23c23
    < %return_ptrs(Test p1, Test p2) : returns pair< SharedTest, SharedTest >
    ---
    > %return_ptrs(Test p1, Test p2) : returns pair< Test, Test >
    

    I attached a full error message as a file link: https://dl.dropboxusercontent.com/u/103508219/issue25_errormessage.txt

  8. Chris Beall

    These issues recently went away on Ubuntu 14.04! Probably due to wrap changes in December? @jdong37 , can you check again?

  9. Jing Dong

    I' m not sure, the problem still exist about one month ago on my machine. I didn't see many changes related to wrapper recently. I will check it tonight.

  10. Log in to comment