Conda-build: Windows: Cannot find cl in test section

Created on 28 Jun 2016  Â·  10Comments  Â·  Source: conda/conda-build

In the test section of a recipe, it seems we are unable to find cl on Windows. Here is a recipe that reproduces this problem.

See this log for more details. Snippet below.

cmake -G "NMake Makefiles" .. 
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error in CMakeLists.txt:
  The CMAKE_C_COMPILER:
    cl
  is not a full path and was not found in the PATH.
  To use the NMake generator with Visual C++, cmake must be run from a shell
  that can use the compiler cl from the command line.  This environment is
  unable to invoke the cl compiler.  To fix this problem, run cmake from the
  Visual Studio Command Prompt (vcvarsall.bat).
  Tell CMake where to find the compiler by setting either the environment
  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.
CMake Error in CMakeLists.txt:
  The CMAKE_CXX_COMPILER:
    cl
  is not a full path and was not found in the PATH.
  To use the NMake generator with Visual C++, cmake must be run from a shell
  that can use the compiler cl from the command line.  This environment is
  unable to invoke the cl compiler.  To fix this problem, run cmake from the
  Visual Studio Command Prompt (vcvarsall.bat).
  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.
CMake Warning (dev) in CMakeLists.txt:
  No cmake_minimum_required command is present.  A line of code such as
    cmake_minimum_required(VERSION 3.5)
  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 incomplete, errors occurred!
See also "C:/Miniconda/conda-bld/work/cotire-cotire-1.7.8/src/build/CMakeFiles/CMakeOutput.log".
See also "C:/Miniconda/conda-bld/work/cotire-cotire-1.7.8/src/build/CMakeFiles/CMakeError.log".

Most helpful comment

use

test:
  requirements:
    - {{ compiler('c') }}

All 10 comments

This is completely expected. The activation script is only run during the build phase. If you want a compiler in the test phase as well, that's going to take some work.

cc @patricksnape

Yeah, it's not a common thing to want to use a compiler in the test phase, but it does happen sometimes.

Have been seeing some pretty ugly hacks to get around this. Namely using conda to create a new test environment in the test script and then running with the compiler. Any chance we can get this fixed so that people don't resort to these sorts of solutions? See xrefs above for details.

Sorry, this is a feature request, not a bug fix.

PRs are welcome, but I can't work on this right now.

On Dec 12, 2016 9:31 AM, "jakirkham" notifications@github.com wrote:

Have been seeing some pretty ugly hacks to get around this. Namely using
conda to create a new test environment in the test script and then
running with the compiler. Any chance we can get this fixed so that people
don't resort to these sorts of solutions? See xrefs above for details.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/conda/conda-build/issues/1059#issuecomment-266460790,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AACV-e4dionNm-veqRyZXYqbHOzOTgkRks5rHWi2gaJpZM4I_rUD
.

Could you please outline what is required to make this work? Based on your last comment it sounds like this is non-trivial. So without some guidance I'm not clear that a PR from an outside contributor is feasible.

There's a separate bitt that makes the build script for windows - this is where the VS activation stuff lives: https://github.com/conda/conda-build/blob/master/conda_build/windows.py#L216

That part needs to be added to https://github.com/conda/conda-build/blob/master/conda_build/build.py#L1085

There's room here for a refactor - that test function is doing way too much, IMHO. That's not strictly necessary for this feature to be added.

IIUC this is solved in conda-build 3, correct? If so, do you mind sharing the recommended steps when closing?

use

test:
  requirements:
    - {{ compiler('c') }}

If I have a package that already lists the C compiler as a run requirement, do I still need to list it in test?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sscherfke picture sscherfke  Â·  4Comments

krinsman picture krinsman  Â·  8Comments

krinsman picture krinsman  Â·  6Comments

asmeurer picture asmeurer  Â·  3Comments

maddenp picture maddenp  Â·  8Comments