Anyone able to compile on latest Ubuntu (13.X)?

Questions, problems and discussion about compiling FreeOrion.

Moderator: Oberlus

Message
Author
User avatar
Rydra
Space Squid
Posts: 55
Joined: Fri Jun 28, 2013 6:15 pm

Anyone able to compile on latest Ubuntu (13.X)?

#1 Post by Rydra »

Hi there,

I've tried with different boost versions (1.47, 1.49, 1.53) in order to compile freeorion from source, yet it seems impossible on ubuntu. Cmake . goes all well, but when compiling, it yields to the following error:

Code: Select all

[ 13%] Building CXX object CMakeFiles/freeorioncommon.dir/Empire/ResourcePool.cpp.o
[ 13%] Building CXX object CMakeFiles/freeorioncommon.dir/Empire/Diplomacy.cpp.o   
[ 13%] Building CXX object CMakeFiles/freeorioncommon.dir/network/Message.cpp.o    
[ 14%] Building CXX object CMakeFiles/freeorioncommon.dir/network/MessageQueue.cpp.o                                                                                  
In file included from /usr/local/include/boost/thread/detail/platform.hpp:17:0,
                 from /usr/local/include/boost/thread/condition_variable.hpp:12,
                 from /usr/local/include/boost/thread/condition.hpp:9,
                 from /home/david/Centropruebas/freeorion/FreeOrion/network/MessageQueue.h:5,
                 from /home/david/Centropruebas/freeorion/FreeOrion/network/MessageQueue.cpp:1:
/usr/local/include/boost/config/requires_threads.hpp:29:4: error: #error "Threading support unavaliable: it has been explicitly disabled with BOOST_DISABLE_THREADS"
In file included from /usr/local/include/boost/thread/condition_variable.hpp:12:0,
                 from /usr/local/include/boost/thread/condition.hpp:9,
                 from /home/david/Centropruebas/freeorion/FreeOrion/network/MessageQueue.h:5,
                 from /home/david/Centropruebas/freeorion/FreeOrion/network/MessageQueue.cpp:1:
/usr/local/include/boost/thread/detail/platform.hpp:67:9: error: #error "Sorry, no boost threads are available for this platform."
In file included from /usr/local/include/boost/thread/condition.hpp:9:0,
                 from /home/david/Centropruebas/freeorion/FreeOrion/network/MessageQueue.h:5,
                 from /home/david/Centropruebas/freeorion/FreeOrion/network/MessageQueue.cpp:1:
/usr/local/include/boost/thread/condition_variable.hpp:18:2: error: #error "Boost threads unavailable on this platform"
In file included from /home/david/Centropruebas/freeorion/FreeOrion/network/MessageQueue.h:6:0,
                 from /home/david/Centropruebas/freeorion/FreeOrion/network/MessageQueue.cpp:1:
/usr/local/include/boost/thread/mutex.hpp:18:2: error: #error "Boost threads unavailable on this platform"
In file included from /home/david/Centropruebas/freeorion/FreeOrion/network/MessageQueue.h:5:0,
                 from /home/david/Centropruebas/freeorion/FreeOrion/network/MessageQueue.cpp:1:
/usr/local/include/boost/thread/condition.hpp:13:13: error: ‘condition_variable_any’ does not name a type
In file included from /home/david/Centropruebas/freeorion/FreeOrion/network/MessageQueue.cpp:1:0:
/home/david/Centropruebas/freeorion/FreeOrion/network/MessageQueue.h:19:30: error: expected ‘)’ before ‘&’ token
/home/david/Centropruebas/freeorion/FreeOrion/network/MessageQueue.h:42:5: error: ‘condition’ in namespace ‘boost’ does not name a type
/home/david/Centropruebas/freeorion/FreeOrion/network/MessageQueue.h:43:5: error: ‘mutex’ in namespace ‘boost’ does not name a type
/home/david/Centropruebas/freeorion/FreeOrion/network/MessageQueue.cpp:13:27: error: expected constructor, destructor, or type conversion before ‘(’ token
/home/david/Centropruebas/freeorion/FreeOrion/network/MessageQueue.cpp: In member function ‘bool MessageQueue::Empty() const’:
/home/david/Centropruebas/freeorion/FreeOrion/network/MessageQueue.cpp:18:12: error: ‘boost::mutex’ has not been declared
/home/david/Centropruebas/freeorion/FreeOrion/network/MessageQueue.cpp:18:31: error: expected ‘;’ before ‘lock’
/home/david/Centropruebas/freeorion/FreeOrion/network/MessageQueue.cpp: In member function ‘std::size_t MessageQueue::Size() const’:
/home/david/Centropruebas/freeorion/FreeOrion/network/MessageQueue.cpp:23:12: error: ‘boost::mutex’ has not been declared
/home/david/Centropruebas/freeorion/FreeOrion/network/MessageQueue.cpp:23:31: error: expected ‘;’ before ‘lock’
/home/david/Centropruebas/freeorion/FreeOrion/network/MessageQueue.cpp: In member function ‘void MessageQueue::Clear()’:
/home/david/Centropruebas/freeorion/FreeOrion/network/MessageQueue.cpp:28:12: error: ‘boost::mutex’ has not been declared
/home/david/Centropruebas/freeorion/FreeOrion/network/MessageQueue.cpp:28:31: error: expected ‘;’ before ‘lock’
/home/david/Centropruebas/freeorion/FreeOrion/network/MessageQueue.cpp: In member function ‘void MessageQueue::PushBack(Message&)’:
/home/david/Centropruebas/freeorion/FreeOrion/network/MessageQueue.cpp:33:12: error: ‘boost::mutex’ has not been declared
/home/david/Centropruebas/freeorion/FreeOrion/network/MessageQueue.cpp:33:31: error: expected ‘;’ before ‘lock’
/home/david/Centropruebas/freeorion/FreeOrion/network/MessageQueue.cpp:37:9: error: ‘m_have_synchronous_response’ was not declared in this scope
/home/david/Centropruebas/freeorion/FreeOrion/network/MessageQueue.cpp: In member function ‘void MessageQueue::PopFront(Message&)’:
/home/david/Centropruebas/freeorion/FreeOrion/network/MessageQueue.cpp:41:12: error: ‘boost::mutex’ has not been declared
/home/david/Centropruebas/freeorion/FreeOrion/network/MessageQueue.cpp:41:31: error: expected ‘;’ before ‘lock’
/home/david/Centropruebas/freeorion/FreeOrion/network/MessageQueue.cpp: In member function ‘void MessageQueue::EraseFirstSynchronousResponse(Message&)’:
/home/david/Centropruebas/freeorion/FreeOrion/network/MessageQueue.cpp:47:12: error: ‘boost::mutex’ has not been declared
/home/david/Centropruebas/freeorion/FreeOrion/network/MessageQueue.cpp:47:31: error: expected ‘;’ before ‘lock’
/home/david/Centropruebas/freeorion/FreeOrion/network/MessageQueue.cpp:50:9: error: ‘m_have_synchronous_response’ was not declared in this scope
/home/david/Centropruebas/freeorion/FreeOrion/network/MessageQueue.cpp:50:42: error: ‘lock’ was not declared in this scope
make[2]: *** [CMakeFiles/freeorioncommon.dir/network/MessageQueue.cpp.o] Error 1
make[1]: *** [CMakeFiles/freeorioncommon.dir/all] Error 2
make: *** [all] Error 2
I've tried with a couple of PCs and following the guide on http://www.freeorion.org/index.php/Compile, yet no luck.

Can anyone assist me?

Thank you.

User avatar
adrian_broher
Programmer
Posts: 1156
Joined: Fri Mar 01, 2013 9:52 am
Location: Germany

Re: Anyone able to compile on latest Ubuntu (13.X)?

#2 Post by adrian_broher »

What's your compiler version and boost version?

This sounds like a boost issue:

http://stackoverflow.com/questions/5389 ... buntu10-10
https://bbs.archlinux.org/viewtopic.php?pid=1130928
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13603
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Anyone able to compile on latest Ubuntu (13.X)?

#3 Post by Geoff the Medio »

Based on your error messages, whatever versions of Boost you're using appear to be set up with BOOST_DISABLE_THREADS defined. Try locating wherever that's set and turning it off.

Alternatively, try googling "Threading support unavaliable: it has been explicitly disabled with BOOST_DISABLE_THREADS". A quick search suggests that particular versions of GCC have some issue with Boost threads.

User avatar
Rydra
Space Squid
Posts: 55
Joined: Fri Jun 28, 2013 6:15 pm

Re: Anyone able to compile on latest Ubuntu (13.X)?

#4 Post by Rydra »

Ok I managed to go through that part with the links provided by adrian_broher. However it fails to compile in another point:

Code: Select all

[ 42%] Building CXX object GG/src/CMakeFiles/GiGi.dir/GUI.cpp.o
/home/rydra/Centropruebas/freeorion/FreeOrion/GG/src/GUI.cpp: In member function ‘virtual void GG::GUI::Wait(unsigned int)’:
/home/rydra/Centropruebas/freeorion/FreeOrion/GG/src/GUI.cpp:813:33: error: expected unqualified-id before numeric constant
make[2]: *** [GG/src/CMakeFiles/GiGi.dir/GUI.cpp.o] Error 1
make[1]: *** [GG/src/CMakeFiles/GiGi.dir/all] Error 2
make: *** [all] Error 2
I've been searching on Google, but no clue. Any ideas?

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13603
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Anyone able to compile on latest Ubuntu (13.X)?

#5 Post by Geoff the Medio »

Look at the indicated lines of code:

Code: Select all

#if BOOST_VERSION >= 105000
    boost::xtime_get(&t, boost::TIME_UTC_);
#else
    boost::xtime_get(&t, boost::TIME_UTC);
#endif
813 is the second of the two that doesn't start with #. So based on that, google "boost::TIME_UTC_". See various references, such as:
http://stackoverflow.com/questions/1364 ... t-versions

Apparently you've got a weirdly modified version of boost, or are mixing header versions. I'm not sure what the best way to get it to compile is, but try editing that one line to just use the version of the constant your system likes. If that's the only instance of it being used, things should be fine. If not, try a find and replace. Since you've got multiple versions installed apparently, it might be mixing them in weird ways, which might need sorting out.

User avatar
Rydra
Space Squid
Posts: 55
Joined: Fri Jun 28, 2013 6:15 pm

Re: Anyone able to compile on latest Ubuntu (13.X)?

#6 Post by Rydra »

I finally managed to compile by modifying the line 813 to TIME_UTC_ and applying the steps in viewtopic.php?f=24&t=7603 (with some modifications for ubuntu)

However one last step separates me from executing the game:

Code: Select all

rydra@veronica:~/Centropruebas/freeorion/FreeOrion$ ./freeorion
main() caught exception(std::exception): OGRE EXCEPTION(7:InternalErrorException): Could not load dynamic library ./RenderSystem_GL.  System Error: ./RenderSystem_GL.so: cannot open shared object file: No such file or directory in DynLib::load at /build/buildd/ogre-1.7.4+dfsg1/OgreMain/src/OgreDynLib.cpp (line 91)
Any clue about that RenderSystem_SL.so file?

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13603
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Anyone able to compile on latest Ubuntu (13.X)?

#7 Post by Geoff the Medio »

viewtopic.php?f=25&t=4105

The CMake build is supposed to set up ogre_plugins.cfg correctly, but apparently it hasn't for you. Do you have those Ogre3D plugins built and installed? If not, you need them. If so, edit ogre_plugins.cfg to point to their location.

User avatar
Rydra
Space Squid
Posts: 55
Joined: Fri Jun 28, 2013 6:15 pm

Re: Anyone able to compile on latest Ubuntu (13.X)?

#8 Post by Rydra »

OMG, can't believe I finally manage to compile and execute the game :D

Thank you very much. Whenever I have a break at my job I'll modify the wiki and add the instructions. However I feel it's been a nightmare and lot of work needs to be done about compiling freeorion on Linux.

I'm happy now :D

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13603
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Anyone able to compile on latest Ubuntu (13.X)?

#9 Post by Geoff the Medio »

It would be helpful to write (briefly, in your post) what you did that fixed it, not just that it was fixed.

And to be fair, from what you posted, it looks like most of the issues you had were due to weird things on your specific system or distro version and Boost, and not issues with the FreeOrion CMake / Linux build system in general.

User avatar
adrian_broher
Programmer
Posts: 1156
Joined: Fri Mar 01, 2013 9:52 am
Location: Germany

Re: Anyone able to compile on latest Ubuntu (13.X)?

#10 Post by adrian_broher »

Rydra wrote:Thank you very much. Whenever I have a break at my job I'll modify the wiki and add the instructions.
Please don't. You came from a broken setup (several incompatible boost installations on one machine) so adding instructions to build on a broken setup won't help anybody. 'Fixing' it in the system headers is actually a no-no. If that is required to build something that builds fine on several other very different distributions, it is just an indicator that you should try to create a non broken setup and if that doesn't help you should write a bug report to your distribution so that they can fix their stuff.

Also the code you referred to looks strangely familiar. Didn't I kill off this ugly crutch just a few weeks ago? Indeed I did in r6110, seems like I missed this one.
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz

Apo
Space Squid
Posts: 89
Joined: Fri Apr 19, 2013 4:10 pm

Re: Anyone able to compile on latest Ubuntu (13.X)?

#11 Post by Apo »

Hi,

i would like to suggest to update the Wiki and point Debian users and users of Debian derivatives to the official repository of FreeOrion for Debian at

http://anonscm.debian.org/gitweb/?p=pkg ... eorion.git

http://packages.qa.debian.org/f/freeorion.html

I think it is easier to compile a package from source if you use the existing packaging work for Debian.

Everyone who is interested in improving the packaging quality, feel free to join

#debian-games at irc.debian.org

or ask your Debian related questions on the debian-devel-games mailinglist

http://lists.debian.org/debian-devel-games/

I think Ubuntu users will also benefit from the already available freeorion package in Debian experimental. Please note that Ubuntu has already made the transition to boost1.53 while Debian still uses 1.49.

Unfortunately i can't modify the Wiki otherwise i would update it with the information above.

User avatar
Rydra
Space Squid
Posts: 55
Joined: Fri Jun 28, 2013 6:15 pm

Re: Anyone able to compile on latest Ubuntu (13.X)?

#12 Post by Rydra »

adrian_broher wrote:
Rydra wrote:Thank you very much. Whenever I have a break at my job I'll modify the wiki and add the instructions.
Please don't. You came from a broken setup (several incompatible boost installations on one machine) so adding instructions to build on a broken setup won't help anybody. 'Fixing' it in the system headers is actually a no-no. If that is required to build something that builds fine on several other very different distributions, it is just an indicator that you should try to create a non broken setup and if that doesn't help you should write a bug report to your distribution so that they can fix their stuff.

Also the code you referred to looks strangely familiar. Didn't I kill off this ugly crutch just a few weeks ago? Indeed I did in r6110, seems like I missed this one.
I'm not sure what do you mean by "a broken setup" as my boost libraries came from Ubuntu's package manager (package libboost1.49-all-dev).

Edit: Ahhh I see. As I had to modify core files from boost my setup is broken from the distribution POV. Thanks!

PD: I'll write the steps in a while.

User avatar
Rydra
Space Squid
Posts: 55
Joined: Fri Jun 28, 2013 6:15 pm

Re: Anyone able to compile on latest Ubuntu (13.X)?

#13 Post by Rydra »

Allright, the steps I followed to compile freeorion in Ubuntu 13.04 are the following:

1- Get the source from SVN:

Code: Select all

svn co https://svn.code.sf.net/p/freeorion/code/trunk freeorion 
2- Get dependencies to compile:

Code: Select all

sudo apt-get install build-essential subversion pkg-config libltdl3-dev cmake
sudo apt-get install python-dev libfreetype6-dev libsdl1.2-dev libalut-dev libvorbis-dev libois-dev libtiff4-dev libopenal-dev libogre-dev
sudo apt-get install libboost-dev libboost1.49-all-dev --install-recommends
sudo apt-get install automake
sudo apt-get install libzzip-dev libfreeimage-dev x11proto-xf86vidmode-dev libxxf86vm-dev
sudo apt-get install libpcre3-dev libfreetype6-dev libxrandr-dev libxaw7-dev libmng-dev libglew1.5-dev libxt-dev
3- Add the following repository to /etc/apt/source.list

Code: Select all

deb-src http://http.debian.net/debian sid main
4- Install bullet:

Code: Select all

sudo apt-get update
sudo apt-get install debhelper devscripts build-essential
sudo apt-get build-dep bullet
mkdir dep
cd dep
apt-get -b source bullet
sudo dpkg -i *.deb
5- Create symbolic links (change x86_64 to i386 if you have a 32 bit system):

Code: Select all

sudo ln -s /usr/lib/x86_64-linux-gnu/libBulletCollision.so /usr/local/lib/libbulletcollision.so
sudo ln -s /usr/lib/x86_64-linux-gnu/libBulletDynamics.so /usr/local/lib/libbulletdynamics.so
sudo ln -s /usr/lib/x86_64-linux-gnu/libLinearMath.so /usr/local/lib/libbulletmath.so
6- Move to the Freeorion folder and create these symlinks (change x86_64 to i386 if you have a 32 bit system):

Code: Select all

cd .../FreeOrion
ln -s /usr/lib/x86_64-linux-gnu/OGRE-1.7.4/Plugin_OctreeSceneManager.so
ln -s /usr/lib/x86_64-linux-gnu/OGRE-1.7.4/Plugin_ParticleFX.so
ln -s /usr/lib/x86_64-linux-gnu/OGRE-1.7.4/RenderSystem_GL.so
ln -s /usr/lib/x86_64-linux-gnu/OGRE-1.7.4/Plugin_BSPSceneManager.so
ln -s /usr/lib/x86_64-linux-gnu/OGRE-1.7.4/Plugin_OctreeZone.so
ln -s /usr/lib/x86_64-linux-gnu/OGRE-1.7.4/Plugin_PCZSceneManager.so
7- Edit /usr/include/boost/config/stdlib/libstdcpp3.hpp find the following code:

Code: Select all

#ifdef __GLIBCXX__ // gcc 3.4 and greater:
#  if defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
        || defined(_GLIBCXX__PTHREADS)
      //
      // If the std lib has thread support turned on, then turn it on in Boost
      // as well.  We do this because some gcc-3.4 std lib headers define _REENTANT
      // while others do not... 
      //
and change it to

Code: Select all

#ifdef __GLIBCXX__ // gcc 3.4 and greater:
#  if defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
        || defined(_GLIBCXX__PTHREADS)
        || defined(_GLIBCXX_HAS_GTHREADS) // gcc 4.7 
      //
      // If the std lib has thread support turned on, then turn it on in Boost
      // as well.  We do this because some gcc-3.4 std lib headers define _REENTANT
      // while others do not... 
      //
8- Edit /usr/include/boost/thread/xtime.hpp and change every instance of the word TIME_UTC to TIME_UTC_ (add the underscore)

9- Edit the file from FreeOrion source code located in FreeOrion/GG/src/GUI.cpp and change the line:

Code: Select all

boost::xtime_get(&t, boost::TIME_UTC);
to

Code: Select all

boost::xtime_get(&t, boost::TIME_UTC_);
(I think on newer versions of boost (1.50 on) this gets solved).

10- Happy compiling. From the freeorion root source folder, do:

Code: Select all

cmake .
make

User avatar
adrian_broher
Programmer
Posts: 1156
Joined: Fri Mar 01, 2013 9:52 am
Location: Germany

Re: Anyone able to compile on latest Ubuntu (13.X)?

#14 Post by adrian_broher »

Rydra wrote: 5- Create symbolic links (change x86_64 to i386 if you have a 32 bit system):

Code: Select all

sudo ln -s /usr/lib/x86_64-linux-gnu/libBulletCollision.so /usr/local/lib/libbulletcollision.so
sudo ln -s /usr/lib/x86_64-linux-gnu/libBulletDynamics.so /usr/local/lib/libbulletdynamics.so
sudo ln -s /usr/lib/x86_64-linux-gnu/libLinearMath.so /usr/local/lib/libbulletmath.so
6- Move to the Freeorion folder and create these symlinks (change x86_64 to i386 if you have a 32 bit system):

Code: Select all

cd .../FreeOrion
ln -s /usr/lib/x86_64-linux-gnu/OGRE-1.7.4/Plugin_OctreeSceneManager.so
ln -s /usr/lib/x86_64-linux-gnu/OGRE-1.7.4/Plugin_ParticleFX.so
ln -s /usr/lib/x86_64-linux-gnu/OGRE-1.7.4/RenderSystem_GL.so
ln -s /usr/lib/x86_64-linux-gnu/OGRE-1.7.4/Plugin_BSPSceneManager.so
ln -s /usr/lib/x86_64-linux-gnu/OGRE-1.7.4/Plugin_OctreeZone.so
ln -s /usr/lib/x86_64-linux-gnu/OGRE-1.7.4/Plugin_PCZSceneManager.so
Those two shouldn't be needed. But I need to check if our find modules are too old or have a bug or if the cmake installation of ubuntu doesn't search at the proper places.

Edit:

Some references dump (primarily for me):

http://public.kitware.com/Bug/view.php?id=12037
https://bugs.launchpad.net/debian/+sour ... bug/737137
https://bitbucket.org/osrf/gazebo/commi ... 4a4bc14051

Edit Edit:

Also I don't know why you're building bullet?

Ubuntu 13.04 provides a libbullet-dev package with only the main and the universe ubuntu repository activated. Also don't suggest mixing the ubuntu and debian repositories, this sounds like a recipe for disaster.

Code: Select all

-- Found OGRE: optimized;/usr/lib/x86_64-linux-gnu/libOgreMain.so;debug;/usr/lib/x86_64-linux-gnu/libOgreMain.so
-- Looking for OGRE_Paging...
-- Found OGRE_Paging: optimized;/usr/lib/x86_64-linux-gnu/libOgrePaging.so;debug;/usr/lib/x86_64-linux-gnu/libOgrePaging.so
-- Looking for OGRE_Terrain...
-- Found OGRE_Terrain: optimized;/usr/lib/x86_64-linux-gnu/libOgreTerrain.so;debug;/usr/lib/x86_64-linux-gnu/libOgreTerrain.so
-- Looking for OGRE_Property...
-- Found OGRE_Property: optimized;/usr/lib/x86_64-linux-gnu/libOgreProperty.so;debug;/usr/lib/x86_64-linux-gnu/libOgreProperty.so
-- Looking for OGRE_RTShaderSystem...
-- Found OGRE_RTShaderSystem: optimized;/usr/lib/x86_64-linux-gnu/libOgreRTShaderSystem.so;debug;/usr/lib/x86_64-linux-gnu/libOgreRTShaderSystem.so
[…]
-- Found Vorbis: /usr/lib/x86_64-linux-gnu/libvorbis.so  
--   libraries : /usr/lib/libBulletDynamics.so;/usr/lib/libBulletCollision.so;/usr/lib/libLinearMath.so from 
--   includes  : /usr/include/bullet
As you see the the installed Ogre and Bullet versions are found fine despite the fact that ubuntu 13.04 uses multi arch (/usr/lib/x86_64-linux-gnu). So yeah, your setup is definitely broken.
Last edited by adrian_broher on Tue Jul 02, 2013 1:37 pm, edited 1 time in total.
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz

User avatar
Rydra
Space Squid
Posts: 55
Joined: Fri Jun 28, 2013 6:15 pm

Re: Anyone able to compile on latest Ubuntu (13.X)?

#15 Post by Rydra »

From what I have experienced, without those symlinks I couldn't either finish the compiling or execute the game.

Edit: ok, maybe bullet step can be skipped as I have tested it again and compiles equally. But those boost modifications are still necessary.

Post Reply