Latest trunk FTBFS on Ubuntu 12.04 (src/helper.cc:82:8: error: 'mt19937' in namespace 'boost::random' does not name a type)

Bug #1203121 reported by Hans Joachim Desserud
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
widelands
Fix Released
Medium
Unassigned

Bug Description

As seen from the daily-build PPA [1], one of the recent commits broke something, which caused current trunk to be unbuildable on Ubuntu 12.04 and older releases. 12.10 and later seems unaffected. It affects both i386 and amd64 builds and I have verified it locally. The latest known working revision on 12.04 was r6632 [2], btw.

The build simply fails, printing the following error message:

[ 77%] Building CXX object src/CMakeFiles/widelands_all.dir/helper.cc.o
/build/buildd/widelands-17-ppa0/src/helper.cc:82:8: error: 'mt19937' in namespace 'boost::random' does not name a type
/build/buildd/widelands-17-ppa0/src/helper.cc: In function 'std::string random_string(const string&, int)':
/build/buildd/widelands-17-ppa0/src/helper.cc:84:2: error: 'uniform_int_distribution' is not a member of 'boost::random'
/build/buildd/widelands-17-ppa0/src/helper.cc:84:42: error: expected primary-expression before '>' token
/build/buildd/widelands-17-ppa0/src/helper.cc:84:74: error: 'index_dist' was not declared in this scope
/build/buildd/widelands-17-ppa0/src/helper.cc:87:32: error: 'random_generator' was not declared in this scope
make[4]: *** [src/CMakeFiles/widelands_all.dir/helper.cc.o] Error 1
make[4]: Leaving directory `/build/buildd/widelands-17-ppa0/build-debian'
make[3]: *** [src/CMakeFiles/widelands_all.dir/all] Error 2
make[3]: Leaving directory `/build/buildd/widelands-17-ppa0/build-debian'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/build/buildd/widelands-17-ppa0/build-debian'
make[1]: *** [override_dh_auto_build] Error 2
make[1]: Leaving directory `/build/buildd/widelands-17-ppa0'
make: *** [binary] Error 2
dpkg-buildpackage: error: /usr/bin/fakeroot debian/rules binary gave error exit status 2

(for more details or a complete log, see [3])

This seems to be part of the merge to fix various regressions related to changing options. It also seem to be using boost::random in some way. When I tested this locally, I installed the package libboost-random-dev, though it had no effect (didn't show up among the boost libraries listed by cmake either though, only signals and test). However, from what I can see it works flawlessly on newer releases even without installing additional libraries so that might be a red herring.

Perhaps of note is that Ubuntu 12.04 has boost 1.48 available in the repository, while 12.10 has 1.49 available. Did the random library change in any relevant way between these two releases?

[1] https://launchpad.net/~widelands-dev/+archive/widelands-daily/+packages
[2] https://launchpad.net/~widelands-dev/+archive/widelands-daily/+builds?build_state=built
[3] https://launchpad.net/~widelands-dev/+archive/widelands-daily/+build/4807774
[4] https://launchpad.net/ubuntu/+source/boost-defaults

Related branches

tags: added: boost
Revision history for this message
Jens Beyer (qcumber-some) wrote :

It does not work with boost-1.46 (which is default on Ubuntu 12.04), but it works with boost-1.48 (which can be installed in Ubuntu 12.04).

Revision history for this message
Jens Beyer (qcumber-some) wrote :

Additional note: cghislain suggested to use libboost-1.46-random-dev - this does not work. The -dev package is *not* necessary to compile widelands.

Changed in widelands:
status: New → Confirmed
Revision history for this message
Jens Beyer (qcumber-some) wrote :

I pushed updated dependencies to the ppa build, which means we lost lucid.
I can not check if the other builds run successfully, as I have to leave now.

But I guess, losing lucid is not an option as well. So I think we should solve this in code, not in dependencies.

Revision history for this message
cghislai (charlyghislain) wrote :

It is strange because boost-random 1.46.1 should support the 'mt19937' generator according to the doc.
http://www.boost.org/doc/libs/1_46_1/doc/html/boost_random/reference.html#boost_random.reference.generators

Revision history for this message
Hans Joachim Desserud (hjd) wrote :

After installing libboost1.48-dev, libboost-test1.48-dev and libboost-signals1.48-dev (this removed the *1.46 packages) it builds fine.

Unfortunately I don't think your fix will work, Jens. Because... libboost-dev (version 1.48.0.2) depends on libboost1.46-dev... so... yeah. [1]

I guess we could replace the dependency with 1.48-specific packages I've listed above, but those packages are not present on later releases and will presumably break those. Essentially makes that a no-go.

Looking at the latest version of the debian package [2], I see they've added the line "libboost-dev | libboost1.49-dev" to the control file [3]. I think doing the "or" dependency might work, though I am not exactly sure how it will decide which dependency to select. Might be something to look into though...

[1] http://packages.ubuntu.com/precise/libboost-dev
[2] http://anonscm.debian.org/gitweb/?p=pkg-games/widelands.git
[3] http://anonscm.debian.org/gitweb/?p=pkg-games/widelands.git;a=blob_plain;f=debian/control;hb=refs/heads/debian-debian

Revision history for this message
SirVer (sirver) wrote :

Has someone the revision handy that broke things? I think we can look into work arounds, but if we do not know where to look it becomes more difficult.

Revision history for this message
Hans Joachim Desserud (hjd) wrote :

>Has someone the revision handy that broke things?

The latest known working revision on 12.04 was r6632 and it breaks in helper.cc, which was updated with the merge in r6635. Unless you were thinking about among the commits which got merged in?

Revision history for this message
Jens Beyer (qcumber-some) wrote :

Problem is that boost::random::uniform_int_distribution<> and boost::random::mt19937 have been introduced with boost 1.47

But boost 1.46 defines boost::mt19937 and boost::random_int<> (which basically, on later boost versions, call the functions from boost::random namespace).

I pushed a branch for review.

Revision history for this message
Jens Beyer (qcumber-some) wrote :

I also did uncommit/push-overwrite the dependency changes for the ppa as those didn't work anyway.

Changed in widelands:
status: Confirmed → Fix Committed
Revision history for this message
Hans Joachim Desserud (hjd) wrote :

Thanks, works again now. :) It even works on Ubuntu 10.04 [1], which I didn't know if would be the case when saw you link to the documentation for boost 1.46.

I took the liberty of updating the list of required build dependencies [2] which claimed boost 1.47 or higher is needed. When we build fine with 1.40 (if not older releases), that seemed slightly misleading.

[1] https://launchpad.net/~widelands-dev/+archive/widelands-daily/+packages
[2] https://wl.widelands.org/wiki/BuildingWidelands/#libraries

Revision history for this message
SirVer (sirver) wrote :

Released in build-18 rc1.

Changed in widelands:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.