Monday, 3 October 2011

Installing Player/Stage in Ubuntu (Natty Narwhal)

A few months ago I wrote a guide to installing Player/Stage on a clean Natty Narwhal Ubuntu install for the robot lab I work at. This was on a protected wiki, but I think maybe it'd also be beneficial to the world in general, so I'll guide you through the installation process (with pictures!) in this blog entry.

I'm pretty sure this guide will work for any version of Ubuntu that has Ubuntu Software Centre on it, but I've only tested these instructions for Natty. If you followed these instructions to install Player/Stage on a non-Natty version of Ubuntu do leave a comment so that others can know whether it works.

A newer version of these instructions for Ubuntu 11.10 can be found here.

If you have any problems or questions that aren't addressed here then I recommend you email the playerstage users mailing list.

These instructions are for Player 3.0.2 and Stage 4.0.1 which are the most recent versions at the time of writing this guide.
It helps to have a computer which you have sudo rights to. If the computer is networked and you can't install stuff on it then ask the network administrator to install playerstage for you, alternatively you can install Player/Stage into your home director, this is also described below.

Setup

 

  1. First download Player and Stage.
  2. extract the tar.gz files. Right click on the icon of the thing you just downloaded and select "extract here".
  3. Install cmake. Open a terminal and type:
    • sudo apt-get install cmake
    •  follow instructions on screen

Installing Dependencies


Player/Stage has a lot of dependencies, but they can be installed with Ubuntu software centre reasonably easily.
  1. To open Ubuntu software centre (if you don't know how) click the ubuntu logo in the very top left of the screen and start typing ubuntu. It should come up as one of the options.
  2. The following dependencies need to be installed:
    • pkg-config
    • FLTK 1.1.x
    • OpenGL
    • libpng
    • ltdl (Libtool)
  3. In the top right of the ubuntu software centre there's a search bar. Start typing pkg-config in, that should give you the pkg-config installer. If it's not already installed, then click install.
  4. To install FLTK type FLTK into the search bar. This time the thing you want probably won't be an option. Click on "show technical items" (see picture)
  5. Click on and install from the list of options:
    • Fast Light Toolkit - shared libraries, libfltk1.1
    • Fast Light Toolkit - development files, libfltk1.1-dev
  6. Type opengl into the search bar and install from the list:
    • OpenGL Utility Toolkit - freeglut3
    • the OpenGL Utility Toolkit - libglut3
    • OpenGL Utility Toolkit development files, freeglut3-dev
  7. Type libpng into the search bar and install the following:
    • PNG Library Runtime, libpng12-0 (or whatever is the latest version number)
    • PNG Library Development, libpng12-dev
  8. Type libtool into the search bar and install the following:
    • Generic Library support script, libtool
    • A system independent dlopen wrapper for GNU libtool, libltdl7
    • A system independent dlopen wrapper for GNU libtool, libltdl-dev

Installing Player



This should work first time, even on a fresh install of Ubuntu.
Open a terminal and change directory (cd command) to the folder you extracted player into. This will probably be called something like "player-3.02" or whatever version you downloaded. Then enter the following commands:
  • mkdir build
  • cd build
  • cmake ..
  • sudo make install

But I don't have sudo!

Well then you'll have to install it into your home directory somewhere. This is a pretty similar process, you just have to change the install prefix.
  • mkdir build
  • cd build
  • ccmake ..
    • Note that's '''ccmake''' not cmake
  • in the terminal scroll menu thing that just opened scroll down to CMAKE_INSTALL_PREFIX. If nothing is listed press c, things should appear.
    • whilst it is selected press enter to edit the option and then change it to the folder you want player installed into.
    • press enter to confirm edit
  • press c to configure the settings
  • if the option appears, press g to generate the make files. If the option doesn't appear press c again until it does.
  • In the terminal now type make install

Installing Stage


  1. Make sure that pkg-config can find player, otherwise there may be all sorts of troubles later when you try and use Stage. In a terminal type:
    • pkg-config --modversion playercore
  2. If it gives you a version number it's properly installed. Otherwise, in your home folder make or edit the file called .bashrc, (it probably already exists). If you press ctrl+h while looking at the folder in nautilus it will show up if it's already there. At the end of this file write the following line IF YOU'RE USING A 64-BIT INSTALL:
    • export PKG_CONFIG_PATH+=/usr/local/lib64/pkgconfig
    Write the following line IF YOU'RE USING A 32-BIT INSTALL:
    • export PKG_CONFIG_PATH+=/usr/local/lib/pkgconfig
  3. Test this again in a new terminal with
    • pkg-config --modversion playercore

  4. In a new terminal navigate to the stage folder you extracted earlier. this is probably called something like "Stage-4.0.1-Source" or whatever Stage version you installed. In a terminal type the following commands:
    • mkdir build
    • cd build
    • cmake ..
    • sudo make install

But I don't have sudo!

The install is just the same as for Player if you need to install Stage in your home folder or somewhere.
  1. Follow steps 1,2 and 3 above for configuring pkg-config (otherwise this will not work).
  2. Then in a terminal  navigate to the stage folder you extracted earlier. this is probably called something like "Stage-4.0.1-Source" or whatever Stage version you installed. In a terminal type the following commands:
    • mkdir build
    • cd build
    • ccmake ..
  3. in the terminal menu thing that just opened scroll down to CMAKE_INSTALL_PREFIX. If nothing is listed press c, things should appear.
  4. whilst it is selected press enter to edit the option and then change it to the folder you want player installed into.
  5. press enter to confirm edit
  6. press c to configure the settings
  7. if the option appears, press g to generate the make files. If the option doesn't appear press c again until it does.
  8. In the terminal now type: 
    • make install

Testing it works


The stage source code has some handy code that should work if you've got everything installed. To test your install in your terminal go to the /worlds directory in the source code folder. Type player simple.cfg into the terminal. In the unlikely event that that works you've successfully installed Player/Stage!

I got the following error:
  • player: error while loading shared libraries: libplayerdrivers.so.3.0: cannot open shared object file: No such file or directory.

To fix this open up your .bashrc file and enter the following line IF YOU'RE USING A 64-BIT INSTALL:
  • export LD_LIBRARY_PATH+=/usr/local/lib64 

Write the following line IF YOU'RE USING A 32-BIT INSTALL:
  • export LD_LIBRARY_PATH+=/usr/local/lib 

If you changed CMAKE_INSTALL_PREFIX whilst installing player and or stage then do this:
  • export LD_LIBRARY_PATH+="whatever install prefix you made"
Now retest your install IN A NEW TERMINAL. I got the following error:
Registering driver Player v.3.0.2
* Part of the Player/Stage/Gazebo Project [http://playerstage.sourceforge.net].
* Copyright (C) 2000 - 2009 Brian Gerkey, Richard Vaughan, Andrew Howard,
* Nate Koenig, and contributors. Released under the GNU General Public License.
* Player comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it under certain conditions; see COPYING for details.

error : Failed to load plugin stageplugin.
error : libtool reports error: file not found
error : plugin search path: /home/robotlab/playerstage/Stage-3.2.2-Source/worlds:.:/usr/local/lib/
error : failed to load plugin: stageplugin error : failed to parse config file simple.cfg driver blocks


This is most likely caused by the computer not being able to find Stage. Back to the .bashrc....
  • change export LD_LIBRARY_PATH+=/usr/local/lib64 to...
  • export LD_LIBRARY_PATH+=/usr/local/lib64:/usr/local/lib

11 comments:

  1. Very nice! I am still using Player/Stage on Ubuntu 10.04, have not yet ventured into Ubuntu with Unity.Being a GNOME enthusiast Unity is blasphemous. Still, I look forward to Ubuntu 12.04, which will be an LTS release.

    ReplyDelete
  2. I have a problem when I install Stage.On 4th step when I type make install I get:


    [ 82%] Building CXX object libstageplugin/CMakeFiles/stageplugin.dir/p_graphics.o
    /home/daniel/Downloads/rtv-Stage-508538b/libstageplugin/p_graphics.cc: In member function ‘virtual int InterfaceGraphics2d::ProcessMessage(QueuePointer&, player_msghdr_t*, void*)’:
    /home/daniel/Downloads/rtv-Stage-508538b/libstageplugin/p_graphics.cc:236:41: error: ‘PLAYER_GRAPHICS2D_CMD_MULTILINE’ was not declared in this scope
    /home/daniel/Downloads/rtv-Stage-508538b/libstageplugin/p_graphics.cc: In member function ‘virtual void PlayerGraphics2dVis::RenderItem(Message&)’:
    /home/daniel/Downloads/rtv-Stage-508538b/libstageplugin/p_graphics.cc:277:14: error: ‘PLAYER_GRAPHICS2D_CMD_MULTILINE’ was not declared in this scope
    /home/daniel/Downloads/rtv-Stage-508538b/libstageplugin/p_graphics.cc:278:17: error: ‘player_graphics2d_cmd_multiline_t’ was not declared in this scope
    /home/daniel/Downloads/rtv-Stage-508538b/libstageplugin/p_graphics.cc:279:35: error: ‘data’ was not declared in this scope
    /home/daniel/Downloads/rtv-Stage-508538b/libstageplugin/p_graphics.cc:280:67: error: expected type-specifier before ‘player_graphics2d_cmd_multiline_t’
    /home/daniel/Downloads/rtv-Stage-508538b/libstageplugin/p_graphics.cc:280:67: error: expected ‘>’ before ‘player_graphics2d_cmd_multiline_t’
    /home/daniel/Downloads/rtv-Stage-508538b/libstageplugin/p_graphics.cc:280:67: error: expected ‘(’ before ‘player_graphics2d_cmd_multiline_t’
    /home/daniel/Downloads/rtv-Stage-508538b/libstageplugin/p_graphics.cc:280:101: error: expected primary-expression before ‘>’ token
    /home/daniel/Downloads/rtv-Stage-508538b/libstageplugin/p_graphics.cc:280:122: error: expected ‘)’ before ‘;’ token
    make[2]: *** [libstageplugin/CMakeFiles/stageplugin.dir/p_graphics.o] Error 1
    make[1]: *** [libstageplugin/CMakeFiles/stageplugin.dir/all] Error 2
    make: *** [all] Error 2



    ----------------------------------
    First time happened at 98%, but when I tried again stopped at 82%.

    Any idea?

    ReplyDelete
  3. ^^Use a more stable version of stage. The problem does not happen with Stage3.2.2

    ReplyDelete
  4. When I use ./simulator get error message:
    error while loading shared libraries: libplayerc++.so.3.0: cannot open shared object file: No such file or directory

    ReplyDelete
  5. Hi all, if anyone come accross with Player installation error issue as below like me (during sudo make install),

    /home//builds/player/src/player-3.0.2/server/drivers/shell/readlog.cc:
    In member function ‘virtual void ReadLog::Main()’:
    /home//builds/player/src/player-3.0.2/server/drivers/shell/readlog.cc:668:43:
    error: cannot convert ‘FILE* {aka _IO_FILE*}’ to ‘gzFile’ for argument
    ‘1’ to ‘off_t gzseek(gzFile, off_t, int)’
    /home/stefano/builds/player/src/player-3.0.2/server/drivers/shell/readlog.cc:714:62:
    error: cannot convert ‘FILE* {aka _IO_FILE*}’ to ‘gzFile’ for argument
    ‘1’ to ‘char* gzgets(gzFile, char*, int)’
    make[2]: *** [server/libplayerdrivers/CMakeFiles/playerdrivers.dir/__/drivers/shell/readlog.o]
    Error 1
    make[1]: *** [server/libplayerdrivers/CMakeFiles/playerdrivers.dir/all] Error 2
    make: *** [all] Error 2

    Please try to download zlib 1.2.5 from zlib.net website, extract, configure, make n install it. This solution works for me!

    credits to:
    http://sourceforge.net/mailarchive/forum.php?thread_name=From_noreply%40sourceforge.net_Sat_Jul_07_17%3A37%3A11_2012&forum_name=playerstage-developers

    ReplyDelete
  6. Hi Everyone,
    you can visit the following link to install player/stage,it works for 64-bit 12.04 ubuntu systems

    link:http://abhishekannamraju.blogspot.in/

    ReplyDelete
  7. Hi Everyone,
    Player 3.0.2 error:

    [ 16%] Building CXX object client_libs/libplayerc++/CMakeFiles/playerc++.dir/playerclient.o
    In file included from /home/benaissa/Téléchargements/player-3.0.2/client_libs/libplayerc++/playerclient.h:66:0,
    from /home/benaissa/Téléchargements/player-3.0.2/client_libs/libplayerc++/playerc++.h:61,
    from /home/benaissa/Téléchargements/player-3.0.2/client_libs/libplayerc++/playerclient.cc:54:
    /usr/include/boost/signal.hpp:17:4: warning: #warning "Boost.Signals is no longer being maintained and is now deprecated. Please switch to Boost.Signals2. To disable this warning message, define BOOST_SIGNALS_NO_DEPRECATION_WARNING." [-Wcpp]
    # warning "Boost.Signals is no longer being maintained and is now deprecated. Please switch to Boost.Signals2. To disable this warning message, define BOOST_SIGNALS_NO_DEPRECATION_WARNING."
    ^

    In file included from /usr/include/pthread.h:24:0,
    from /usr/include/i386-linux-gnu/c++/4.8/bits/gthr-default.h:35,
    from /usr/include/i386-linux-gnu/c++/4.8/bits/gthr.h:148,
    from /usr/include/c++/4.8/ext/atomicity.h:35,
    from /usr/include/c++/4.8/bits/ios_base.h:39,
    from /usr/include/c++/4.8/ios:42,
    from /usr/include/c++/4.8/ostream:38,
    from /usr/include/c++/4.8/iostream:39,
    from /home/benaissa/Téléchargements/player-3.0.2/client_libs/libplayerc++/playerclient.cc:48:
    /home/benaissa/Téléchargements/player-3.0.2/client_libs/libplayerc++/playerclient.cc: In member function ‘void PlayerCc::PlayerClient::RunThread()’:
    /home/benaissa/Téléchargements/player-3.0.2/client_libs/libplayerc++/playerclient.cc:171:34: error: expected unqualified-id before numeric constant
    boost::xtime_get(&xt, boost::TIME_UTC);
    ^
    /home/benaissa/Téléchargements/player-3.0.2/client_libs/libplayerc++/playerclient.cc: In member function ‘void PlayerCc::PlayerClient::Run(uint32_t)’:
    /home/benaissa/Téléchargements/player-3.0.2/client_libs/libplayerc++/playerclient.cc:184:31: warning: narrowing conversion of ‘(aTimeout * 1000000u)’ from ‘uint32_t {aka unsigned int}’ to ‘__syscall_slong_t {aka long int}’ inside { } is ill-formed in C++11 [-Wnarrowing]
    timespec sleep = {0,aTimeout*1000000};
    ^
    make[2]: *** [client_libs/libplayerc++/CMakeFiles/playerc++.dir/playerclient.o] Erreur 1
    make[1]: *** [client_libs/libplayerc++/CMakeFiles/playerc++.dir/all] Erreur 2
    make: *** [all] Erreur 2

    ReplyDelete
    Replies
    1. Did you get the solution for this error?

      Delete
  8. can you or any one upload Stage 4.0.1 again because the link don't work

    ReplyDelete