trajopt icon indicating copy to clipboard operation
trajopt copied to clipboard

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

Open mchuruvija opened this issue 5 years ago • 5 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 9c634c060f7e2d61c4a888b0a5700d668a5d16f8. Does anyone know how to solve this error?

mchuruvija avatar Dec 03 '19 01:12 mchuruvija

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

142857T avatar Dec 23 '19 09:12 142857T

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

yuanluya avatar Feb 08 '21 00:02 yuanluya

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.

zhaomangang avatar Mar 22 '22 08:03 zhaomangang

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!

josyulakrishna avatar Apr 21 '23 23:04 josyulakrishna

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

josyulakrishna avatar Apr 22 '23 00:04 josyulakrishna