evido / wotreplay-parser

This project aims to create a parser of the World of Tanks replay files. The result is a list of decoded packets, which can be transformed into an image, a heatmap or json file.
BSD 3-Clause "New" or "Revised" License
107 stars 25 forks source link

Cannot build/compile project myself #17

Open tswinehart opened 4 years ago

tswinehart commented 4 years ago

Hi, I have tried for many hours to build the project myself, including on my main Windows machine with VS2019 and also on Ubuntu 20.04 LTS with the make command. I have had no success on either one. Both machines and dev environments seem to struggle with the GUI components of the project if I'm reading the errors right. I have spent a lot of time on Google working through my misunderstanding of the dependencies, but I'm still stumped on trying to get the project to build. If you could provide the needed info for either VS2019 or make on Ubuntu, I would greatly appreciate it! I know I can get the binaries from releases, but I'd like to poke around and understand the code a bit.

cmake_and_make_output.txt

evido commented 4 years ago

Resolved the two building issues. (related to GD and Qt5)

Just did a small look around in the GUI app to refresh Some questions you might have about the UI.

evido commented 4 years ago

For support on building it on windows, I'll need some more details. For me the biggest hurdle was just tracking down compatible pre-compiled libraries. Which is why I included them in the repo. https://github.com/evido/wotreplay-parser/blob/master/ext/dependencies.zip . I remember that most of the majority is just configuring the dependencies in CMAKE because auto detection doesn't go as smoothly as on linux.

tswinehart commented 4 years ago

Hi, thanks again for your speedy reply. Make on linux is definitely working for me now. On the windows side, I'm getting some build errors that are hard for me to understand.

Here is my cmakesettings.json, and below that, my build output:

{
  "configurations": [
    {
      "name": "x86-Release",
      "generator": "Ninja",
      "configurationType": "RelWithDebInfo",
      "buildRoot": "${projectDir}\\out\\build\\${name}",
      "installRoot": "${projectDir}\\out\\install\\${name}",
      "cmakeCommandArgs": "",
      "buildCommandArgs": "",
      "ctestCommandArgs": "",
      "inheritEnvironments": [ "msvc_x86" ],
      "variables": [
        {
          "name": "GD_INCLUDE_DIR",
          "value": "C:/Users/tyler/wotreplay-parser/ext/dependencies/libgd-gd-2.1.1/src",
          "type": "PATH"
        },
        {
          "name": "GD_LIBRARY",
          "value": "C:/Users/tyler/wotreplay-parser/ext/dependencies/libgd-gd-2.1.1/build_msvc12_x86/libgd.lib",
          "type": "FILEPATH"
        }
      ]
    }
  ]
}
>------ Build All started: Project: wotreplay-parser, Configuration: x86-Release ------
  [1/36] Automatic MOC and UIC for target jsoncpp
  [2/36] Automatic MOC and UIC for target wotreplay
  [3/36] Building CXX object CMakeFiles\wotreplay.dir\wotreplay_autogen\mocs_compilation.cpp.obj
  [4/36] Building CXX object CMakeFiles\jsoncpp.dir\jsoncpp_autogen\mocs_compilation.cpp.obj
  [5/36] Automatic MOC and UIC for target wotreplay-gui-widgets
  [6/36] Building CXX object CMakeFiles\wotreplay.dir\src\logger.cpp.obj
  [7/36] Building CXX object CMakeFiles\jsoncpp.dir\ext\jsoncpp\src\jsoncpp.cpp.obj
  [8/36] Building CXX object CMakeFiles\wotreplay.dir\src\tinyxml2.cpp.obj
  [9/36] Linking CXX static library lib\jsoncpp.lib
  [10/36] Building CXX object CMakeFiles\wotreplay.dir\src\packet_reader_80.cpp.obj
  [11/36] Building CXX object CMakeFiles\wotreplay.dir\src\packet.cpp.obj
  [12/36] Building CXX object CMakeFiles\wotreplay.dir\src\json_writer.cpp.obj
  [13/36] Building CXX object CMakeFiles\wotreplay.dir\src\animation_writer.cpp.obj
  [14/36] Building CXX object CMakeFiles\wotreplay.dir\src\image_util.cpp.obj
  [15/36] Building CXX object CMakeFiles\wotreplay.dir\src\heatmap_writer.cpp.obj
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\include\tuple(163): warning C4244: 'initializing': conversion from '_Ty' to '_Ty', possible loss of data
          with
          [
              _Ty=int
          ]
          and
          [
              _Ty=float
          ]
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\include\tuple(234): note: see reference to function template instantiation 'std::_Tuple_val<_This>::_Tuple_val<_Ty>(_Other &&)' being compiled
          with
          [
              _This=float,
              _Ty=int,
              _Other=int
          ]
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\include\tuple(234): note: see reference to function template instantiation 'std::_Tuple_val<_This>::_Tuple_val<_Ty>(_Other &&)' being compiled
          with
          [
              _This=float,
              _Ty=int,
              _Other=int
          ]
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\include\tuple(815): note: see reference to function template instantiation 'std::tuple<float,float>::tuple<std::_Exact_args_t,int,float,0>(_Tag,_This2 &&,float &&)' being compiled
          with
          [
              _Tag=std::_Exact_args_t,
              _This2=int
          ]
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\include\tuple(815): note: see reference to function template instantiation 'std::tuple<float,float>::tuple<std::_Exact_args_t,int,float,0>(_Tag,_This2 &&,float &&)' being compiled
          with
          [
              _Tag=std::_Exact_args_t,
              _This2=int
          ]
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\include\tuple(242): note: see reference to function template instantiation 'std::tuple<float,float>::tuple<std::_Unpack_tuple_t,_Ty,0,1,0>(_Tag,_Tpl &&,std::integer_sequence<size_t,0,1>)' being compiled
          with
          [
              _Ty=std::tuple<int,float>,
              _Tag=std::_Unpack_tuple_t,
              _Tpl=std::tuple<int,float>
          ]
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\include\tuple(241): note: see reference to function template instantiation 'std::tuple<float,float>::tuple<std::_Unpack_tuple_t,_Ty,0,1,0>(_Tag,_Tpl &&,std::integer_sequence<size_t,0,1>)' being compiled
          with
          [
              _Ty=std::tuple<int,float>,
              _Tag=std::_Unpack_tuple_t,
              _Tpl=std::tuple<int,float>
          ]
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\include\tuple(367): note: see reference to function template instantiation 'std::tuple<float,float>::tuple<std::_Unpack_tuple_t,std::tuple<int,float>,0>(_Tag,_Tpl &&)' being compiled
          with
          [
              _Tag=std::_Unpack_tuple_t,
              _Tpl=std::tuple<int,float>
          ]
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\include\tuple(367): note: see reference to function template instantiation 'std::tuple<float,float>::tuple<std::_Unpack_tuple_t,std::tuple<int,float>,0>(_Tag,_Tpl &&)' being compiled
          with
          [
              _Tag=std::_Unpack_tuple_t,
              _Tpl=std::tuple<int,float>
          ]
  ..\..\..\src\heatmap_writer.cpp(41): note: see reference to function template instantiation 'std::tuple<float,float>::tuple<int,float,0>(std::tuple<int,float> &&) noexcept' being compiled
  ..\..\..\src\heatmap_writer.cpp(41): note: see reference to function template instantiation 'std::tuple<float,float>::tuple<int,float,0>(std::tuple<int,float> &&) noexcept' being compiled
  [16/36] Building CXX object CMakeFiles\wotreplay.dir\src\arena.cpp.obj
  [17/36] Building CXX object CMakeFiles\wotreplay.dir\src\image_writer.cpp.obj
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\include\xutility(4290): warning C4244: '=': conversion from 'const _Ty' to 'unsigned char', possible loss of data
          with
          [
              _Ty=float
          ]
  ..\..\..\src\image_writer.cpp(198): note: see reference to function template instantiation 'void std::fill<unsigned char*,float>(const _FwdIt,const _FwdIt,const _Ty &)' being compiled
          with
          [
              _FwdIt=unsigned char *,
              _Ty=float
          ]
  [18/36] Building CXX object CMakeFiles\wotreplay.dir\src\game.cpp.obj
  [19/36] Building CXX object CMakeFiles\wotreplay.dir\src\class_heatmap_writer.cpp.obj
  [20/36] Building CXX object CMakeFiles\wotreplay-gui-widgets.dir\src\imageviewer.cpp.obj
  [21/36] Building CXX object CMakeFiles\wotreplay-gui-widgets.dir\wotreplay-gui-widgets_autogen\mocs_compilation.cpp.obj
  [22/36] Building CXX object CMakeFiles\wotreplay.dir\src\tank.cpp.obj
  [23/36] Building CXX object CMakeFiles\wotreplay.dir\src\parser.cpp.obj
  [24/36] Building CXX object CMakeFiles\wotreplay-gui-widgets.dir\src\mainwindow.cpp.obj
  [25/36] Linking CXX static library lib\wotreplay-gui-widgets.lib
  [26/36] Building CXX object CMakeFiles\wotreplay.dir\src\rule.cpp.obj
  [27/36] Linking CXX static library lib\wotreplay.lib
  [28/36] Automatic MOC and UIC for target wotreplay-gui
  [29/36] Automatic MOC and UIC for target wotreplay-parser
  [30/36] Building CXX object CMakeFiles\wotreplay-gui.dir\wotreplay-gui_autogen\mocs_compilation.cpp.obj
  [31/36] Building CXX object CMakeFiles\wotreplay-parser.dir\wotreplay-parser_autogen\mocs_compilation.cpp.obj
  [32/36] Building CXX object CMakeFiles\wotreplay-parser.dir\src\version.cpp.obj
  [33/36] Building CXX object CMakeFiles\wotreplay-gui.dir\src\gui_main.cpp.obj
  [34/36] Linking CXX executable bin\wotreplay-gui.exe
  FAILED: bin/wotreplay-gui.exe 
  cmd.exe /C "cd . && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\wotreplay-gui.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x86\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x86\mt.exe --manifests  -- C:\PROGRA~2\MICROS~3\2019\COMMUN~1\VC\Tools\MSVC\1426~1.288\bin\Hostx86\x86\link.exe /nologo CMakeFiles\wotreplay-gui.dir\wotreplay-gui_autogen\mocs_compilation.cpp.obj CMakeFiles\wotreplay-gui.dir\src\gui_main.cpp.obj  /out:bin\wotreplay-gui.exe /implib:lib\wotreplay-gui.lib /pdb:bin\wotreplay-gui.pdb /version:0.0  /machine:X86 /debug /INCREMENTAL /subsystem:windows  C:\vcpkg\installed\x86-windows\lib\libssl.lib  C:\vcpkg\installed\x86-windows\lib\libcrypto.lib  C:\vcpkg\installed\x86-windows\lib\boost_filesystem-vc140-mt.lib  C:\vcpkg\installed\x86-windows\lib\boost_program_options-vc140-mt.lib  C:\vcpkg\installed\x86-windows\lib\boost_system-vc140-mt.lib  C:\vcpkg\installed\x86-windows\lib\libpng16.lib  C:\vcpkg\installed\x86-windows\lib\zlib.lib  C:\vcpkg\installed\x86-windows\lib\zlib.lib  C:\vcpkg\installed\x86-windows\lib\tbb.lib  C:\vcpkg\installed\x86-windows\lib\tbbmalloc.lib  ..\..\..\ext\dependencies\libgd-gd-2.1.1\build_msvc12_x86\libgd.lib  lib\wotreplay-gui-widgets.lib  lib\wotreplay.lib  lib\jsoncpp.lib  C:\vcpkg\installed\x86-windows\lib\Qt5Widgets.lib  C:\vcpkg\installed\x86-windows\lib\Qt5Gui.lib  C:\vcpkg\installed\x86-windows\lib\Qt5Core.lib  C:\vcpkg\installed\x86-windows\lib\manual-link\qtmain.lib  C:\vcpkg\installed\x86-windows\lib\libssl.lib  C:\vcpkg\installed\x86-windows\lib\libcrypto.lib  C:\vcpkg\installed\x86-windows\lib\boost_filesystem-vc140-mt.lib  C:\vcpkg\installed\x86-windows\lib\boost_program_options-vc140-mt.lib  C:\vcpkg\installed\x86-windows\lib\boost_system-vc140-mt.lib  C:\vcpkg\installed\x86-windows\lib\libpng16.lib  C:\vcpkg\installed\x86-windows\lib\zlib.lib  C:\vcpkg\installed\x86-windows\lib\tbb.lib  C:\vcpkg\installed\x86-windows\lib\tbbmalloc.lib  ..\..\..\ext\dependencies\libgd-gd-2.1.1\build_msvc12_x86\libgd.lib  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cmd.exe /C "cd /D C:\Users\tyler\wotreplay-parser\out\build\x86-Release && powershell -noprofile -executionpolicy Bypass -file C:/vcpkg/scripts/buildsystems/msbuild/applocal.ps1 -targetBinary C:/Users/tyler/wotreplay-parser/out/build/x86-Release/bin/wotreplay-gui.exe -installedDir C:/vcpkg/installed/x86-windows/bin -OutVariable out""
  LINK Pass 1: command "C:\PROGRA~2\MICROS~3\2019\COMMUN~1\VC\Tools\MSVC\1426~1.288\bin\Hostx86\x86\link.exe /nologo CMakeFiles\wotreplay-gui.dir\wotreplay-gui_autogen\mocs_compilation.cpp.obj CMakeFiles\wotreplay-gui.dir\src\gui_main.cpp.obj /out:bin\wotreplay-gui.exe /implib:lib\wotreplay-gui.lib /pdb:bin\wotreplay-gui.pdb /version:0.0 /machine:X86 /debug /INCREMENTAL /subsystem:windows C:\vcpkg\installed\x86-windows\lib\libssl.lib C:\vcpkg\installed\x86-windows\lib\libcrypto.lib C:\vcpkg\installed\x86-windows\lib\boost_filesystem-vc140-mt.lib C:\vcpkg\installed\x86-windows\lib\boost_program_options-vc140-mt.lib C:\vcpkg\installed\x86-windows\lib\boost_system-vc140-mt.lib C:\vcpkg\installed\x86-windows\lib\libpng16.lib C:\vcpkg\installed\x86-windows\lib\zlib.lib C:\vcpkg\installed\x86-windows\lib\zlib.lib C:\vcpkg\installed\x86-windows\lib\tbb.lib C:\vcpkg\installed\x86-windows\lib\tbbmalloc.lib ..\..\..\ext\dependencies\libgd-gd-2.1.1\build_msvc12_x86\libgd.lib lib\wotreplay-gui-widgets.lib lib\wotreplay.lib lib\jsoncpp.lib C:\vcpkg\installed\x86-windows\lib\Qt5Widgets.lib C:\vcpkg\installed\x86-windows\lib\Qt5Gui.lib C:\vcpkg\installed\x86-windows\lib\Qt5Core.lib C:\vcpkg\installed\x86-windows\lib\manual-link\qtmain.lib C:\vcpkg\installed\x86-windows\lib\libssl.lib C:\vcpkg\installed\x86-windows\lib\libcrypto.lib C:\vcpkg\installed\x86-windows\lib\boost_filesystem-vc140-mt.lib C:\vcpkg\installed\x86-windows\lib\boost_program_options-vc140-mt.lib C:\vcpkg\installed\x86-windows\lib\boost_system-vc140-mt.lib C:\vcpkg\installed\x86-windows\lib\libpng16.lib C:\vcpkg\installed\x86-windows\lib\zlib.lib C:\vcpkg\installed\x86-windows\lib\tbb.lib C:\vcpkg\installed\x86-windows\lib\tbbmalloc.lib ..\..\..\ext\dependencies\libgd-gd-2.1.1\build_msvc12_x86\libgd.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:CMakeFiles\wotreplay-gui.dir/intermediate.manifest CMakeFiles\wotreplay-gui.dir/manifest.res" failed (exit code 1120) with the following output:
C:\Users\tyler\wotreplay-parser\out\build\x86-Release\wotreplay.lib(parser.cpp.obj) : error LNK2019: unresolved external symbol _inflate@8 referenced in function "private: void __thiscall wotreplay::parser_t::extract_replay(class std::vector<unsigned char,class std::allocator<unsigned char> > &,class std::vector<unsigned char,class std::allocator<unsigned char> > &)" (?extract_replay@parser_t@wotreplay@@AAEXAAV?$vector@EV?$allocator@E@std@@@std@@0@Z)
C:\Users\tyler\wotreplay-parser\out\build\x86-Release\wotreplay.lib(parser.cpp.obj) : error LNK2019: unresolved external symbol _inflateEnd@4 referenced in function "private: void __thiscall wotreplay::parser_t::extract_replay(class std::vector<unsigned char,class std::allocator<unsigned char> > &,class std::vector<unsigned char,class std::allocator<unsigned char> > &)" (?extract_replay@parser_t@wotreplay@@AAEXAAV?$vector@EV?$allocator@E@std@@@std@@0@Z)
C:\Users\tyler\wotreplay-parser\out\build\x86-Release\wotreplay.lib(parser.cpp.obj) : error LNK2019: unresolved external symbol _inflateInit_@12 referenced in function "private: void __thiscall wotreplay::parser_t::extract_replay(class std::vector<unsigned char,class std::allocator<unsigned char> > &,class std::vector<unsigned char,class std::allocator<unsigned char> > &)" (?extract_replay@parser_t@wotreplay@@AAEXAAV?$vector@EV?$allocator@E@std@@@std@@0@Z)
C:\Users\tyler\wotreplay-parser\out\build\x86-Release\bin\wotreplay-gui.exe : fatal error LNK1120: 3 unresolved externals
  [35/36] Building CXX object CMakeFiles\wotreplay-parser.dir\src\main.cpp.obj
  FAILED: CMakeFiles/wotreplay-parser.dir/src/main.cpp.obj 
  C:\PROGRA~2\MICROS~3\2019\COMMUN~1\VC\Tools\MSVC\1426~1.288\bin\HostX86\x86\cl.exe  /nologo /TP -DENABLE_TBB -DZLIB_WINAPI -D__TBB_NO_IMPLICIT_LINKAGE -D__func__=__FUNCTION__ -Dchdir=_chdir -I. -I..\..\..\ -Iwotreplay-parser_autogen\include -I..\..\..\src -I..\..\..\ext\jsoncpp\include -IC:\vcpkg\installed\x86-windows\include -I..\..\..\ext\dependencies\libgd-gd-2.1.1\src /EHsc /MD /Zi /O2 /Ob1 /DNDEBUG /showIncludes /FoCMakeFiles\wotreplay-parser.dir\src\main.cpp.obj /FdCMakeFiles\wotreplay-parser.dir\ /FS -c ..\..\..\src\main.cpp
C:\vcpkg\installed\x86-windows\include\boost\system\detail\system_category_win32.hpp(52): error C2039: '_snprintf': is not a member of 'std'
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\include\atomic(134): note: see declaration of 'std'
C:\Users\tyler\wotreplay-parser\out\build\x86-Release\EXEC : TBB warning : tbb.h contains deprecated functionality. For details, please see Deprecated Features appendix in the TBB reference manual.
  ninja: build stopped: subcommand failed.

Build All failed.
evido commented 4 years ago

Would it be possible to just use the VS2019 generator ? That's how I managed to build it.

tswinehart commented 4 years ago

Trying that, i run into the following errors"

1>C:\boost_1_73_0\boost\system\detail\system_category_win32.hpp(52,10): error C2039: '_snprintf': is not a member of 'std'
1>C:\Users\tyler\wotreplay-parser\src\mainwindow.cpp(2,10): fatal error C1083: Cannot open include file: 'ui_mainwindow.h': No such file or directory

So I delete "std::" and I found ui_mainwindow.h in the build folder?? Copied up to src

Then, finally I get these errors, which I don't quite understand

1>main.obj : error LNK2005: _main already defined in gui_main.obj
1>LINK : fatal error LNK1104: cannot open file 'libboost_filesystem-vc142-mt-gd-x32-1_73.lib'
evido commented 4 years ago

Did some more experimentation to trace down the error, but didn't manage to reproduce it. Just wondering you did configure it to make a win32 build right ? In the CMake files I believe it's hardcoded to do so.

The reason why that file ui_mainwindow.h is in build, is because it's being generated by Qt and not actually part of the source.

tswinehart commented 4 years ago

I think part of the problem, is the two "main" functions. I know that they get built into separate executable files, but I think I can only have one per project? (I don't know if that's accurate). Do you have 1 solution, with 2 projects inside it?

Here's what I have configured: image image

evido commented 4 years ago

Looks like this on my side, multiple projects that produce executables with their own main function shouldn't be a problem:

image