Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mchuruvija opened this issue Dec 3, 2019 · 5 comments

Comments

@mchuruvija
Copy link

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?

@142857T
Copy link

142857T commented Dec 23, 2019

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
Copy link

yuanluya commented Feb 8, 2021

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

@zhaomangang
Copy link

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
Copy link

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants