Vcpkg: Error while building openssl: 'rc' is not recognized as an internal or external command

Created on 24 Aug 2017  路  4Comments  路  Source: microsoft/vcpkg

I ran this command:

 vcpkg install --triplet x64-windows openssl

But the build failed with this output:

The following packages will be built and installed:
    openssl:x64-windows
Building package openssl:x64-windows...
-- CURRENT_INSTALLED_DIR=C:/vcpkg/installed/x64-windows
-- DOWNLOADS=C:/vcpkg/downloads
-- CURRENT_PACKAGES_DIR=C:/vcpkg/packages/openssl_x64-windows
-- CURRENT_BUILDTREES_DIR=C:/vcpkg/buildtrees/openssl
-- CURRENT_PORT_DIR=c:/vcpkg/ports/openssl/.
-- Downloading https://www.openssl.org/source/openssl-1.0.2l.tar.gz...
-- Downloading https://www.openssl.org/source/openssl-1.0.2l.tar.gz... OK
-- Testing integrity of downloaded file...
-- Testing integrity of downloaded file... OK
-- Extracting source C:/vcpkg/downloads/openssl-1.0.2l.tar.gz
-- Extracting done
-- Applying patch C:/vcpkg/ports/openssl/PerlScriptSpaceInPathFixes.patch
-- Applying patch C:/vcpkg/ports/openssl/PerlScriptSpaceInPathFixes.patch done
-- Applying patch C:/vcpkg/ports/openssl/ConfigureIncludeQuotesFix.patch
-- Applying patch C:/vcpkg/ports/openssl/ConfigureIncludeQuotesFix.patch done
-- Applying patch C:/vcpkg/ports/openssl/STRINGIFYPatch.patch
-- Applying patch C:/vcpkg/ports/openssl/STRINGIFYPatch.patch done
-- Configure x64-windows-rel
-- Configure x64-windows-rel done
-- Build x64-windows-rel
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:43 (message):
    Command failed: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/nmake.exe;-f;ms\ntdll.mak;install
    Working Directory: C:/vcpkg/buildtrees/openssl/x64-windows-rel/openssl-1.0.2l
    See logs for more information:
      C:\vcpkg\buildtrees\openssl\build-x64-windows-rel-1-out.log
      C:\vcpkg\buildtrees\openssl\build-x64-windows-rel-1-err.log

Call Stack (most recent call first):
  ports/openssl/portfile.cmake:85 (vcpkg_execute_required_process)
  scripts/ports.cmake:72 (include)


Error: Building package openssl:x64-windows failed with: BUILD_FAILED
Please ensure you're using the latest portfiles with `.\vcpkg update`, then
submit an issue at https://github.com/Microsoft/vcpkg/issues including:
  Package: openssl:x64-windows
  Vcpkg version: 0.0.83-unknownhash

Additionally, attach any relevant sections from the log files above.

Entire contents of C:\vcpkg\buildtrees\openssl\build-x64-windows-rel-1-out.log:

Building OpenSSL
    rc /fo"tmp32dll\libeay32.res" /d CRYPTO ms\version32.rc

Entire contents of C:\vcpkg\buildtrees\openssl\build-x64-windows-rel-1-err.log:

Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
Copyright (C) Microsoft Corporation.  All rights reserved.

'rc' is not recognized as an internal or external command,
operable program or batch file.
NMAKE : fatal error U1077: 'rc' : return code '0x1'
Stop.

This is on a laptop that has passed between programmers and built up quite a lot of cruft over the years, including several versions of the Windows SDK:

c:\Program Files (x86)\Windows Kits>dir /B
10
8.0
8.1
NETFXSDK

c:\Program Files (x86)\Windows Kits>dir /S /B rc.exe
c:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\arm64\rc.exe
c:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\x64\rc.exe
c:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\x86\rc.exe
c:\Program Files (x86)\Windows Kits\8.1\bin\x64\rc.exe
c:\Program Files (x86)\Windows Kits\8.1\bin\x86\rc.exe
repro

Most helpful comment

I ran into a similar issue when building openssl-1.1.0g manually (perl Configure VC-WIN64A --prefix=... // nmake). Using ActivePerl 5.24.2 x64.

From an administrative command prompt, I ran vcvars64.bat and had the exact same issue. Your guidance on finding the MS Resource Compiler in the Windows Kits directory was helpful. I solved the build problem by just adding "C:Program Files (x86)Windows Kits10bin10.0.16299.0x64" to the path (set PATH=%PATH%;"C:Program Files (x86)Windows Kits10bin10.0.16299.0x64")

Reran nmake and everything proceeded seemingly fine.

According to 1.1.0g/INSTALL:835:
RC The name of the rc executable to use. The default will be as defined for the target platform in the ".conf" file. If not defined then "windres" will be used. The WINDRES environment variable is synonymous to this. If both are defined then RC takes precedence.

It seems that in 1.1.0g/Configurations/00-base-templates.conf:95 the default path for RC is defined as just "rc" (e.g. no path - as in it's looking for it in the current path).

Ways to solve this appear to be:

  • Add the appropriate windows kits directory containing rc.exe to the current PATH (tested w/VS2017 and OpenSSL 1.1.0g)
  • Set the RC variable with a full path to rc.exe (untested)
  • Set the WINDRES variable with a full path to rc.exe (untested)

(I guess one could look at this in a number of ways: Perhaps the OpenSSL build scripts aren't really architected well to determine the necessary paths for build tools on Win32/64... Perhaps it's designed more around MING/Cygwin instead of "native" VC++ compilation... Regardless, it's definitely an issue.)

All 4 comments

I ran into a similar issue when building openssl-1.1.0g manually (perl Configure VC-WIN64A --prefix=... // nmake). Using ActivePerl 5.24.2 x64.

From an administrative command prompt, I ran vcvars64.bat and had the exact same issue. Your guidance on finding the MS Resource Compiler in the Windows Kits directory was helpful. I solved the build problem by just adding "C:Program Files (x86)Windows Kits10bin10.0.16299.0x64" to the path (set PATH=%PATH%;"C:Program Files (x86)Windows Kits10bin10.0.16299.0x64")

Reran nmake and everything proceeded seemingly fine.

According to 1.1.0g/INSTALL:835:
RC The name of the rc executable to use. The default will be as defined for the target platform in the ".conf" file. If not defined then "windres" will be used. The WINDRES environment variable is synonymous to this. If both are defined then RC takes precedence.

It seems that in 1.1.0g/Configurations/00-base-templates.conf:95 the default path for RC is defined as just "rc" (e.g. no path - as in it's looking for it in the current path).

Ways to solve this appear to be:

  • Add the appropriate windows kits directory containing rc.exe to the current PATH (tested w/VS2017 and OpenSSL 1.1.0g)
  • Set the RC variable with a full path to rc.exe (untested)
  • Set the WINDRES variable with a full path to rc.exe (untested)

(I guess one could look at this in a number of ways: Perhaps the OpenSSL build scripts aren't really architected well to determine the necessary paths for build tools on Win32/64... Perhaps it's designed more around MING/Cygwin instead of "native" VC++ compilation... Regardless, it's definitely an issue.)

I had not built openssl in a few months and forgot which VS prompt I had used. Using any of the VS 2015 tools I got a similar error 'rc' is not recognized as an internal or external command,
operable program or batch file.
I then ran my build commands in the Developer Command Prompt for VS 2017 and it built without any issues, so I assume one must use the latest Visual Studio tools. I did not need to add rc.exe to my path
I also ran my build in x64 Native Tools Command Prompt

Please open a new issue if this is still a problem for you.

The problem is fixed by installing Windows SDK for Visual Studio 2015. See here for more details: https://stackoverflow.com/questions/43847542/rc-exe-no-longer-found-in-vs-2015-command-prompt

Was this page helpful?
0 / 5 - 0 ratings

Related issues

oahzuw picture oahzuw  路  3Comments

madkoala picture madkoala  路  3Comments

tzbo picture tzbo  路  3Comments

ghost picture ghost  路  3Comments

jasjuang picture jasjuang  路  3Comments