rez: Error using rez on windows

I’m trying to build the hello_world example package provided with rez but I’m getting errors just doing the cmake compiler tests that I don’t get when just running cmake by itself without rez.

When I run rez-build on the hello_world project, I get the following output:

NOTE: I get this same output even if the CMakeLists.txt file only contains the cmake_minimum_required command

Executing: c:\program files (x86)\cmake\bin\cmake.exe -d C:\Users\babel\workspace\rez\example_packages\hello_world -Wno-dev -DCMAKE_ECLIPSE_GENERATE_S
OURCE_PROJECT=TRUE -D_ECLIPSE_VERSION=4.3 --no-warn-unused-cli -DCMAKE_INSTALL_PREFIX=C:\Users\babel\packages\hello_world\1.0.0 -DCMAKE_MODULE_PATH=%C
MAKE_MODULE_PATH% -DCMAKE_BUILD_TYPE=Release -DREZ_BUILD_TYPE=local -DREZ_BUILD_INSTALL=0 -G NMake Makefiles
Not searching for unused variables given on the command line.
-- 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:/Program Files (x86)/CMake/share/cmake-3.6/Modules/CMakeTestCCompiler.cmake:61 (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:/Users/babel/workspace/rez/example_packages/hello_world/build/CMakeFiles/CMakeTmp



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

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

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

        C:\PROGRA~2\MICROS~1.0\VC\bin\cl.exe
  @C:\Users\babel\AppData\Local\Temp\nm7D7D.tmp

  testCCompiler.c

  Linking C executable cmTC_62b41.exe

        "C:\Program Files (x86)\CMake\bin\cmake.exe" -E vs_link_exe
  --intdir=CMakeFiles\cmTC_62b41.dir --manifests --
  C:\PROGRA~2\MICROS~1.0\VC\bin\link.exe /nologo
  @CMakeFiles\cmTC_62b41.dir\objects1.rsp
  @C:\Users\babel\AppData\Local\Temp\nm7DDC.tmp

  RC Pass 1 failed to run.

  NMAKE : fatal error U1077: '"C:\Program Files (x86)\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


-- Configuring incomplete, errors occurred!
See also "C:/Users/babel/workspace/rez/example_packages/hello_world/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/babel/workspace/rez/example_packages/hello_world/build/CMakeFiles/CMakeError.log".
rez: BuildError: The cmake build system failed

However, if I just use cmake directly to build the hello_world project, I get this successful output from cmake

NOTE: obviously, I have to remove everything except the cmake_minimum_required command from the build file, but the C compiler tests complete succesfully using cmake and not with rez.


-- Building for: Visual Studio 14 2015
-- 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 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 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
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/babel/workspace/rez/example_packages/hello_world

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 25 (19 by maintainers)

Most upvoted comments

Hey Guys!

This isn’t the most ideal solution yet (running vcvarsall.bat is very slow), but it does fit into rez’s workflow, and cmake works as expected. If this is all fairly obvious, I’m sorry. I am new to both rez and software compilation on windows.

1) Get a Compiler

You can’t compile without a compiler. Firstly, make sure you actually have one. You can install cmake and the microsoft build tools most easily using chocolatey).

choco install -y cmake
choco install -y visualstudio2017buildtools
choco install -y visualstudio2017-workload-vctools

2) Create a vscode Rez Package

Add a package for vscode right in your rez package repository. This package will call vcvarsall.bat and set up your cmd.exe’s environment variables

# directory structure:

$env:USERPROFILE\packages\
    vscode\
        x64_2017_14.13.2612\
            package.py

...\vscode\x64_2017_14.13.2512\package.py

uuid = 'b9be08860d4e4f32bb5c861fce92f268'
name = 'vscode'
version = 'x64_2017_14.13.2612'

def commands():
    vcvarsall = 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Auxiliary\\Build\\vcvarsall.bat'
    command( '"{}" x64'.format(vcvarsall) )

3) Create a 2nd Rez Package (one to compile with cmake)

We’ll build this package normally using rez-build. Create it somewhere other than your rez package repository.

2nd Package Structure

package/
    emptyfile.txt         # just something arbitrary to package
    CMakeLists.txt
    package.py

CMakeLists.txt

cmake_minimum_required(VERSION 3.0)

include(RezBuild)

rez_install_files(
    emptyfile.txt
    DESTINATION .
)

package.py

import sys
uuid = '...' # some uuid
name = 'cmaketest'
version = '0.0.a1'

build_requires = []
if sys.platform == 'win32':
    build_requires.append('vscode')

4) rez-build

Now you can run rez-build, and both cmake and NMake’s will run vcvarsall.bat , so your path and the myriad of other computer-specific variables required to compile in windows.

cd $your_package
rez-build