microsoft / vscode-cmake-tools

CMake integration in Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=vector-of-bool.cmake-tools
MIT License
1.48k stars 457 forks source link

Prompt the user to use the latest CMake #1139

Open GDYendell opened 4 years ago

GDYendell commented 4 years ago

Brief Issue Summary

I have successfully got my project to configure (and build):

[main] Configuring folder: odin-data 
[main] For the best experience, CMake server or file-api support is required. Please upgrade CMake to 3.7.1 or newer.
[proc] Executing command: /usr/bin/cmake --no-warn-unused-cli -DHDF5_ROOT:STRING=/dls_sw/prod/tools/RHEL7-x86_64/hdf5/1-10-5/prefix -DLOG4CXX_ROOT_DIR:STRING=/dls_sw/prod/tools/RHEL7-x86_64/log4cxx/0-10-0dls2/prefix -DBLOSC_ROOT_DIR:STRING=/dls_sw/prod/tools/RHEL7-x86_64/c-blosc/1-14-2/prefix -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_INSTALL_PREFIX:STRING=vscode_prefix -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/gcc -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/g++ -H/scratch/work/tools/RHEL7-x86_64/odin-data -B/scratch/work/tools/RHEL7-x86_64/odin-data/vscode_build "-GUnix Makefiles"
[cmake] Not searching for unused variables given on the command line.
[cmake] -- Boost version: 1.53.0
[cmake] -- Found the following Boost libraries:
[cmake] --   program_options
[cmake] --   system
[cmake] --   filesystem
[cmake] --   unit_test_framework
[cmake] --   date_time
[cmake] --   thread
[cmake] --   regex
[cmake] -- Root dir: /dls_sw/prod/tools/RHEL7-x86_64/log4cxx/0-10-0dls2/prefix
[cmake] 
[cmake] Looking for log4cxx headers and libraries
[cmake] -- Include directories: /dls_sw/prod/tools/RHEL7-x86_64/log4cxx/0-10-0dls2/prefix/include/log4cxx
[cmake] -- Libraries: /dls_sw/prod/tools/RHEL7-x86_64/log4cxx/0-10-0dls2/prefix/lib/liblog4cxx.so
[cmake] 
[cmake] Looking for ZeroMQ headers and libraries
[cmake] -- Include directories: /usr/include
[cmake] -- Libraries: /lib64/libzmq.so
[cmake] 
[cmake] Looking for pcap headers and libraries
[cmake] 
[cmake] Looking for blosc headers and libraries
[cmake] 
[cmake] Looking for kafka headers and libraries
[cmake] 
[cmake] Searching for HDF5
[cmake] Determining odin-data version
[cmake] -- Searching Blosc Root dir: /dls_sw/prod/tools/RHEL7-x86_64/c-blosc/1-14-2/prefix
[cmake] -- Found Blosc: /dls_sw/prod/tools/RHEL7-x86_64/c-blosc/1-14-2/prefix/lib/libblosc.so
[cmake] -- Found Kafka: /usr/lib64/librdkafka.so
[cmake] -- HDF5_ROOT set: /dls_sw/prod/tools/RHEL7-x86_64/hdf5/1-10-5/prefix
[cmake] -- Git describe version: 1.4.0-59-g18d7a0c-dirty
[cmake] -- major:1 minor:4 patch:0 sha1:g18d7a0c-dirty
[cmake] -- short version: 1.4.0
[cmake] -- HDF5 include files:  /dls_sw/prod/tools/RHEL7-x86_64/hdf5/1-10-5/prefix/include
[cmake] -- HDF5 libs:           /dls_sw/prod/tools/RHEL7-x86_64/hdf5/1-10-5/prefix/lib/libhdf5.so/dls_sw/prod/tools/RHEL7-x86_64/hdf5/1-10-5/prefix/lib/libhdf5_hl.so
[cmake] -- HDF5 defs:           
[cmake] -- HDF5 include files:  /dls_sw/prod/tools/RHEL7-x86_64/hdf5/1-10-5/prefix/include
[cmake] -- HDF5 libs:           /dls_sw/prod/tools/RHEL7-x86_64/hdf5/1-10-5/prefix/lib/libhdf5.so/dls_sw/prod/tools/RHEL7-x86_64/hdf5/1-10-5/prefix/lib/libhdf5_hl.so
[cmake] -- HDF5 defs:           
[cmake] -- Configuring done
[cmake] -- Generating done
[cmake] -- Build files have been written to: /scratch/work/tools/RHEL7-x86_64/odin-data/vscode_build

I would like to use a different version of cmake than is installed in /usr/bin/cmake. When I set cmake.cmakePath, making my full settings.json the following:

{
    "cmake.cmakePath": "/dls_sw/prod/tools/RHEL7-x86_64/cmake/3-9-6/prefix/bin/cmake",
    "cmake.generator": "Unix Makefiles",
    "cmake.buildDirectory": "/scratch/work/tools/RHEL7-x86_64/odin-data/vscode_build",
    "cmake.installPrefix": "vscode_prefix",
    "cmake.sourceDirectory": "/scratch/work/tools/RHEL7-x86_64/odin-data",
    "cmake.configureSettings": {
        "HDF5_ROOT": "/dls_sw/prod/tools/RHEL7-x86_64/hdf5/1-10-5/prefix",
        "LOG4CXX_ROOT_DIR": "/dls_sw/prod/tools/RHEL7-x86_64/log4cxx/0-10-0dls2/prefix",
        "BLOSC_ROOT_DIR": "/dls_sw/prod/tools/RHEL7-x86_64/c-blosc/1-14-2/prefix"
    }
}

I get this output:

[variant] Loaded new set of variants
[kit] Successfully loaded 2 kits from /home/mef65357/.local/share/CMakeTools/cmake-tools-kits.json
[main] Configuring folder: odin-data 
[rollbar] Unhandled exception: Unhandled Promise rejection: Post-folder-open Error: connect ENOENT /tmp/cmake-server-0.247112383440653 {"folder":{"uri":{"$mid":1,"fsPath":"/scratch/work/tools/RHEL7-x86_64/odin-data","external":"file:///scratch/work/tools/RHEL7-x86_64/odin-data","path":"/scratch/work/tools/RHEL7-x86_64/odin-data","scheme":"file"},"name":"odin-data","index":0}}

(If I comment out the cmake.cmakePath, it works, as in the first snippet.)

Expected:

I would expect this to work as it does if I run the full command on the command line:

$ cd /scratch/work/tools/RHEL7-x86_64/odin-data/vscode_build
$ /dls_sw/prod/tools/RHEL7-x86_64/cmake/3-9-6/prefix/bin/cmake -DHDF5_ROOT=/dls_sw/prod/tools/RHEL7-x86_64/hdf5/1-10-5/prefix -DLOG4CXX_ROOT_DIR=/dls_sw/prod/tools/RHEL7-x86_64/log4cxx/0-10-0dls2/prefix -DBLOSC_ROOT_DIR=/dls_sw/prod/tools/RHEL7-x86_64/c-blosc/1-14-2/prefix -DCMAKE_INSTALL_PREFIX=../vscode_prefix ..
-- Boost version: 1.53.0
-- Found the following Boost libraries:
--   program_options
--   system
--   filesystem
--   unit_test_framework
--   date_time
--   thread
--   regex
--   chrono
--   atomic

Looking for log4cxx headers and libraries
-- Root dir: /dls_sw/prod/tools/RHEL7-x86_64/log4cxx/0-10-0dls2/prefix
using pkgconfig
-- Checking for module 'log4cxx'
--   No package 'log4cxx' found
-- Include directories: /dls_sw/prod/tools/RHEL7-x86_64/log4cxx/0-10-0dls2/prefix/include/log4cxx
-- Libraries: /dls_sw/prod/tools/RHEL7-x86_64/log4cxx/0-10-0dls2/prefix/lib/liblog4cxx.so

Looking for ZeroMQ headers and libraries
-- Include directories: /usr/include
-- Libraries: /lib64/libzmq.so

Looking for pcap headers and libraries

Looking for blosc headers and libraries
-- Searching Blosc Root dir: /dls_sw/prod/tools/RHEL7-x86_64/c-blosc/1-14-2/prefix
-- Found Blosc: /dls_sw/prod/tools/RHEL7-x86_64/c-blosc/1-14-2/prefix/lib/libblosc.so

Looking for kafka headers and libraries
-- Found Kafka: /usr/lib64/librdkafka.so

Searching for HDF5
-- HDF5_ROOT set: /dls_sw/prod/tools/RHEL7-x86_64/hdf5/1-10-5/prefix
Determining odin-data version
-- Git describe version: 1.4.0-59-g18d7a0c-dirty
-- major:1 minor:4 patch:0 sha1:g18d7a0c-dirty
-- short version: 1.4.0
-- HDF5 include files:  /dls_sw/prod/tools/RHEL7-x86_64/hdf5/1-10-5/prefix/include
-- HDF5 libs:           /dls_sw/prod/tools/RHEL7-x86_64/hdf5/1-10-5/prefix/lib/libhdf5.so/dls_sw/prod/tools/RHEL7-x86_64/hdf5/1-10-5/prefix/lib/libhdf5_hl.so
-- HDF5 defs:           
-- HDF5 include files:  /dls_sw/prod/tools/RHEL7-x86_64/hdf5/1-10-5/prefix/include
-- HDF5 libs:           /dls_sw/prod/tools/RHEL7-x86_64/hdf5/1-10-5/prefix/lib/libhdf5.so/dls_sw/prod/tools/RHEL7-x86_64/hdf5/1-10-5/prefix/lib/libhdf5_hl.so
-- HDF5 defs:           
-- Found Doxygen: /dls_sw/prod/tools/RHEL7-x86_64/defaults/bin/doxygen (found version "1.8.13") found components:  doxygen dot 
-- Configuring done
-- Generating done
-- Build files have been written to: /scratch/work/tools/RHEL7-x86_64/odin-data/vscode_build

Platform and Versions

Other Notes/Information

Thanks!

GDYendell commented 4 years ago

I am using the Remote Developement extension to work from home. I thought I would remote into my work machine properly and run VSCode there to see if I could reproduce the problem. It did not work and since doing this I can no longer get the build working at all. If i comment out the cmakePath again it makes no difference; I always get the following:

[main] Building folder: odin-data 
[rollbar] Unhandled exception: Unhandled Promise rejection: configure Error: connect ENOENT /tmp/cmake-server-0.5592704707103693 {}

If I do Ctrl-Shift-P Cmake: Configure. The Post-folder-open appears to happen if I click the prompt to configure after reloading the window.

bobbrow commented 4 years ago

This sounds a lot like #1137. Are you able to use a newer version of cmake? There seems to be an issue with cmake server with the Remote SSH extension.

bobbrow commented 4 years ago

Linking #603 here as well.

GDYendell commented 4 years ago

Using cmake 3.17.0 seems to work. Swapping back to 3.9.6 (and using clear cache and reconfigure) breaks it again. Thanks!

I don't think this is just a Remote Development problem, though. If I remote to my machine (NoMachine + ssh -X) and run VSCode there, I get the same behaviour; it works with 3.17.0 and it does not with 3.9.6.

Is there any way to catch this and give a reasonable error about the cmake version?

bobbrow commented 4 years ago

If I had a list of all the broken versions of CMake, we could probably do this. 😉 Probably the better thing to do is promote the latest version of CMake when an older one is detected. I think 3.15 is a good minimum version at this point.

GDYendell commented 4 years ago

I think an error saying try CMake 3.15+ would be great.