Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#1527 closed defect (fixed)

[PATCH] Boost 1.50 support: removed filesystem v2

Reported by: Sven-Hendrik Haase Owned by: ben
Priority: Should Have Milestone: Alpha 11
Component: Build & Packages Keywords: patch
Cc: Patch:

Description

In Boost 1.50 filesystem v2 was entirely removed. It is fairly safe to change to boost filesystem v3 as this has been included since forever.

For the record, the initial error you run into while making is this:

/usr/include/boost/filesystem/config.hpp:16:5: error: #error Compiling Filesystem version 3 file with BOOST_FILESYSTEM_VERSION defined != 3

I think this should definitely be fixed before the next release because enabling people to build with the newest version of boost is important.

Attachments (1)

boost150support.patch (3.5 KB ) - added by historic_bruno 12 years ago.

Download all attachments as: .zip

Change History (18)

comment:1 by Sven-Hendrik Haase, 12 years ago

I made a patch against the current released version. Probably not a lot to change to make the current trunk work. http://pastie.org/4233236

comment:2 by Sven-Hendrik Haase, 12 years ago

Keep in mind that my patch is kind of hacky in the sense that I still use wstrings. It was the least work on my part and I only needed 0ad to compile for Arch Linux. However, you guys might want to consider making proper use of boost fs v3 and its inherently international path system.

comment:3 by leper, 12 years ago

Component: Core engineBuild & Packages
Keywords: patch review added
Milestone: BacklogAlpha 11
Summary: Can't build: Boost 1.50 removed filesystem v2[PATCH] Can't build: Boost 1.50 removed filesystem v2

comment:4 by historic_bruno, 12 years ago

Priority: Release BlockerShould Have

comment:5 by Doménique, 12 years ago

I just tried the patch above on OS X 10.6.8 and it does not work for me. For those of you who updated the boost library (using MacPorts) and can no longer successfully compile 0 A.D., try to activate an older version of boost if it has been installed previously as follows:

  1. From the terminal type the following to check for installed versions:
    port installed boost
    
  1. This gives some stuff like:
      boost @1.49.0_0
      boost @1.50.0_0 (active)
    
  1. Now activate the most recent version < 1.50:
    sudo port activate boost @1.49.0_0
    
  1. Try compiling 0 A.D. again :)

comment:6 by historic_bruno, 12 years ago

Summary: [PATCH] Can't build: Boost 1.50 removed filesystem v2[PATCH] Boost 1.50 support: removed filesystem v2

in reply to:  5 ; comment:7 by historic_bruno, 12 years ago

Replying to dvangennip:

I just tried the patch above on OS X 10.6.8 and it does not work for me.

Which errors did you get? If you can paste the relevant bits of the build output, it would be helpful.

in reply to:  7 comment:8 by Doménique, 12 years ago

Replying to historic_bruno:

Which errors did you get? If you can paste the relevant bits of the build output, it would be helpful.

Ok, I tried building the game once more with Boost 1.50 on OS X 10.6.8. Everything goes well until ==== Building test (release) ====. I have included the two interesting parts here:

AtlasDialog.cpp
Undefined symbols:
  "boost::filesystem::path::m_path_iterator_increment(boost::filesystem::path::iterator&)", referenced from:
      CTextureManagerImpl::GetConverterSettings(boost::shared_ptr<CTexture> const&)     in libgraphics.a(TextureManager.o)
      GetAIsHelper::Callback(Path const&, FileInfo const&, unsigned long)in libsimulation2.a(ICmpAIManager.o)
      GetAIsHelper::Callback(Path const&, FileInfo const&, unsigned long)in libsimulation2.a(ICmpAIManager.o)
  "boost::filesystem::path_traits::convert(wchar_t const*, wchar_t const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::codecvt<wchar_t, char, __mbstate_t> const&)", referenced from:
      CTextureManagerImpl::GetConverterSettings(boost::shared_ptr<CTexture> const&)     in libgraphics.a(TextureManager.o)
      GetAIsHelper::Callback(Path const&, FileInfo const&, unsigned long)in libsimulation2.a(ICmpAIManager.o)
  "boost::filesystem::path_traits::convert(char const*, char const*, std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&, std::codecvt<wchar_t, char, __mbstate_t> const&)", referenced from:
      CTextureManagerImpl::GetConverterSettings(boost::shared_ptr<CTexture> const&)     in libgraphics.a(TextureManager.o)
      CTextureManagerImpl::GetConverterSettings(boost::shared_ptr<CTexture> const&)     in libgraphics.a(TextureManager.o)
      GetAIsHelper::Callback(Path const&, FileInfo const&, unsigned long)in libsimulation2.a(ICmpAIManager.o)
  "boost::filesystem::path::begin() const", referenced from:
      CTextureManagerImpl::GetConverterSettings(boost::shared_ptr<CTexture> const&)     in libgraphics.a(TextureManager.o)
      GetAIsHelper::Callback(Path const&, FileInfo const&, unsigned long)in libsimulation2.a(ICmpAIManager.o)
  "boost::filesystem::path::filename() const", referenced from:
      CTextureManagerImpl::GetConverterSettings(boost::shared_ptr<CTexture> const&)     in libgraphics.a(TextureManager.o)
  "boost::filesystem::path::codecvt()", referenced from:
      CTextureManagerImpl::GetConverterSettings(boost::shared_ptr<CTexture> const&)     in libgraphics.a(TextureManager.o)
      CTextureManagerImpl::GetConverterSettings(boost::shared_ptr<CTexture> const&)     in libgraphics.a(TextureManager.o)
      CTextureManagerImpl::GetConverterSettings(boost::shared_ptr<CTexture> const&)     in libgraphics.a(TextureManager.o)
      GetAIsHelper::Callback(Path const&, FileInfo const&, unsigned long)in libsimulation2.a(ICmpAIManager.o)
      GetAIsHelper::Callback(Path const&, FileInfo const&, unsigned long)in libsimulation2.a(ICmpAIManager.o)
  "boost::filesystem::path::end() const", referenced from:
      CTextureManagerImpl::GetConverterSettings(boost::shared_ptr<CTexture> const&)     in libgraphics.a(TextureManager.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[1]: *** [../../../binaries/system/pyrogenesis] Error 1
make: *** [pyrogenesis] Error 2
make: *** Waiting for unfinished jobs....

It continues for a bit, until the process reaches this error and finally returns:

ActorEditor.cpp
Undefined symbols:
  "boost::filesystem::path::m_path_iterator_increment(boost::filesystem::path::iterator&)", referenced from:
      CTextureManagerImpl::GetConverterSettings(boost::shared_ptr<CTexture> const&)     in libgraphics.a(TextureManager.o)
      GetAIsHelper::Callback(Path const&, FileInfo const&, unsigned long)in libsimulation2.a(ICmpAIManager.o)
      GetAIsHelper::Callback(Path const&, FileInfo const&, unsigned long)in libsimulation2.a(ICmpAIManager.o)
  "boost::filesystem::path_traits::convert(wchar_t const*, wchar_t const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::codecvt<wchar_t, char, __mbstate_t> const&)", referenced from:
      CTextureManagerImpl::GetConverterSettings(boost::shared_ptr<CTexture> const&)     in libgraphics.a(TextureManager.o)
      GetAIsHelper::Callback(Path const&, FileInfo const&, unsigned long)in libsimulation2.a(ICmpAIManager.o)
  "boost::filesystem::path_traits::convert(char const*, char const*, std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&, std::codecvt<wchar_t, char, __mbstate_t> const&)", referenced from:
      CTextureManagerImpl::GetConverterSettings(boost::shared_ptr<CTexture> const&)     in libgraphics.a(TextureManager.o)
      CTextureManagerImpl::GetConverterSettings(boost::shared_ptr<CTexture> const&)     in libgraphics.a(TextureManager.o)
      GetAIsHelper::Callback(Path const&, FileInfo const&, unsigned long)in libsimulation2.a(ICmpAIManager.o)
  "boost::filesystem::path::begin() const", referenced from:
      CTextureManagerImpl::GetConverterSettings(boost::shared_ptr<CTexture> const&)     in libgraphics.a(TextureManager.o)
      GetAIsHelper::Callback(Path const&, FileInfo const&, unsigned long)in libsimulation2.a(ICmpAIManager.o)
  "boost::filesystem::path::filename() const", referenced from:
      CTextureManagerImpl::GetConverterSettings(boost::shared_ptr<CTexture> const&)     in libgraphics.a(TextureManager.o)
  "boost::filesystem::path::codecvt()", referenced from:
      CTextureManagerImpl::GetConverterSettings(boost::shared_ptr<CTexture> const&)     in libgraphics.a(TextureManager.o)
      CTextureManagerImpl::GetConverterSettings(boost::shared_ptr<CTexture> const&)     in libgraphics.a(TextureManager.o)
      CTextureManagerImpl::GetConverterSettings(boost::shared_ptr<CTexture> const&)     in libgraphics.a(TextureManager.o)
      GetAIsHelper::Callback(Path const&, FileInfo const&, unsigned long)in libsimulation2.a(ICmpAIManager.o)
      GetAIsHelper::Callback(Path const&, FileInfo const&, unsigned long)in libsimulation2.a(ICmpAIManager.o)
  "boost::filesystem::path::end() const", referenced from:
      CTextureManagerImpl::GetConverterSettings(boost::shared_ptr<CTexture> const&)     in libgraphics.a(TextureManager.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[1]: *** [../../../binaries/system/test] Error 1
make: *** [test] Error 2
Linking AtlasUI
ld: warning: duplicate dylib /opt/local/lib/libz.1.dylib
ld: warning: duplicate dylib /opt/local/lib/libxml2.2.dylibcd

All errors seem to point towards the patched files, in particular the (source/components/TextureManager.cpp) GetConverterSettings function of the CTextureManagerImpl class. Perhaps the fix is simple, but I am not familiar enough with C++ nor Boost to suggest the solution.

comment:9 by historic_bruno, 12 years ago

I wonder if that has anything to do with r11965. Can you try re-adding "boost_filesystem-mt" to extern_libs4.lua? Of course you'll need to run ./update-workspaces.sh afterward.

comment:10 by Doménique, 12 years ago

I re-added "boost_filesystem-mt" as it was in the extern_libs4.lua file before r11965. It does not change the fact that building fails with the same error messages (although strangely the files are different for which errors show up, as the order of files in the ===test(release)=== phase seems to be different as well). However, the nature of the errors is exactly the same. Likely the revision is not of influence for this issue.

comment:11 by historic_bruno, 12 years ago

Are you using make -j? In that case it will do a parallel build and the output will be out of order. The errors seem mostly unrelated to the tests. I was hoping for a simple solution, obviously Boost 1.50 is going to be more difficult :/

I have an OS X system and will look into this.

comment:12 by Doménique, 12 years ago

I indeed used make -j, but I've just tried it without. The errors stay the same, but pop up at an earlier point, right when pyrogenesis gets build, which makes more sense compared to errors at the test part of the build process. I have included the full feedback from this phase:

==== Building pyrogenesis (release) ====
Creating obj/pyrogenesis_Release
main.cpp
In file included from /opt/local/include/boost/preprocessor/cat.hpp:17,
                 from /opt/local/include/boost/mpl/aux_/integral_wrapper.hpp:22,
                 from /opt/local/include/boost/mpl/int.hpp:20,
                 from /opt/local/include/boost/type_traits/detail/template_arity_spec.hpp:10,
                 from /opt/local/include/boost/type_traits/detail/bool_trait_def.hpp:14,
                 from /opt/local/include/boost/type_traits/is_array.hpp:27,
                 from /opt/local/include/boost/filesystem/path_traits.hpp:21,
                 from /opt/local/include/boost/filesystem/path.hpp:25,
                 from /opt/local/include/boost/filesystem.hpp:16,
                 from ../../../source/lib/pch/pch_boost.h:29,
                 from ../../../source/lib/precompiled.h:76,
                 from ../../../source/main.cpp:32:
/opt/local/include/boost/preprocessor/config/config.hpp:86:77: warning: "__GXX_EXPERIMENTAL_CXX0X__" is not defined
In file included from /opt/local/include/boost/mpl/aux_/has_apply.hpp:17,
                 from /opt/local/include/boost/mpl/apply_wrap.hpp:23,
                 from /opt/local/include/boost/mpl/apply.hpp:23,
                 from /opt/local/include/boost/iterator/iterator_facade.hpp:34,
                 from /opt/local/include/boost/filesystem/path.hpp:28,
                 from /opt/local/include/boost/filesystem.hpp:16,
                 from ../../../source/lib/pch/pch_boost.h:29,
                 from ../../../source/lib/precompiled.h:76,
                 from ../../../source/main.cpp:32:
/opt/local/include/boost/mpl/has_xxx.hpp:344:9: warning: "BOOST_MPL_HAS_XXX_NO_EXPLICIT_TEST_FUNCTION" is not defined
/opt/local/include/boost/mpl/has_xxx.hpp:357:9: warning: "BOOST_MPL_HAS_XXX_NO_WRAPPED_TYPES" is not defined
/opt/local/include/boost/mpl/has_xxx.hpp:386:9: warning: "BOOST_MPL_HAS_XXX_NO_EXPLICIT_TEST_FUNCTION" is not defined
/opt/local/include/boost/mpl/has_xxx.hpp:459:8: warning: "BOOST_MPL_HAS_XXX_NEEDS_TEMPLATE_SFINAE" is not defined
Linking pyrogenesis
Undefined symbols:
  "boost::filesystem::path::m_path_iterator_increment(boost::filesystem::path::iterator&)", referenced from:
      CTextureManagerImpl::GetConverterSettings(boost::shared_ptr<CTexture> const&)     in libgraphics.a(TextureManager.o)
      GetAIsHelper::Callback(Path const&, FileInfo const&, unsigned long)in libsimulation2.a(ICmpAIManager.o)
      GetAIsHelper::Callback(Path const&, FileInfo const&, unsigned long)in libsimulation2.a(ICmpAIManager.o)
  "boost::filesystem::path_traits::convert(wchar_t const*, wchar_t const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::codecvt<wchar_t, char, __mbstate_t> const&)", referenced from:
      CTextureManagerImpl::GetConverterSettings(boost::shared_ptr<CTexture> const&)     in libgraphics.a(TextureManager.o)
      GetAIsHelper::Callback(Path const&, FileInfo const&, unsigned long)in libsimulation2.a(ICmpAIManager.o)
  "boost::filesystem::path_traits::convert(char const*, char const*, std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&, std::codecvt<wchar_t, char, __mbstate_t> const&)", referenced from:
      CTextureManagerImpl::GetConverterSettings(boost::shared_ptr<CTexture> const&)     in libgraphics.a(TextureManager.o)
      CTextureManagerImpl::GetConverterSettings(boost::shared_ptr<CTexture> const&)     in libgraphics.a(TextureManager.o)
      GetAIsHelper::Callback(Path const&, FileInfo const&, unsigned long)in libsimulation2.a(ICmpAIManager.o)
  "boost::filesystem::path::begin() const", referenced from:
      CTextureManagerImpl::GetConverterSettings(boost::shared_ptr<CTexture> const&)     in libgraphics.a(TextureManager.o)
      GetAIsHelper::Callback(Path const&, FileInfo const&, unsigned long)in libsimulation2.a(ICmpAIManager.o)
  "boost::filesystem::path::filename() const", referenced from:
      CTextureManagerImpl::GetConverterSettings(boost::shared_ptr<CTexture> const&)     in libgraphics.a(TextureManager.o)
  "boost::filesystem::path::codecvt()", referenced from:
      CTextureManagerImpl::GetConverterSettings(boost::shared_ptr<CTexture> const&)     in libgraphics.a(TextureManager.o)
      CTextureManagerImpl::GetConverterSettings(boost::shared_ptr<CTexture> const&)     in libgraphics.a(TextureManager.o)
      CTextureManagerImpl::GetConverterSettings(boost::shared_ptr<CTexture> const&)     in libgraphics.a(TextureManager.o)
      GetAIsHelper::Callback(Path const&, FileInfo const&, unsigned long)in libsimulation2.a(ICmpAIManager.o)
      GetAIsHelper::Callback(Path const&, FileInfo const&, unsigned long)in libsimulation2.a(ICmpAIManager.o)
  "boost::filesystem::path::end() const", referenced from:
      CTextureManagerImpl::GetConverterSettings(boost::shared_ptr<CTexture> const&)     in libgraphics.a(TextureManager.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[1]: *** [../../../binaries/system/pyrogenesis] Error 1
make: *** [pyrogenesis] Error 2

Hopefully this is a bit more helpful.

by historic_bruno, 12 years ago

Attachment: boost150support.patch added

comment:13 by historic_bruno, 12 years ago

Attaching patch to support Filesystem v3 (Boost 1.44 or newer) and maintain compatibility with v2 (pre-1.44). To do this, I added a helper function GetWstringFromWpath() that converts a boost::filesystem:wpath to std::wstring. I've re-linked Filesystem which was removed in r11965.

I've tested on Windows w/ Boost 1.44, as well as OS X w/ Boost 1.49 and 1.50. Anyone have old Boost pre-1.44 they can test with?

comment:14 by Deiz, 12 years ago

I don't have a system with boost <1.44 handy, but I flipped the #define around such that filesystem v2 is used. Compiled and ran without issue. Seems unlikely that a legacy implementation would change, so I think it's safe to say that the patch is good to go.

It's pretty hard to find Boost <1.44 on still-supported distros. All I can think of are Debian Stable and Ubuntu 10.04 LTS, neither of which are likely to see much use by gamers due to shipping ancient software.

comment:15 by leper, 12 years ago

I tested it on OpenBSD (boost 1.42 and it compiled just fine, and tests had no additional errors so all seems fine).

You should remove/change the comment regarding boost <= 1.43 though as at least boost_filesystem is needed to build the game. Maybe adding some information to #1360 should work. (Or does boost >= 1.44 now require boost_system?)

comment:16 by ben, 12 years ago

Owner: set to ben
Resolution: fixed
Status: newclosed

In 12229:

Adds support for Boost.Filesystem v3, the only option in Boost 1.50. Fixes #1527. Refs #1360

comment:17 by historic_bruno, 12 years ago

Keywords: review removed
Note: See TracTickets for help on using tickets.