Superbuild problem with MSVC versions

Trying to run a “superbuild” that is derived from the “superbuild” of PV 5.15.3, generating a Windows installer for a PV derived application (same version), on Windows 11.

There is a need to include a precompiled binary that was built with MSVC 2022 because only then binary compatibility between different parts also with older build tools (down to 2015) is given. Some issues could already be solved, but this one looks really hard:

[444/511] Install pybind11 for pip
FAILED: superbuild/pybind11/stamp/pybind11-pybind11-pip-install C:/dev/atgview/pack/superbuild/pybind11/stamp/pybind11-pybind11-pip-install
C:\Windows\system32\cmd.exe /C "cd /D C:\dev\atgview\pack\superbuild\pybind11\src && "C:\Program Files\CMake\bin\cmake.exe" -E env --modify PYTHONPATH=path_list_prepend:C:/dev/atgview/pack/install/Python/Lib/site-packages -- C:/dev/atgview/pack/install/Python/python.exe -m pip install --no-index --no-deps --no-build-isolation --root=C:/dev/atgview/pack/install --prefix=Python C:/dev/atgview/pack/superbuild/pybind11/src && "C:\Program Files\CMake\bin\cmake.exe" -E touch C:/dev/atgview/pack/superbuild/pybind11/stamp/pybind11-pybind11-pip-install"
Processing c:\dev\atgview\pack\superbuild\pybind11\src
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'error'
  error: subprocess-exited-with-error

  Preparing metadata (pyproject.toml) did not run successfully.
  exit code: 1

  [48 lines of output]
  -- Building for: Visual Studio 14 2015
  CMake Deprecation Warning at CMakeLists.txt:13 (cmake_minimum_required):
    Compatibility with CMake < 3.10 will be removed from a future version of
    CMake.

    Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
    to tell CMake that the project requires at least <min> but has been updated
    to work with policies introduced by <max> or earlier.


  -- The CXX compiler identification is unknown
  CMake Error at CMakeLists.txt:49 (project):
    No CMAKE_CXX_COMPILER could be found.



  -- Configuring incomplete, errors occurred!
  Traceback (most recent call last):
    File "<string>", line 117, in remove_output
    File "<string>", line 139, in <module>
    File "C:\dev\atgview\pack\install\Python\lib\subprocess.py", line 526, in run
      raise CalledProcessError(retcode, process.args,
  subprocess.CalledProcessError: Command '['cmake', '-S', '.', '-B', 'C:\\Users\\cornelis\\AppData\\Local\\Temp\\tmpwxr6vycd', '-DCMAKE_INSTALL_PREFIX=pybind11', '-DBUILD_TESTING=OFF', '-DPYBIND11_NOPYTHON=ON', '-Dprefix_for_pc_file=${pcfiledir}/../../']' returned non-zero exit status 1.

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "C:\dev\atgview\pack\install\Python\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
      main()
    File "C:\dev\atgview\pack\install\Python\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "C:\dev\atgview\pack\install\Python\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 149, in prepare_metadata_for_build_wheel
      return hook(metadata_directory, config_settings)
    File "C:\dev\atgview\pack\install\Python\Lib\site-packages\setuptools\build_meta.py", line 396, in prepare_metadata_for_build_wheel
      self.run_setup()
    File "C:\dev\atgview\pack\install\Python\Lib\site-packages\setuptools\build_meta.py", line 341, in run_setup
      exec(code, locals())
    File "<string>", line 123, in <module>
    File "C:\dev\atgview\pack\install\Python\lib\contextlib.py", line 153, in __exit__
      self.gen.throw(typ, value, traceback)
    File "<string>", line 120, in remove_output
    File "C:\dev\atgview\pack\install\Python\lib\shutil.py", line 750, in rmtree
      return _rmtree_unsafe(path, onerror)
    File "C:\dev\atgview\pack\install\Python\lib\shutil.py", line 601, in _rmtree_unsafe
      onerror(os.scandir, path, sys.exc_info())
    File "C:\dev\atgview\pack\install\Python\lib\shutil.py", line 598, in _rmtree_unsafe
      with os.scandir(path) as scandir_it:
  FileNotFoundError: [WinError 3] The system cannot find the path specified: 'pybind11/include'
  [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

Encountered error while generating package metadata.

See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
[

On line 13, this message (from ninja) tells me that it is trying to “build” something with MSVC 2015, and then it does not find an appropriate compiler. Well yes: no MSVC 2015 compiler is present on that computer. Now I guess I have two options:

  • Either try to change the request for that old compiler “somehow”. Problem: I tried for several days now, but I did not find out where this request is really coming from
  • Or install a MSVC 2015 build system. Which however is no longer supported and is “deprecated since October 2025”

Actually I would prefer to go for the first version, because I assume that the code should compile also with newer (and installed) compilers, but as I said: So far I did not succeed to find out where that request is coming from! Somehow the entire process is in a nested call that tries to do a build through a python function that is called by… whatever… - the entire thing being the result of a cmake run that again is nested in many complicated ways

I’m confused, why not just using MSVC 2022 ?

This is exactly what I am doing! So I am also confused why in that specific location I am seeing that message, and so far I was not able to detangle the different levels of calls within calls within etc. that finally lead to that request. For ninja, this is “step 444 out of 511”, and the intention seems to be “Install pybind11 for pip”.

Actually I am having MSVC 2019, 2022 and 2026 on that computer, and for each of them I have a CMD with an automatic call to the necessary environment settings etc., and I am starting both cmake and ninja from the MSVC 2022 command line, so if I am e.g. starting cmake-gui from there, it will always find all the compiler, linker, rc etc tools from MSVC 2022.

Now if I read “pybind11” and “pip”, this is of course about compiling some Python related stuff, and I know that Windows has currently also some Python in it’s “MS Store”, that is not altogether “standard”. After I had the above trouble, I made sure that MS variant is completely deinstalled, and instead I installed some Python from python.org. Which did not help yet as far as I can see

Just one thing that comes to mind which I could possibly try: See what the MSVC2022 command line is adding to the regular path, and make sure that all these settings are added to the global PATH variable. With this I would of course “kill” the two others, but since I do not really need them for anything, and if it would solve my problem, I could probably live with it…

I’m afraid I usually have a single MSVC installation on my Windows computer, so you may be in uncharted waters there.

That’s what I am afraid I am anyway!

Actually I am having a new computer, and currently installing the “current Visual Studio” will give you 2026. Then I thought that I should best go with 2019, because PV 5.15.3 was done with that, but then I was running into that issue with the precompiled binary that I have to include, so I had to add 2022 on top of that.

Now I did what I proposed above: make sure that all 2022 related environment stuff is “hard coded” into the global PATH. Indeed I can now type “cl” in just any cmd command line, with no extra initialization, and I am getting the C/C++ compiler for MSVC 2022.

BUT STILL NOT FOR THAT pybind11 thing: The error log that I am getting is unchanged!

So first I have that line:

– Building for: Visual Studio 14 2015

and further down I have

– The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:49 (project):
No CMAKE_CXX_COMPILER could be found.

The CMakeLists.txt that it is referring to can be found - I guess! - in the build directory tree of the superbuild at /superbuild/PyBind11/src, and at line 49 there is a “project…” command. My guess is based on the fact that at line 13 I have indeed some “cmake_minimum_required(3.5)”, triggering a warning about all pre 3.10 stuff being removed in the future.

What I do not see is: Which is the process environment of that cmake call that does not find a proper compiler, because it should now ALWAYS find a compiler, because of the global PATH setting! But of course if it insists on finding an old version that is not installed… In that case I should find out WHY it insists, i.e., where sits the code that does this version check, etc.

can you share this pybind11.cmake you are using ?

pybind11.cmake (1.3 KB)

That should be the thing: untouched from the superbuild/projects folder of a ParaView superbuild version 5.15.

It says “copyright 2016…”, so it is indeed from a time when MSVC 2015 was the most recent version. Maybe I should check if in more recent ParaView superbuilds there is a more recent variant…!?

…looks like I cannot avoid starting for the long, long expedition - finding the way how starting with this .cmake file, through all the cmake steps that are generating new code and intermediate files, and finally ninja, this situation is generated where a cmake run tries to configure a pybind11 build and does not find a compiler!

So far I was more or less guessing and trying, but now I have to go step by step, again trying to understand another part of this huge labyrinthic building called “superbuild” :laughing:

Actually its pretty easy to fix, look at the boost.cmake file and how it handles MSVC versions.

Thanks - I will give it a try! And report if I was successful