Build fails with -std=gnu++11 and -std=gnu++1y

Support for running, installing or compiling OpenMW

Before you submit a bug report for the first time, please read: Bug reporting guidelines
Ascent
Posts: 39
Joined: 28 Jun 2014, 04:32

Build fails with -std=gnu++11 and -std=gnu++1y

Post by Ascent »

I encountered this problem when I tried to build latest git with gcc version 5.0.0 20150228 (experimental) [trunk revision 221076] (Debian 5-20150228-1):

Code: Select all

Linking CXX executable ../../openmw
CMakeFiles/openmw.dir/engine.cpp.o: In function `boost::filesystem::copy_file(boost::filesystem::path const&, boost::filesystem::path const&)':
/usr/include/boost/filesystem/operations.hpp:384: undefined reference to `boost::filesystem::detail::copy_file(boost::filesystem::path const&, boost::filesystem::path const&, boost::filesystem::copy_option, boost::system::error_code*)'
collect2: error: ld returned 1 exit status
apps/openmw/CMakeFiles/openmw.dir/build.make:6222: recipe for target 'openmw' failed
make[2]: *** [openmw] Error 1
CMakeFiles/Makefile2:479: recipe for target 'apps/openmw/CMakeFiles/openmw.dir/all' failed
make[1]: *** [apps/openmw/CMakeFiles/openmw.dir/all] Error 2
Makefile:117: recipe for target 'all' failed
make: *** [all] Error 2
I found more information about this issue here. Compiling with -DBOOST_NO_CXX11_SCOPED_ENUMS=1 resolves it. Since distributors and others might try to build OpenMW with -std=c++11/gnu++11/newer and older versions of boost, should it be defined somewhere to avoid this?

Boost 1.57 should fix this issue, BTW. Debian has 1.55 still and other dists might have versions <= 1.56, however.
User avatar
psi29a
Posts: 5362
Joined: 29 Sep 2011, 10:13
Location: Belgium
Gitlab profile: https://gitlab.com/psi29a/
Contact:

Re: Build fails with -std=gnu++11 and -std=gnu++1y

Post by psi29a »

Scott and I are the Debian/Ubuntu maintainers... thanks for finding this!

Our releases are not pinned against a specific libboost library version, so with every release we make sure to compile/link against the latest targets in Debian. By latest, since we are currently in experimental, we mean the bleeding edge. So far, we've not encountered particular this issue (gcc5 and libboost)... but it is likely to come. :)

So thanks again!
corristo
Posts: 495
Joined: 12 Aug 2011, 08:29

Re: Build fails with -std=gnu++11 and -std=gnu++1y

Post by corristo »

Another reminder to migrate to C++11 ;)
maqifrnswa
Posts: 180
Joined: 14 Jan 2013, 03:57

Re: Build fails with -std=gnu++11 and -std=gnu++1y

Post by maqifrnswa »

psi29a wrote:Scott and I are the Debian/Ubuntu maintainers... thanks for finding this!

Our releases are not pinned against a specific libboost library version, so with every release we make sure to compile/link against the latest targets in Debian. By latest, since we are currently in experimental, we mean the bleeding edge. So far, we've not encountered particular this issue (gcc5 and libboost)... but it is likely to come. :)

So thanks again!
Thanks, we appreciate help with gcc5 compiling testing and fixing - please keep the comments and testing coming! I just got an email that GCC 5 "will be the default for [Ubuntu] 15.10, without any possibility to fall back to older g++ and gfortran versions" I also expect it to be the default for Debian in the next release as well as they are already finding packages that don't build with gcc 5:
https://bugs.debian.org/cgi-bin/pkgrepo ... debian.org

here are some pointers in case anyone is interested:
https://gcc.gnu.org/gcc-5/porting_to.html
Ascent
Posts: 39
Joined: 28 Jun 2014, 04:32

Re: Build fails with -std=gnu++11 and -std=gnu++1y

Post by Ascent »

psi29a wrote:Scott and I are the Debian/Ubuntu maintainers... thanks for finding this!

Our releases are not pinned against a specific libboost library version, so with every release we make sure to compile/link against the latest targets in Debian. By latest, since we are currently in experimental, we mean the bleeding edge. So far, we've not encountered particular this issue (gcc5 and libboost)... but it is likely to come. :)

So thanks again!
No problem! :)
dteviot
Posts: 144
Joined: 17 Dec 2014, 20:29

Re: Build fails with -std=gnu++11 and -std=gnu++1y

Post by dteviot »

@psi29a
psi29a wrote:
Our releases are not pinned against a specific libboost library version, so with every release we make sure to compile/link against the latest targets in Debian. By latest, since we are currently in experimental, we mean the bleeding edge. So far, we've not encountered particular this issue (gcc5 and libboost)... but it is likely to come. :)
Something I've noticed, the Travis Linux build is using Boost 1.46
https://travis-ci.org/OpenMW/openmw/jobs/53516890
travis wrote: Selecting previously unselected package libboost1.46-dev.
Is there any chance this could be moved to a newer version? As there's a number of places in the code where there are boost version #if statements (looking for version 1.46 or earlier) and I'd like to remove them.

My other question is, "so how far are we away from moving to C++11?"
viewtopic.php?f=6&t=1286
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Build fails with -std=gnu++11 and -std=gnu++1y

Post by Zini »

We are pretty much there. But we are currently switching rendering engine and I do not want to switch to a different language standard at the same time.
maqifrnswa
Posts: 180
Joined: 14 Jan 2013, 03:57

Re: Build fails with -std=gnu++11 and -std=gnu++1y

Post by maqifrnswa »

dteviot wrote:My other question is, "so how far are we away from moving to C++11?"
viewtopic.php?f=6&t=1286
using -std=c++11 I got all the way to linking openmw before an error:
Linking CXX executable ../../openmw
CMakeFiles/openmw.dir/engine.cpp.o: In function `copy_file':
/usr/include/boost/filesystem/operations.hpp:384: undefined reference to `boost::filesystem::detail::copy_file(boost::filesystem::path const&, boost::filesystem::path const&, boost::filesystem::copy_option, boost::system::error_code*)'
collect2: error: ld returned 1 exit status


incidentally, I found a bug in CMakeLists.txt that prevents compile flags from being set. I'll be filing a pull request for soon
User avatar
psi29a
Posts: 5362
Joined: 29 Sep 2011, 10:13
Location: Belgium
Gitlab profile: https://gitlab.com/psi29a/
Contact:

Re: Build fails with -std=gnu++11 and -std=gnu++1y

Post by psi29a »

Travis uses 12.04 precise, which has an older tool chain and deps. We are waiting for a full upgrade to 14.04 trusty which should give us more options.
wheybags
Posts: 207
Joined: 21 Dec 2012, 19:41

Re: Build fails with -std=gnu++11 and -std=gnu++1y

Post by wheybags »

https://launchpad.net/~boost-latest/+archive/ubuntu/ppa can get you new boost for travis.
I use it for freeablo
Locked