joschu / trajopt

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

cannot compile trajopt #20

Open k-maheshkumar opened 7 years ago

k-maheshkumar commented 7 years ago

I couldn't build the package successfully. I get the following error, ../../../lib/libosgviewer.so: undefined reference to osgGA::EventHandler::event(osg::NodeVisitor*, osg::Drawable*)' ../../../lib/libosgviewer.so: undefined reference totypeinfo for osgGA::EventHandler' ../../../lib/libosgviewer.so: undefined reference to virtual thunk to osg::Drawable::EventCallback::run(osg::Object*, osg::Object*)' ../../../lib/libosgviewer.so: undefined reference toosgGA::EventHandler::handle(osgGA::Event, osg::Object, osg::NodeVisitor)' ../../../lib/libosgviewer.so: undefined reference to `osg::Callback::traverse(osg::Object, osg::Object)' ../../../lib/libosgviewer.so: undefined reference to osg::NodeVisitor::NodeVisitor(osg::NodeVisitor const&, osg::CopyOp const&)' ../../../lib/libosgviewer.so: undefined reference toosg::Drawable::EventCallback::run(osg::Object, osg::Object)' ../../../lib/libosgviewer.so: undefined reference to `osgGA::GUIEventHandler::handle(osgGA::Event, osg::Object, osg::NodeVisitor)' ../../../lib/libosgviewer.so: undefined reference to virtual thunk to osg::NodeCallback::run(osg::Object*, osg::Object*)' ../../../lib/libosgviewer.so: undefined reference toosg::Group::removeChild(osg::Node)' ../../../lib/libosgviewer.so: undefined reference to osg::NodeVisitor::apply(osg::Geometry&)' ../../../lib/libosgviewer.so: undefined reference toVTT for osgGA::EventHandler' ../../../lib/libosgviewer.so: undefined reference to `non-virtual thunk to osgGA::EventHandler::event(osg::NodeVisitor, osg::Drawable)' ../../../lib/libosgviewer.so: undefined reference to vtable for osgGA::EventHandler' ../../../lib/libosgviewer.so: undefined reference toosg::Group::getNumChildren() const' ../../../lib/libosgviewer.so: undefined reference to osg::NodeVisitor::apply(osg::Drawable&)' ../../../lib/libosgviewer.so: undefined reference toosg::NodeCallback::run(osg::Object, osg::Object)' ../../../lib/libosgviewer.so: undefined reference to `osgGA::EventHandler::operator()(osg::Node, osg::NodeVisitor*)' collect2: error: ld returned 1 exit status make[2]: [bin/cast-cost-unit] Error 1 make[1]: [src/trajopt/test/CMakeFiles/cast-cost-unit.dir/all] Error 2 make: *** [all] Error 2 18:35:30: The process "/usr/bin/cmake" exited with code 2. Error while building/deploying project trajopt (kit: Desktop) When executing step "Make"

i cloned the package and created build directory. So cd build && cmake .. -DGUROBI_LIBRARY=/opt/gurobi751/linux64/lib/libgurobi75.so && make gave me above error. Please help me to build it.

EdsterG commented 7 years ago

Can you provide more information? What system are you compiling on? What version of OSG do you have installed? Can you copy/paste the output from cmake?

k-maheshkumar commented 7 years ago

Im using ubuntu 14.04, $ osgversion OpenSceneGraph Library 3.4.2 $ cmake .. -DGUROBI_LIBRARY=/opt/gurobi751/linux64/lib/libgurobi75.so

cmake .. -DGUROBI_LIBRARY=/opt/gurobi751/linux64/lib/libgurobi75.so -- The C compiler identification is GNU 4.9.4 -- The CXX compiler identification is GNU 4.9.4 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Setting build type to 'Release' as none was specified. -- Found PkgConfig: /usr/bin/pkg-config (found version "0.26") -- checking for module 'eigen3' -- found eigen3, version 3.2.0 -- Found Eigen: /usr/include/eigen3
-- Boost version: 1.54.0 -- Found the following Boost libraries: -- system -- python -- thread -- program_options adding test with path /home/user/trajopt/python_examples/arm_to_joint_target.py python exc adding test with path /home/user/trajopt/python_examples/arm_to_cart_target.py python exc adding test with path /home/user/trajopt/python_examples/fullbody_plan.py python exc adding test with path /home/user/trajopt/python_examples/position_base.py python exc adding test with path /home/user/trajopt/python_examples/this_side_up.py python exc -- Found PythonInterp: /usr/bin/python (found version "2.7.6") -- Looking for include file pthread.h -- Looking for include file pthread.h - found -- Looking for pthread_create -- Looking for pthread_create - not found -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - found -- Found Threads: TRUE
-- Found GUROBI: /opt/gurobi751/linux64/lib/libgurobi75.so
Gurobi found -- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython2.7.so (found suitable version "2.7.6", minimum required is "2") -- Boost version: 1.54.0 -- Found the following Boost libraries: -- python -- Found OpenThreads: /usr/local/lib64/libOpenThreads.so
-- Found osg: /usr/local/lib64/libosg.so
-- Found osgDB: /usr/local/lib64/libosgDB.so
-- Found osgUtil: /usr/local/lib64/libosgUtil.so
-- Found osgViewer: /usr/local/lib64/libosgViewer.so
-- Found osgGA: /usr/local/lib64/libosgGA.so
-- Configuring done -- Generating done -- Build files have been written to: /home/user/trajopt/build

EdsterG commented 7 years ago

Looks like an issue with OpenSceneGraph 3.4.2, EventHandler handler was ether moved or removed. It should compile with OpenSceneGraph 3.4.0

tkelestemur commented 6 years ago

I am getting the exact same error. Installing OpenSceneGrasp 3.4.0 from source didn't help it.

EdsterG commented 6 years ago

Try with cmake .. -DOSG_DIR=/usr/local/lib64

EdsterG commented 6 years ago

Can you also try to compile OSG 3.4.1 from source and then compile trajopt?

tkelestemur commented 6 years ago

I've compiled without OSG (compiled the openrave without OSG as well) and it worked fine. PS. I was compiling with cmake .. -DOSG_DIR=/usr/local/lib64.

Only problem is thatOpenRAVE is throwing a warning:

2018-03-30 19:01:49,624 openrave [WARN] [plugindatabase.h:929 RaveDatabase::_SysLoadLibrary] /usr/local/lib/openrave0.9-plugins/libqtosgrave.so: libosgDB.so.130: cannot open shared object file: No such file or directory
EdsterG commented 6 years ago

Can you post all the commands you ran to install/compile OSG, OpenRave, and TrajOpt? Including every apt-get install command.

tkelestemur commented 6 years ago

Initially, I followed this to install OpenRAVE: https://scaron.info/teaching/installing-openrave-on-ubuntu-16.04.html The only different thing I did was to compile latest_stable branch. After installing openrave, I cloned trajopt and mkdir build; cd build

cmake .. -DOSG_DIR=/usr/local/lib64 -DGUROBI_LIBRARY=/opt/gurobi752/linux64/lib/libgurobi75.so

make -j4 Since this didn't work, I did the following: cd OpenSceneGraph/build sudo make uninstall cd openrave/build; sudo make uninstall cd ..; rm -r build; mkdir build; cd build cmake .. make -j4 sudo make install cd trajopt; rm -r build; mkdir build; cd build cmake .. -DGUROBI_LIBRARY=/opt/gurobi752/linux64/lib/libgurobi75.so make -j4

I have just tried installing OSG 3.4.1 but the openrave is not even compiling now.

EdsterG commented 6 years ago

Why don't you start fresh, make uninstall everything and delete the repos.

git clone https://github.com/openscenegraph/openscenegraph.git -b OpenSceneGraph-3.4.1 Build and install OSG 3.4.1 from source.

git clone https://github.com/flexible-collision-library/fcl.git -b 0.5.0 Build and install FCL 0.5.0 from source (needed for OpenRAVE).

Past the commands you ran to build and the resulting errors.

tkelestemur commented 6 years ago

Okay, so I've uninstalled and installed everything from scratch. Here is what I did after uninstalling:

  1. cd OpenSceneGraph; mkdir build; cd build (OSG branch is 3.4.1)
  2. cmake .. -DDESIRED_QT_VERSION=4
  3. make -j5
  4. sudo make install
  5. cd openrave; mkdir build; cd build (OR branch is latest_stable)
  6. mkdir build; cd build
  7. cmake .. -DOSG_DIR=/usr/local/lib64/
  8. make -j5
  9. sudo make install
  10. sudo apt-get install libopenscenegraph-dev cmake libboost-all-dev libeigen3-dev python-numpy (trajopt dependencies)
  11. cd trajopt
  12. mkdir build; cd build
  13. cmake .. -DOSG_DIR=/usr/local/lib64 -DGUROBI_LIBRARY=/opt/gurobi752/linux64/lib/libgurobi75.so

And I get the exact same errors. I think the problem is related to libopenscenegraph-dev package. I've checked ubuntu packages and it is installing version 3.2 where source installation of OpenSceneGraph is 3.4.x.

tkelestemur commented 6 years ago

I am able to build the trajopt without osgviewer. I've commented out every entry in CMakeLists.txt for osgviewer. I am not sure if this is gonna affect the trajopt functionality but it seems to me that osgviewer is used for visualisation without openrave since I'm gonna use C++ API in another openrave code this should be ok.

EdsterG commented 6 years ago

Yeah, don't install libopenscenegraph-dev via apt-get.

Uninstall the apt-get version and reinstalled the one from source by running: 1) sudo apt-get remove libopenscenegraph-dev 2) make uninstall from OpenSceneGraph/build 3) make install from OpenSceneGraph/build

However, you're right about OSG being needed only for visualization, so there's no need to build with it.

tkelestemur commented 6 years ago

If I don't have libopenscenegraph-dev is installed via apt-get, trajopt is throwing an error when I compile with osgviewer. I am not sure if source installation of OSG is not installing dev files or I'm point it wrong.

EdsterG commented 6 years ago

Whats the version of your OS?

tkelestemur commented 6 years ago

It's Ubuntu 16.04. I've ended up compiling openrave by disabling OSG. I uninstalled OSG 3.4.x that I installed from source and installed libopenscenegraph-dev via apt-get. Finally, I was able to compile trajopt with OSG. I am using qtcoin for openrave.

lakshmip001 commented 5 years ago

I installed libopenscegraph-dev for trajopt but it doesnt work with openrave.When I use openscenegraph same as trajopt , openrave gives an error that it doesnt load the environment. I am a beginner using two together, can you give instructions on how to use qtcoin with openrave?

lakshmip001 commented 5 years ago

I am using ubuntu 16.04 , I sloved above error by libopenscengraph-dev. Due to some reasons I did compiling again and I come across this error still [ 96%] Linking CXX executable ../../../bin/collision-checker-unit ../../../lib/libosgviewer.so: undefined reference to osg::Callback::traverse(osg::Object*, osg::Object*)' ../../../lib/libosgviewer.so: undefined reference toosg::Group::removeChild(osg::Node)' ../../../lib/libosgviewer.so: undefined reference to VTT for osgGA::EventHandler' ../../../lib/libosgviewer.so: undefined reference tonon-virtual thunk to osgGA::EventHandler::event(osg::NodeVisitor, osg::Drawable)' ../../../lib/libosgviewer.so: undefined reference to vtable for osgGA::EventHandler' ../../../lib/libosgviewer.so: undefined reference toosgGA::GUIEventHandler::handle(osgGA::Event, osg::Object, osg::NodeVisitor)' ../../../lib/libosgviewer.so: undefined reference to osg::Group::getNumChildren() const' ../../../lib/libosgviewer.so: undefined reference toosg::NodeVisitor::apply(osg::Drawable&)' ../../../lib/libosgviewer.so: undefined reference to osgGA::EventHandler::operator()(osg::Node*, osg::NodeVisitor*)' ../../../lib/libosgviewer.so: undefined reference totypeinfo for osgGA::EventHandler' ../../../lib/libosgviewer.so: undefined reference to osgGA::EventHandler::event(osg::NodeVisitor*, osg::Drawable*)' ../../../lib/libosgviewer.so: undefined reference tovirtual thunk to osg::Drawable::EventCallback::run(osg::Object, osg::Object)' ../../../lib/libosgviewer.so: undefined reference to osgGA::EventHandler::handle(osgGA::Event*, osg::Object*, osg::NodeVisitor*)' ../../../lib/libosgviewer.so: undefined reference toosg::Drawable::EventCallback::run(osg::Object, osg::Object)' ../../../lib/libosgviewer.so: undefined reference to osg::NodeVisitor::NodeVisitor(osg::NodeVisitor const&, osg::CopyOp const&)' ../../../lib/libosgviewer.so: undefined reference tovirtual thunk to osg::NodeCallback::run(osg::Object, osg::Object)' ../../../lib/libosgviewer.so: undefined reference to osg::NodeVisitor::apply(osg::Geometry&)' ../../../lib/libosgviewer.so: undefined reference toosg::NodeCallback::run(osg::Object, osg::Object)' collect2: error: ld returned 1 exit status src/trajopt/test/CMakeFiles/collision-checker-unit.dir/build.make:106: recipe for target 'bin/collision-checker-unit' failed make[2]: [bin/collision-checker-unit] Error 1 CMakeFiles/Makefile2:635: recipe for target 'src/trajopt/test/CMakeFiles/collision-checker-unit.dir/all' failed make[1]: [src/trajopt/test/CMakeFiles/collision-checker-unit.dir/all] Error 2 make[1]: Waiting for unfinished jobs.... ../../../lib/libosgviewer.so: undefined reference to `osg::Callback::traverse(osg::Object, osg::Object)' ../../../lib/libosgviewer.so: undefined reference to `osg::Group::removeChild(osg::Node)' ../../../lib/libosgviewer.so: undefined reference to VTT for osgGA::EventHandler' ../../../lib/libosgviewer.so: undefined reference tonon-virtual thunk to osgGA::EventHandler::event(osg::NodeVisitor, osg::Drawable)' ../../../lib/libosgviewer.so: undefined reference to vtable for osgGA::EventHandler' ../../../lib/libosgviewer.so: undefined reference toosgGA::GUIEventHandler::handle(osgGA::Event, osg::Object, osg::NodeVisitor)' ../../../lib/libosgviewer.so: undefined reference to osg::Group::getNumChildren() const' ../../../lib/libosgviewer.so: undefined reference toosg::NodeVisitor::apply(osg::Drawable&)' ../../../lib/libosgviewer.so: undefined reference to `osgGA::EventHandler::operator()(osg::Node, osg::NodeVisitor)' ../../../lib/libosgviewer.so: undefined reference to typeinfo for osgGA::EventHandler' ../../../lib/libosgviewer.so: undefined reference toosgGA::EventHandler::event(osg::NodeVisitor, osg::Drawable)' ../../../lib/libosgviewer.so: undefined reference to `virtual thunk to osg::Drawable::EventCallback::run(osg::Object, osg::Object)' ../../../lib/libosgviewer.so: undefined reference to `osgGA::EventHandler::handle(osgGA::Event, osg::Object, osg::NodeVisitor)' ../../../lib/libosgviewer.so: undefined reference to osg::Drawable::EventCallback::run(osg::Object*, osg::Object*)' ../../../lib/libosgviewer.so: undefined reference toosg::NodeVisitor::NodeVisitor(osg::NodeVisitor const&, osg::CopyOp const&)' ../../../lib/libosgviewer.so: undefined reference to virtual thunk to osg::NodeCallback::run(osg::Object*, osg::Object*)' ../../../lib/libosgviewer.so: undefined reference toosg::NodeVisitor::apply(osg::Geometry&)' ../../../lib/libosgviewer.so: undefined reference to `osg::NodeCallback::run(osg::Object, osg::Object)' collect2: error: ld returned 1 exit status src/trajopt/test/CMakeFiles/cast-cost-unit.dir/build.make:107: recipe for target 'bin/cast-cost-unit' failed make[2]: ** [bin/cast-cost-unit] Error 1 CMakeFiles/Makefile2:678: recipe for target 'src/trajopt/test/CMakeFiles/cast-cost-unit.dir/all' failed make[1]: [src/trajopt/test/CMakeFiles/cast-cost-unit.dir/all] Error 2 Makefile:94: recipe for target 'all' failed make: *** [all] Error 2 Any idea how I can solve it.

lakshmip001 commented 5 years ago

my sudo apt-get install libopenscenegraph-dev doesnt install libopenscegraph-dev.so and results in .md5sums,.lists files . while try to remove libopenscenegraph100v5 it also removes libopenscengraph-dev. So kindly please let how I can solve this without the above error.

lakshmip001 commented 5 years ago

I sloved this problem by uninstalling and reinstalling with the following steps git clone https://github.com/openscenegraph/openscenegraph.git -b OpenSceneGraph-3.4.1 mkdir build && cd build cmake .. -DDESIRED_QT_VERSION=4 make -j5 sudo make install

and the setting ENV_VAR in .bashrc export LD_LIBRARY_PATH="/usr/local/lib64:/usr/local/lib:$(openrave-config --python-dir)/openravepy/openravepy:$LD_LIBRARY_PATH" export OPENTHREADS_INC_DIR="/usr/local/include" export OPENTHREADS_LIB_DIR="/usr/local/lib64:/usr/local/lib" export PATH="$OPENTHREADS_LIB_DIR:$PATH"

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
An804182 commented 4 years ago

thanks for this post. I almost tried every method mentioned above by everyone and finally successfully build. and ctest has a result of 100% passed. so thank everyone for giving instruction

ZZHPKU commented 1 year ago

My final solution :

Environment: Ubuntu 16

Step 1: Install OpenRAVE. Ref: https://gitcode.net/mirrors/crigroup/openrave-installation?utm_source=csdn_github_accelerator. PS: We need OpenRAVE>=0.8, so Ubuntu 16 (or 14) is required with above method.

Step 2: Install CMake, boost, and Eigen using your package manager (Don't install OpenSceneGraph as we have install it at step 1. This is important). Command: sudo apt-get install cmake libboost-all-dev libeigen3-dev python-numpy

Step 3: Install trajopt. Command as follows: git clone https://github.com/joschu/trajopt.git cd trajopt mkdir build cd build cmake .. -DOSG_DIR=/usr/local/lib64 make -j

An error I meet: trajopt/src/osgviewer/osgviewer.cpp:17:10: fatal error: osg/CameraNode: No such file or directory Solution: Modify trajopt/src/osgviewer/osgviewer.cpp so that CameraNode is replaced by Camera.

Step 4: For testing, refer to https://rll.berkeley.edu/trajopt/doc/sphinx_build/html/install.html