Page 1 of 2

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

Posted: 05 Mar 2015, 04:39
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.

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

Posted: 05 Mar 2015, 07:27
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!

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

Posted: 05 Mar 2015, 08:07
by corristo
Another reminder to migrate to C++11 ;)

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

Posted: 05 Mar 2015, 20:03
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

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

Posted: 05 Mar 2015, 22:10
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! :)

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

Posted: 08 Mar 2015, 20:15
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

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

Posted: 09 Mar 2015, 17:06
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.

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

Posted: 09 Mar 2015, 18:49
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

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

Posted: 09 Mar 2015, 20:04
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.

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

Posted: 09 Mar 2015, 20:41
by wheybags
https://launchpad.net/~boost-latest/+archive/ubuntu/ppa can get you new boost for travis.
I use it for freeablo