Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't build with MSVC #4

Open
paleozogt opened this issue Jul 12, 2017 · 1 comment
Open

can't build with MSVC #4

paleozogt opened this issue Jul 12, 2017 · 1 comment

Comments

@paleozogt
Copy link

gradle-external-build fails with MSVC. In a vcvars shell this is what I see:

C:\Users\foobar\Development\gradle-external-build\examples\cmake>cl
Microsoft (R) C/C++ Optimizing Compiler Version 19.10.25019 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

usage: cl [ option... ] filename... [ /link linkoption... ]

C:\Users\foobar\Development\gradle-external-build\examples\cmake>cmake --version
cmake version 3.8.1

CMake suite maintained and supported by Kitware (kitware.com/cmake).

C:\Users\foobar\Development\gradle-external-build\examples\cmake>gradlew.bat --version

 ------------------------------------------------------------
Gradle 3.3
------------------------------------------------------------

Build time:   2017-01-03 15:31:04 UTC
Revision:     075893a3d0798c0c1f322899b41ceca82e4e134b

Groovy:       2.4.7
Ant:          Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM:          1.8.0_131 (Oracle Corporation 25.131-b11)
OS:           Windows 10 10.0 amd64

C:\Users\foobar\Development\gradle-external-build\examples\cmake>gradlew.bat build
:cmake:externalBuildHelloExecutable
CMake Error at CMakeLists.txt:1 (project):
  No CMAKE_C_COMPILER could be found.



CMake Error at CMakeLists.txt:1 (project):
  No CMAKE_CXX_COMPILER could be found.



CMake Warning (dev) in CMakeLists.txt:
  No cmake_minimum_required command is present.  A line of code such as

    cmake_minimum_required(VERSION 3.8)

  should be added at the top of the file.  The version specified may be lower
  if you wish to support older CMake versions for this project.  For more
  information run "cmake --help-policy CMP0000".
This warning is for project developers.  Use -Wno-dev to suppress it.


:cmake:externalBuildHelloExecutable FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':cmake:externalBuildHelloExecutable'.
> Exec failed with code 1.
See the full log at file:///C:/Users/foobar/Development/gradle-external-build/examples/cmake/build/tmp/externalBuildHelloExecutable/cmake-errors.txt

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 1.757 secs

However, building by hand works:

C:\Users\foobar\Development\gradle-external-build\examples\cmake>cd build\external-build\hello\windows_x86

C:\Users\foobar\Development\gradle-external-build\examples\cmake\build\external-build\hello\windows_x86>cmake .
-- The C compiler identification is MSVC 19.0.24218.2
-- The CXX compiler identification is MSVC 19.0.24218.2
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/Shared/14.0/VC/bin/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/Shared/14.0/VC/bin/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/Shared/14.0/VC/bin/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/Shared/14.0/VC/bin/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Warning (dev) in CMakeLists.txt:
  No cmake_minimum_required command is present.  A line of code such as

    cmake_minimum_required(VERSION 3.8)

  should be added at the top of the file.  The version specified may be lower
  if you wish to support older CMake versions for this project.  For more
  information run "cmake --help-policy CMP0000".
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/foobar/Development/gradle-external-build/examples/cmake/build/external-build/hello/windows_x86

C:\Users\foobar\Development\gradle-external-build\examples\cmake\build\external-build\hello\windows_x86>cmake --build .
Microsoft (R) Build Engine version 15.1.1012.6693
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 7/12/2017 4:42:57 PM.
Project "C:\Users\foobar\Development\gradle-external-build\examples\cmake\build\external-build\hello\windows_x86\ALL_B
UILD.vcxproj" on node 1 (default targets).
Project "C:\Users\foobar\Development\gradle-external-build\examples\cmake\build\external-build\hello\windows_x86\ALL_B
UILD.vcxproj" (1) is building "C:\Users\foobar\Development\gradle-external-build\examples\cmake\build\external-build\h
ello\windows_x86\ZERO_CHECK.vcxproj" (2) on node 1 (default targets).
PrepareForBuild:
  Creating directory "Win32\Debug\ZERO_CHECK\".
  Creating directory "C:\Users\foobar\Development\gradle-external-build\examples\cmake\build\external-build\hello\wind
  ows_x86\Debug\".
  Creating directory "Win32\Debug\ZERO_CHECK\ZERO_CHECK.tlog\".
InitializeBuildStatus:
  Creating "Win32\Debug\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
CustomBuild:
  Checking Build System
  CMake does not need to re-run because C:/Users/foobar/Development/gradle-external-build/examples/cmake/build/externa
  l-build/hello/windows_x86/CMakeFiles/generate.stamp is up-to-date.
FinalizeBuildStatus:
  Deleting file "Win32\Debug\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild".
  Touching "Win32\Debug\ZERO_CHECK\ZERO_CHECK.tlog\ZERO_CHECK.lastbuildstate".
Done Building Project "C:\Users\foobar\Development\gradle-external-build\examples\cmake\build\external-build\hello\win
dows_x86\ZERO_CHECK.vcxproj" (default targets).

Project "C:\Users\foobar\Development\gradle-external-build\examples\cmake\build\external-build\hello\windows_x86\ALL_B
UILD.vcxproj" (1) is building "C:\Users\foobar\Development\gradle-external-build\examples\cmake\build\external-build\h
ello\windows_x86\hello.vcxproj" (3) on node 1 (default targets).
PrepareForBuild:
  Creating directory "hello.dir\Debug\".
  Creating directory "hello.dir\Debug\hello.tlog\".
InitializeBuildStatus:
  Creating "hello.dir\Debug\hello.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
CustomBuild:
  Building Custom Rule C:/Users/foobar/Development/gradle-external-build/examples/cmake/CMakeLists.txt
  CMake does not need to re-run because C:/Users/foobar/Development/gradle-external-build/examples/cmake/build/externa
  l-build/hello/windows_x86/CMakeFiles/generate.stamp is up-to-date.
ClCompile:
  C:\Program Files (x86)\Microsoft Visual Studio\Shared\14.0\VC\bin\CL.exe /c /nologo /W1 /WX- /O2 /Oy- /D "CMAKE_INTDI
  R=\"Debug\"" /D _MBCS /Gm- /MD /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"hello.dir\Debug\\" /Fd"hello.d
  ir\Debug\vc140.pdb" /Gd /TC /analyze- /errorReport:queue "C:\Users\foobar\Development\gradle-external-build\examples
  \cmake\src\hello.c"
  hello.c
Link:
  C:\Program Files (x86)\Microsoft Visual Studio\Shared\14.0\VC\bin\link.exe /ERRORREPORT:QUEUE /OUT:"C:\Users\foobar\
  Development\gradle-external-build\examples\cmake\build\external-build\hello\windows_x86\Debug\hello.exe" /INCREMENTAL
   /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib adva
  pi32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /PDB:"C:/Users/foobar/Developme
  nt/gradle-external-build/examples/cmake/build/external-build/hello/windows_x86/Debug/hello.pdb" /SUBSYSTEM:CONSOLE /T
  LBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:/Users/foobar/Development/gradle-external-build/examples/cmake/build/extern
  al-build/hello/windows_x86/Debug/hello.lib" /MACHINE:X86 /SAFESEH hello.dir\Debug\hello.obj
  hello.vcxproj -> C:\Users\foobar\Development\gradle-external-build\examples\cmake\build\external-build\hello\windows
  _x86\Debug\hello.exe
FinalizeBuildStatus:
  Deleting file "hello.dir\Debug\hello.tlog\unsuccessfulbuild".
  Touching "hello.dir\Debug\hello.tlog\hello.lastbuildstate".
Done Building Project "C:\Users\foobar\Development\gradle-external-build\examples\cmake\build\external-build\hello\win
dows_x86\hello.vcxproj" (default targets).

PrepareForBuild:
  Creating directory "Win32\Debug\ALL_BUILD\".
  Creating directory "Win32\Debug\ALL_BUILD\ALL_BUILD.tlog\".
InitializeBuildStatus:
  Creating "Win32\Debug\ALL_BUILD\ALL_BUILD.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
CustomBuild:
  Building Custom Rule C:/Users/foobar/Development/gradle-external-build/examples/cmake/CMakeLists.txt
  CMake does not need to re-run because C:/Users/foobar/Development/gradle-external-build/examples/cmake/build/externa
  l-build/hello/windows_x86/CMakeFiles/generate.stamp is up-to-date.
FinalizeBuildStatus:
  Deleting file "Win32\Debug\ALL_BUILD\ALL_BUILD.tlog\unsuccessfulbuild".
  Touching "Win32\Debug\ALL_BUILD\ALL_BUILD.tlog\ALL_BUILD.lastbuildstate".
Done Building Project "C:\Users\foobar\Development\gradle-external-build\examples\cmake\build\external-build\hello\win
dows_x86\ALL_BUILD.vcxproj" (default targets).


Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:01.17```
@awrichar
Copy link
Owner

Unfortunately, I'm not much of an expert on Windows development - and I can't come up with a reason that this would fail. Maybe when running manually, it's picking up a different environment than when running via Gradle?

I'm happy to help make this work if possible - if you or anyone else on Windows can provide --info logs for the failed Gradle build, that might give more clues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants