mumble-voip / mumble-releng

Mumble Release Engineering
Other
17 stars 21 forks source link

prep.cmd doesn't support Visual C++ Build Tools 2015 (suggested by BuildingWindows wiki page) #63

Closed ghost closed 6 years ago

ghost commented 7 years ago

This page [1] under the "Software you will need" section says "Visual C++ Build Tools 2015 or Visual Studio Community 2015 Update 3: We need the MSVC 2015 compilation tools." But when you run the MumbleBuild - cmd shortcut and it executes prep.cmd, it checks %VSVER% and finds it is 14.0 and then finds that %XPCOMPAT% is set to 1 so it goes to VS2015XP and then tries to execute CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 1>NUL and discovers that directory doesn't exist,

The system cannot find the path specified.

c:\Program Files (x86)>dir /s vsvarsall.bat
 Volume in drive C is Windows
 Volume Serial Number is F87A-37E6
File Not Found

However, I do see the following in this directory,

c:\Program Files (x86)\Microsoft Visual C++ Build Tools>dir
 Volume in drive C is Windows
 Volume Serial Number is F87A-37E6

 Directory of c:\Program Files (x86)\Microsoft Visual C++ Build Tools

08/13/2017  07:31 PM    <DIR>          .
08/13/2017  07:31 PM    <DIR>          ..
06/20/2016  01:36 PM            33,006 vcbuildtools.bat
06/20/2016  01:36 PM               534 vcbuildtools_msbuild.bat
08/13/2017  07:31 PM             1,905 Visual C++ 2015 MSBuild Command Prompt.lnk
08/13/2017  07:31 PM             1,945 Visual C++ 2015 x64 arm cross Build Tools Command Prompt.lnk
08/13/2017  07:31 PM             1,931 Visual C++ 2015 x64 Native Build Tools Command Prompt.lnk
08/13/2017  07:31 PM             1,945 Visual C++ 2015 x64 x86  cross Build Tools Command Prompt.lnk
08/13/2017  07:31 PM             1,941 Visual C++ 2015 x86 arm cross Build Tools Command Prompt.lnk
08/13/2017  07:31 PM             1,927 Visual C++ 2015 x86 Native Build Tools Command Prompt.lnk
08/13/2017  07:31 PM             1,945 Visual C++ 2015 x86 x64 Cross Build Tools Command Prompt.lnk
               9 File(s)         47,079 bytes
               2 Dir(s)   3,749,003,264 bytes free

So maybe a simple check if vsvarsall.bat exists and if not then check for this vcbuildtools.bat?

[1] https://wiki.mumble.info/wiki/BuildingWindows

mkrautz commented 7 years ago

I only use VS2015, and I have never tested with the separate build tools. Not sure why the wiki states that they're supported.

PRs to remedy this are welcome.

ghost commented 7 years ago

I'll submit a PR if I can get it to build. Other than something like,

IF exist "%PROGPATH%\Microsoft Visual Studio %VSVER%\VC\vcvarsall.bat" (
    CALL "%PROGPATH%\Microsoft Visual Studio %VSVER%\VC\vcvarsall.bat" %ARCH% >NUL
)  else (
    IF exist "%PROGPATH%\Microsoft Visual C++ Build Tools\vcbuildtools.bat" (
        CALL  "%PROGPATH%\Microsoft Visual C++ Build Tools\vcbuildtools.bat" %ARCH% >NUL
    ) else (
        GOTO VSUNKNOWN
    )
)

and possibly adding a different error stanza since %VSVER% is set to 14.0 so this would be slightly dishonest I'm not sure of a better way to determine whether to select to use vsvarsall.bat or vcbuildtools.bat as there doesn't appear to be any environment variable differences on a system with these Visual C++ Build Tools installed?

ghost commented 7 years ago

I made some similar changes to those ^^^ . I did a quick test to confirm that it called the vcbuildtools.bat. Curiously enough this system now has a "%PROGPATH%\Microsoft Visual Studio %VSVER%\VC\vcvarsall.bat" where that directory, "%PROGPATH%\Microsoft Visual Studio %VSVER%" didn't exist earlier. Maybe I needed to run that vcbuildtools.bat to do some additional installation? I'm actually not that familiar with the separate Microsoft Visual C++ Build Tools and have previously just had Visual Studio Community on our build machines. Anyway, I then realized I needed to re-run the build-all.bash script to build all the dependencies and when I did so, it fails when trying to build protobuf (here's the tail of that build output),

+ extract
+ tar -zxf protobuf-cpp-3.2.0.tar.gz
+ cd protobuf-3.2.0
+ prepare
+ :
+ build
+ '[' Release == Release ']'
+ BUILD_TYPE=RelWithDebInfo
+ cd cmake
++ cygpath -w /cygdrive/c/MumbleBuild/win32-static-1.3.x-2017-07-21-957dd83-868/cmake/bin/cmake.exe
++ cygpath -w /cygdrive/c/MumbleBuild/win32-static-1.3.x-2017-07-21-957dd83-868/protobuf
+ cmd /c 'C:\MumbleBuild\win32-static-1.3.x-2017-07-21-957dd83-868\cmake\bin\cmake.exe' -G 'NMake Makefiles' -DCMAKE_BUILD_TYPE=RelWithDebInfo '-DCMAKE_INSTALL_PREFIX=C:\MumbleBuild\win32-static-1.3.x-2017-07-21-957dd83-868\protobuf' -Dprotobuf_MSVC_STATIC_RUNTIME=off
-- The C compiler identification is MSVC 19.0.24210.0
-- The CXX compiler identification is MSVC 19.0.24210.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe -- broken
CMake Error at C:/MumbleBuild/win32-static-1.3.x-2017-07-21-957dd83-868/cmake/share/cmake-3.7/Modules/CMakeTestCCompiler.cmake:51 (message):
  The C compiler "C:/Program Files (x86)/Microsoft Visual Studio
  14.0/VC/bin/cl.exe" is not able to compile a simple test program.

  It fails with the following output:

   Change Dir: C:/MumbleBuild/win32-static-1.3.x-2017-07-21-957dd83-868.build/protobuf-3.2.0/cmake/CMakeFiles/CMakeTmp

  Run Build Command:"nmake" "/NOLOGO" "cmTC_89b59\fast"

        "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe" -f
  CMakeFiles\cmTC_89b59.dir\build.make /nologo -L
  CMakeFiles\cmTC_89b59.dir\build

  Building C object CMakeFiles/cmTC_89b59.dir/testCCompiler.c.obj

        C:\PROGRA~2\MICROS~1.0\VC\bin\cl.exe
  @C:\MumbleBuild\win32-static-1.3.x-2017-07-21-957dd83-868\cygwin\tmp\nmC4BE.tmp

  testCCompiler.c

  Linking C executable cmTC_89b59.exe

        C:\MumbleBuild\win32-static-1.3.x-2017-07-21-957dd83-868\cmake\bin\cmake.exe
  -E vs_link_exe --intdir=CMakeFiles\cmTC_89b59.dir --manifests --
  C:\PROGRA~2\MICROS~1.0\VC\bin\link.exe /nologo
  @CMakeFiles\cmTC_89b59.dir\objects1.rsp
  @C:\MumbleBuild\win32-static-1.3.x-2017-07-21-957dd83-868\cygwin\tmp\nmC55B.tmp

  RC Pass 1 failed to run.

  NMAKE : fatal error U1077:
  'C:\MumbleBuild\win32-static-1.3.x-2017-07-21-957dd83-868\cmake\bin\cmake.exe'
  : return code '0xffffffff'

  Stop.

  NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio
  14.0\VC\BIN\nmake.exe"' : return code '0x2'

  Stop.

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:12 (project)

-- Configuring incomplete, errors occurred!
See also "C:/MumbleBuild/win32-static-1.3.x-2017-07-21-957dd83-868.build/protobuf-3.2.0/cmake/CMakeFiles/CMakeOutput.log".
See also "C:/MumbleBuild/win32-static-1.3.x-2017-07-21-957dd83-868.build/protobuf-3.2.0/cmake/CMakeFiles/CMakeError.log".
+ exit 1

I'm going back to using Visual Studio as unfortunately I don't have time to try and get things to build with Visual C++ Build Tools but it doesn't seem like it is currently a viable option. I'd post a bug against the wiki but I can't find that anywhere on GitHub.

Kissaki commented 7 years ago

I do not have VS 2015 installed, only VS2017. I do have the Visual C++ Build Tools in version 14 installed.

mkrautz commented 6 years ago

For now, I've removed mention of VS build tools from the wiki. If someone wants build tools support (or want to test that it works), they can send PRs and update the wiki.