google-deepmind / open_spiel

OpenSpiel is a collection of environments and algorithms for research in general reinforcement learning and search/planning in games.
Apache License 2.0
4.26k stars 934 forks source link

Issue when trying to build AlphaZero torch version #990

Closed rezunli96 closed 1 year ago

rezunli96 commented 1 year ago

Hello, I am following the steps described in here. But when I am doing step 5, there were errors like:

/Users/lizun/open_spiel_tmp/open_spiel_alphazero/open_spiel/libtorch/libtorch/include/pybind11/detail/common.h:339:12: error:
      redefinition of 'return_value_policy'
enum class return_value_policy : uint8_t {
           ^
/Users/lizun/open_spiel_tmp/open_spiel_alphazero/open_spiel/../pybind11/include/pybind11/detail/common.h:488:12: note:
      previous definition is here
enum class return_value_policy : uint8_t {
           ^
In file included from /Users/lizun/open_spiel_tmp/open_spiel_alphazero/open_spiel/python/pybind11/games_gin_rummy.cc:28:
In file included from /Users/lizun/open_spiel_tmp/open_spiel_alphazero/open_spiel/python/../pybind11_abseil/pybind11_abseil/absl_casters.h:33:
In file included from /Users/lizun/open_spiel_tmp/open_spiel_alphazero/open_spiel/libtorch/libtorch/include/pybind11/cast.h:13:
In file included from /Users/lizun/open_spiel_tmp/open_spiel_alphazero/open_spiel/libtorch/libtorch/include/pybind11/pytypes.h:12:
/Users/lizun/open_spiel_tmp/open_spiel_alphazero/open_spiel/libtorch/libtorch/include/pybind11/detail/common.h:392:48: error:
      redefinition of default argument
inline static constexpr int log2(size_t n, int k = 0) { return (n <= 1) ? k : log2(n >> 1, k + 1); }
                                               ^   ~
/Users/lizun/open_spiel_tmp/open_spiel_alphazero/open_spiel/../pybind11/include/pybind11/detail/common.h:565:48: note:
      previous definition is here
inline static constexpr int log2(size_t n, int k = 0) {

It looks like during the building process it generates a file ./open_spiel/libtorch/libtorch/include/pybind11/detail/common.h, which conflicts with ./pybind11/include/pybind11/detail/common.h

lanctot commented 1 year ago

Right, this is a known problem: take a look here for a workaround: https://github.com/deepmind/open_spiel/issues/966.

We will try to fix it soon.

lanctot commented 1 year ago

I've amended the docs now with this info, until we can fix it: https://github.com/deepmind/open_spiel/commit/e75bdf114de32c2211edf36443703a6e8846a3cb