joschu / trajopt

Trajectory Optimization
http://rll.berkeley.edu/trajopt
Other
383 stars 160 forks source link

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

Open mchuruvija opened 4 years ago

mchuruvija commented 4 years ago

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?

142857T commented 4 years ago

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
yuanluya commented 3 years ago

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

zhaomangang commented 2 years ago

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.

josyulakrishna commented 1 year ago

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 commented 1 year ago

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 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(p, p + heightwidthnumBytes / 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 tovirtual 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 tovirtual 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 toosgUtil::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