kswaldemar / rewind-viewer

Fast match viewer with rewinding support for Russian AI Cup championship series
MIT License
75 stars 23 forks source link

Mac OS X build failure #46

Closed Tolsi closed 4 years ago

Tolsi commented 5 years ago

> cmake --CMAKE_BUILD_TYPE=Release ..

CMake Warning (dev) in CMakeLists.txt:
  No project() command is present.  The top-level CMakeLists.txt file must
  contain a literal, direct call to the project() command.  Add a line of
  code such as

    project(ProjectName)

  near the top of the file, but after cmake_minimum_required().

  CMake is pretending there is a "project(Project)" command on the first
  line.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- The C compiler identification is AppleClang 10.0.1.10010046
-- The CXX compiler identification is AppleClang 10.0.1.10010046
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenGL: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/OpenGL.framework
-- Check include/json.hpp... Already exists
-- Check include/loguru.hpp... Already exists
-- Build glfw from sources: Glfw_LIBRARY-NOTFOUND
CMake Deprecation Warning at 3rdparty/glfw/CMakeLists.txt:10 (cmake_policy):
  The OLD behavior for policy CMP0042 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.

-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Could NOT find Vulkan (missing: VULKAN_LIBRARY VULKAN_INCLUDE_DIR)
-- Using Cocoa for window creation
CMake Warning (dev) at 3rdparty/glm/CMakeLists.txt:101 (option):
  Policy CMP0077 is not set: option() honors normal variables.  Run "cmake
  --help-policy CMP0077" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  For compatibility with older versions of CMake, option is clearing the
  normal variable 'GLM_TEST_ENABLE'.
This warning is for project developers.  Use -Wno-dev to suppress it.

GLM: Clang - Clang compiler
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/tolsi/Documents/miniaicups/rewind-viewer/build
> cmake --build .
...
[ 96%] Building CXX object src/CMakeFiles/rewindviewer.dir/main.cpp.o
In file included from /Users/tolsi/Documents/miniaicups/rewind-viewer/src/main.cpp:7:
In file included from /Users/tolsi/Documents/miniaicups/rewind-viewer/src/viewer/UIController.h:12:
In file included from /Users/tolsi/Documents/miniaicups/rewind-viewer/src/cgutils/Camera.h:12:
In file included from /Users/tolsi/Documents/miniaicups/rewind-viewer/src/viewer/Config.h:7:
/Users/tolsi/Documents/miniaicups/rewind-viewer/src/viewer/Frame.h:37:44: error: implicit instantiation of undefined template
      'std::__1::array<Frame::primitives_t, 5>'
    std::array<primitives_t, LAYERS_COUNT> primitives;
                                           ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__tuple:223:64: note:
      template is declared here
template <class _Tp, size_t _Size> struct _LIBCPP_TEMPLATE_VIS array;
                                                               ^
In file included from /Users/tolsi/Documents/miniaicups/rewind-viewer/src/main.cpp:7:
In file included from /Users/tolsi/Documents/miniaicups/rewind-viewer/src/viewer/UIController.h:12:
In file included from /Users/tolsi/Documents/miniaicups/rewind-viewer/src/cgutils/Camera.h:12:
/Users/tolsi/Documents/miniaicups/rewind-viewer/src/viewer/Config.h:28:68: error: implicit instantiation of undefined template
      'std::__1::array<bool, 5>'
        std::array<bool, static_cast<size_t>(Frame::LAYERS_COUNT)> enabled_layers = {{1, 1, 1, 1, 1}};
                                                                   ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__tuple:223:64: note:
      template is declared here
template <class _Tp, size_t _Size> struct _LIBCPP_TEMPLATE_VIS array;
                                                               ^
In file included from /Users/tolsi/Documents/miniaicups/rewind-viewer/src/main.cpp:4:
In file included from /Users/tolsi/Documents/miniaicups/rewind-viewer/src/cgutils/Shader.h:10:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string:500:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string_view:176:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__string:56:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/algorithm:644:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:2335:5: warning:
      delete called on 'ProtoHandler' that is abstract but has non-virtual destructor [-Wdelete-non-virtual-dtor]
    delete __ptr;
    ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:2648:7: note: in
      instantiation of member function 'std::__1::default_delete<ProtoHandler>::operator()' requested here
      __ptr_.second()(__tmp);
      ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:2602:19: note: in
      instantiation of member function 'std::__1::unique_ptr<ProtoHandler, std::__1::default_delete<ProtoHandler> >::reset'
      requested here
  ~unique_ptr() { reset(); }
                  ^
/Users/tolsi/Documents/miniaicups/rewind-viewer/src/main.cpp:140:35: note: in instantiation of member function
      'std::__1::unique_ptr<ProtoHandler, std::__1::default_delete<ProtoHandler> >::~unique_ptr' requested here
    std::unique_ptr<ProtoHandler> proto_handler;
                                  ^
In file included from /Users/tolsi/Documents/miniaicups/rewind-viewer/src/main.cpp:4:
In file included from /Users/tolsi/Documents/miniaicups/rewind-viewer/src/cgutils/Shader.h:10:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string:500:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string_view:176:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__string:56:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/algorithm:644:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:2335:5: warning:
      delete called on non-final 'JsonHandler' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
    delete __ptr;
    ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:2648:7: note: in
      instantiation of member function 'std::__1::default_delete<JsonHandler>::operator()' requested here
      __ptr_.second()(__tmp);
      ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:2602:19: note: in
      instantiation of member function 'std::__1::unique_ptr<JsonHandler, std::__1::default_delete<JsonHandler> >::reset'
      requested here
  ~unique_ptr() { reset(); }
                  ^
/Users/tolsi/Documents/miniaicups/rewind-viewer/src/main.cpp:146:25: note: in instantiation of member function
      'std::__1::unique_ptr<JsonHandler, std::__1::default_delete<JsonHandler> >::~unique_ptr' requested here
        proto_handler = std::make_unique<JsonHandler>(&scene);
                        ^
2 warnings and 2 errors generated.
make[2]: *** [src/CMakeFiles/rewindviewer.dir/main.cpp.o] Error 1
make[1]: *** [src/CMakeFiles/rewindviewer.dir/all] Error 2
make: *** [all] Error 2```
kswaldemar commented 5 years ago

Компилятор не понимает, что такое std::array. Раньше на маках такой ошибки не было, предполагаю, что компилятор не поддерживает c++14

bochsdbg commented 5 years ago
  1. AppleClang 10, судя по https://en.cppreference.com/w/cpp/compiler_support , прекрасно поддерживает c++17, и даже некоторые фичи из c++2a, ну а уж 14ый стандарт и подавно
  2. std::array появился еще в 11ом стандарте
  3. пункты выше не имеют никакого отношения к проблеме в коде. файл тупо не подключается напрямую, и по стандарту не обязан. Просто так случайно повезло. К примеру, libstdc++ 9.1.0 цепочка инклудов: <unordered_map> -> <bits/hashtable.h> -> <bits/hashtable_policy.h> -> <tuple> -> <array>. в других имплементациях тоже может "повезти", через внутренние bits что-то такое тоже может заинклудиться, но не обязано.

std::string там тоже используется, в Config.h, так что лучше всего заинклудить и его (если что, в том же libstdc++ цепочка инклудов проходит сначала до того же <array>, по тому же пути, далее на <stdexcept>, который уже включает <string>). Одним словом, тут проблема в коде, а не в компиляторе или имплементации STL -- код просто непортируем. Правильнее будет заинклудить эти два файла в Config.h, ну или где-то в precompiled header-е

kswaldemar commented 4 years ago

Fixed in #49