Coder Social home page Coder Social logo

Comments (6)

egorpugin avatar egorpugin commented on July 2, 2024

Hi,

Do you have cl.exe version 19.35 actually installed?
Try add --trace option to sw.
You can check what compilers are detected by sw.

from sw.

pkgw avatar pkgw commented on July 2, 2024

The --trace option doesn't seem to add a whole lot of output, but the information at the top of the build (log here) shows the right version:

2023-07-29T20:21:22.0812748Z Host configuration: {"os":{"arch":"x86_64","kernel":"com.Microsoft.Windows.NT"}}
2023-07-29T20:21:22.0838314Z Registering driver: org.sw.sw.driver.cpp-0.4.1
2023-07-29T20:21:22.2509678Z -- Building for: Visual Studio 17 2022
2023-07-29T20:21:30.0954739Z -- The C compiler identification is MSVC 19.35.32217.1
2023-07-29T20:21:31.5360799Z -- The CXX compiler identification is MSVC 19.35.32217.1

from sw.

pkgw avatar pkgw commented on July 2, 2024

OK, but when I just execute cl in the build environment, I get:

Microsoft (R) C/C++ Optimizing Compiler Version 19.36.32537 for x64

That's version 19.36, not 19.35. I'll try to figure out why the numbers are disagreeing.

from sw.

pkgw avatar pkgw commented on July 2, 2024

OK, I believe that our build failure stemmed from those disagreeing version numbers. Due to the way that the conda-forge build environment is set up, the cl found in %PATH% was version 19.36.x, while the version used by MSBuild as invoked by CMake was 19.35.x — it turns out that on Windows in most situations, CMake chooses the compilers based on how MSBuild is set up, and it's very difficult to override. (See below.) I think that the disagreement eventually led to the issue reported above: CMake told sw to look for -compiler msvc-19.35, but then (I am inferring) sw found that cl was a different version.

I don't know enough about the sw framework to gauge whether this should be considered a bug or not. It seems to me that if sw is being launched from CMake, it might be desirable to add some steps to ensure that sw is using the same compiler as CMake/MSBuild, which doesn't appear to be happening at the moment. (Maybe similar problems would happen on other platforms if you set CMAKE_C_COMPILER, etc.?)

Maybe also a message could be added so that if/when this error happens in the future, the user gets a suggestion to check that CMake and sw are using the same compilers.

Also, for posterity: we worked around this problem by setting CMake to use the NMake Makefiles generator and setting CMAKE_C_COMPILER and CMAKE_CXX_COMPILER to the 19.36.x version of cl. My understanding is that the NMake generator is the only one that gives you a way to manually control the compiler selection on Windows — otherwise MSBuild's choice always overrides any attempts to configure the compilers. See the conda-forge PR discussion for a bit more context.

from sw.

egorpugin avatar egorpugin commented on July 2, 2024

Is it possible to run that sw command from cmake from your initial post with -compiler msvc-19.36 (replaced 5 with 6)?

from sw.

pkgw avatar pkgw commented on July 2, 2024

It would be a challenge for me to reproduce the build environment at this point, but I believe that if I manually invoked it that way, everything would work.

from sw.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.