joschu / trajopt

Trajectory Optimization

Home Page:http://rll.berkeley.edu/trajopt

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when making trajopt, fatal error: osg/CameraNode: No such file or directory compilation terminated.

mchuruvija opened this issue · comments

I'm following the instalation instructions on http://rll.berkeley.edu/trajopt/doc/sphinx_build/html/install.html#instructions
When I make, I get the following error:
fatal error: osg/CameraNode: No such file or directory
compilation terminated.
src/osgviewer/CMakeFiles/osgviewer.dir/build.make:62: recipe for target 'src/osgviewer/CMakeFiles/osgviewer.dir/osgviewer.cpp.o' failed
make[2]: *** [src/osgviewer/CMakeFiles/osgviewer.dir/osgviewer.cpp.o] Error 1
CMakeFiles/Makefile2:788: recipe for target 'src/osgviewer/CMakeFiles/osgviewer.dir/all' failed
make[1]: *** [src/osgviewer/CMakeFiles/osgviewer.dir/all] Error 2

I'm using trajopt git commit 9c634c0. Does anyone know how to solve this error?

My solution:

  1. install OSG3.4.0 from source
  2. sudo apt-get install libopenscenegraph-dev
  3. sudo cp /usr/include/osg/CameraNode usr/local/include/osg/
  4. sudo apt-get remove libopenscenegraph-dev
  5. build trajopt

I tried to install libopenscenegraph-dev, but I still cannot find CameraNode. What is the version of libopenscenegraph-dev that you installed?

The v1.2 CameraNode object has been renamed to Camera in v2.2. Correspondingly, the signature of
several methods that take CameraNode as a parameter or return it as a value were modified to reflect the
name change.
This impacts any code that uses CameraNode, includes the CameraNode header file, or uses any of the
methods that take CameraNode as a parameter or return it as a value.

The v1.2 CameraNode object has been renamed to Camera in v2.2. Correspondingly, the signature of several methods that take CameraNode as a parameter or return it as a value were modified to reflect the name change. This impacts any code that uses CameraNode, includes the CameraNode header file, or uses any of the methods that take CameraNode as a parameter or return it as a value.

did you manage to successfully compile with the latest version? If so can you let me know where the changes have to be made? thank you!

The v1.2 CameraNode object has been renamed to Camera in v2.2. Correspondingly, the signature of several methods that take CameraNode as a parameter or return it as a value were modified to reflect the name change. This impacts any code that uses CameraNode, includes the CameraNode header file, or uses any of the methods that take CameraNode as a parameter or return it as a value.

did you manage to successfully compile with the latest version? If so can you let me know where the changes have to be made? thank you!


Changes I made to compile 

  virtual void operator () (const osg::Camera& camera) const {
    if (!_snapImageOnNextFrame) return;
    int x,y,width,height;
    x = camera.getViewport()->x();
    y = camera.getViewport()->y();
    width = camera.getViewport()->width();
    height = camera.getViewport()->height();
    osg::ref_ptr<osg::Image> image = new osg::Image;
    image->readPixels(x,y,width,height,GL_RGB,GL_UNSIGNED_BYTE);
    // make a local copy
    unsigned char * p = image->data();
    unsigned int numBytes = image->computeNumComponents(image->getPixelFormat());
    _image = std::vector<unsigned char>(p, p + height*width*numBytes / sizeof(unsigned char));
    _height = height;
    _width = width;
    // save file
    if (_filename != "" && osgDB::writeImageFile(*image,_filename))
      std::cout << "Saved screenshot to `"<<_filename<<"`"<< std::endl;
    _snapImageOnNextFrame = false;
  }

however I am still getting an error :

[ 89%] Linking CXX executable ../../../bin/cast-cost-unit
/usr/bin/ld: ../../../lib/libosgviewer.so: undefined reference to `VTT for osg::Drawable::EventCallback'
/usr/bin/ld: ../../../lib/libosgviewer.so: undefined reference to `virtual thunk to osg::Drawable::EventCallback::run(osg::Object*, osg::Object*)'
/usr/bin/ld: ../../../lib/libosgviewer.so: undefined reference to `osg::Drawable::EventCallback::run(osg::Object*, osg::Object*)'
/usr/bin/ld: ../../../lib/libosgviewer.so: undefined reference to `virtual thunk to osg::NodeCallback::run(osg::Object*, osg::Object*)'
/usr/bin/ld: ../../../lib/libosgviewer.so: undefined reference to `typeinfo for osg::Drawable::EventCallback'
/usr/bin/ld: ../../../lib/libosgviewer.so: undefined reference to `osgUtil::SmoothingVisitor::apply(osg::Geode&)'
/usr/bin/ld: ../../../lib/libosgviewer.so: undefined reference to `vtable for osg::Drawable::EventCallback'
collect2: error: ld returned 1 exit status
make[2]: *** [src/trajopt/test/CMakeFiles/cast-cost-unit.dir/build.make:98: bin/cast-cost-unit] Error 1
make[1]: *** [CMakeFiles/Makefile2:519: src/trajopt/test/CMakeFiles/cast-cost-unit.dir/all] Error 2
make: *** [Makefile:95: all] Error 2