Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMakePresets.json can't inherit from preset in CMakeUserPresets.json #4059

Open
michaelbjerking opened this issue Sep 12, 2024 · 19 comments · May be fixed by #4081
Open

CMakePresets.json can't inherit from preset in CMakeUserPresets.json #4059

michaelbjerking opened this issue Sep 12, 2024 · 19 comments · May be fixed by #4081
Assignees
Labels
bug a bug in the product regression used to work and no longer does. Regressions are typically high priority
Milestone

Comments

@michaelbjerking
Copy link

Brief Issue Summary

When trying to select a preset in UI the below error is printed i "output"

[preset] Preset unittest-gcc9 in CMakePresets.json can't inherit from preset unittest in CMakeUserPresets.json
[preset] Preset unittest-clang in CMakePresets.json can't inherit from preset unittest in CMakeUserPresets.json

CMake Tools Diagnostics

{
  "os": "linux",
  "vscodeVersion": "1.93.0",
  "cmtVersion": "1.19.51",
  "configurations": [
    {
      "folder": "/home/mbjerking/workspace/test",
      "cmakeVersion": "3.25.20230103",
      "configured": true,
      "generator": "Ninja",
      "usesPresets": true,
      "compilers": {
        "C": "/usr/bin/gcc",
        "CXX": "/usr/bin/g++"
      }
    }
  ],
  "cpptoolsIntegration": {
    "isReady": false,
    "hasCodeModel": false,
    "activeBuildType": "",
    "buildTypesSeen": [],
    "requests": [],
    "responses": [],
    "partialMatches": [],
    "targetCount": 0,
    "executablesCount": 0,
    "librariesCount": 0,
    "targets": []
  },
  "settings": [
    {
      "communicationMode": "automatic",
      "useCMakePresets": "always",
      "configureOnOpen": true
    }
  ]
}

Debug Log

[main] Configuring project: test 
[main] Saving open files before configure/build
[driver] Removing /home/mbjerking/workspace/test/build/unittest-gcc9/CMakeCache.txt
[driver] Removing /home/mbjerking/workspace/test/build/unittest-gcc9/CMakeFiles
[driver] Start configure 
[driver] Running pre-configure checks and steps
[driver] NOTE: You are configuring with preset unittest-gcc9, but there are some overrides being applied from your VS Code settings.
[cmakefileapi-driver] Configuring using preset
[cmakefileapi-driver] Invoking CMake /opt/bin/cmake with arguments ["-DBUILD_UNIT_TESTS=ON","-DPLATFORM=unittest","-DPLATFORMS=unittest;posix","-DCMAKE_C_STANDARD=11","-DCMAKE_CXX_STANDARD=17","-DCMAKE_C_COMPILER=/usr/bin/gcc","-DCMAKE_CXX_COMPILER=/usr/bin/g++","-DCMAKE_INSTALL_PREFIX=/home/mbjerking/workspace/test/build/unittest-gcc9","-DCMAKE_BUILD_TYPE=Debug","-DCMAKE_CXX_FLAGS= ","--graphviz=harald.dot","-S/home/mbjerking/workspace/test","-B/home/mbjerking/workspace/test/build/unittest-gcc9","-G","Ninja"]
[proc] Executing command: /opt/bin/cmake -DBUILD_UNIT_TESTS=ON -DPLATFORM=unittest "-DPLATFORMS=unittest;posix" -DCMAKE_C_STANDARD=11 -DCMAKE_CXX_STANDARD=17 -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ -DCMAKE_INSTALL_PREFIX=/home/mbjerking/workspace/test/build/unittest-gcc9 -DCMAKE_BUILD_TYPE=Debug "-DCMAKE_CXX_FLAGS= " --graphviz=harald.dot -S/home/mbjerking/workspace/test -B/home/mbjerking/workspace/test/build/unittest-gcc9 -G Ninja
[proc]   with environment: {"USER":"mbjerking","VSCODE_WSL_EXT_LOCATION":"/mnt/c/Users/AU000XQX/.vscode/extensions/ms-vscode-remote.remote-wsl-0.88.3","SHLVL":"1","WT_PROFILE_ID":"{2c4de342-38b7-51cf-b940-2309a097f518}","HOME":"/home/mbjerking","DBUS_SESSION_BUS_ADDRESS":"unix:path=/run/user/1000/bus","WSL_DISTRO_NAME":"Ubuntu","WAYLAND_DISPLAY":"wayland-0","LOGNAME":"mbjerking","NAME":"Code","WSL_INTEROP":"/run/WSL/1209_interop","PULSE_SERVER":"unix:/mnt/wslg/PulseServer","_":"/mnt/c/Program Files/Microsoft VS Code/bin/code","TERM":"xterm-256color","PATH":"/home/mbjerking/.vscode-server/bin/4849ca9bdf9666755eb463db297b69e5385090e3/bin/remote-cli:/opt/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Program Files (x86)/Common Files/Oracle/Java/javapath:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Windows/System32/OpenSSH/:/mnt/c/Program Files/RedHat/Podman/:/mnt/c/Program Files/Microsoft VS Code/bin:/mnt/c/Python39:/mnt/c/Python39/Scripts:/mnt/c/ProgramData/chocolatey/bin:/mnt/c/Program Files/Meld/:/mnt/c/Program Files/PuTTY/:/mnt/c/Program Files/dotnet/:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/mnt/c/Users/AU000XQX/AppData/Local/Programs/Python/Python311/Scripts/:/mnt/c/Users/AU000XQX/AppData/Local/Programs/Python/Python311/:/mnt/c/Users/AU000XQX/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/AU000XQX/AppData/Local/Programs/Microsoft VS Code/bin:/mnt/c/Users/AU000XQX/AppData/Local/Programs/Git/cmd:/mnt/c/Program Files/Meld:/snap/bin","WT_SESSION":"63af4f28-9203-4dd4-9c67-9183ac41e962","XDG_RUNTIME_DIR":"/run/user/1000/","DISPLAY":":0","LANG":"C.UTF-8","SHELL":"/bin/bash","PWD":"/mnt/c/Program Files/Microsoft VS Code","WSL2_GUI_APPS_ENABLED":"1","HOSTTYPE":"x86_64","WSLENV":"ELECTRON_RUN_AS_NODE/w:WT_SESSION:WT_PROFILE_ID:\n","VSCODE_CWD":"/mnt/c/Program Files/Microsoft VS Code","VSCODE_NLS_CONFIG":"{\"userLocale\":\"en\",\"osLocale\":\"en\",\"resolvedLanguage\":\"en\",\"defaultMessagesFile\":\"/home/mbjerking/.vscode-server/bin/4849ca9bdf9666755eb463db297b69e5385090e3/out/nls.messages.json\",\"locale\":\"en\",\"availableLanguages\":{}}","VSCODE_HANDLES_SIGPIPE":"true","EDITOR":"gedit","LS_COLORS":"rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:","LESSCLOSE":"/usr/bin/lesspipe %s %s","LESSOPEN":"| /usr/bin/lesspipe %s","PS1":"\\[\\033[01;31m\\]\\h \\[\\033[01;32m\\]\\w\\[\\033[01;34m\\]$(parse_git_branch) \\[\\033[00m\\]>","DEBUG_HOST":"172.24.144.1","XDG_DATA_DIRS":"/usr/local/share:/usr/share:/var/lib/snapd/desktop","VSCODE_AMD_ENTRYPOINT":"vs/workbench/api/node/extensionHostProcess","VSCODE_HANDLES_UNCAUGHT_ERRORS":"true","MOTD_SHOWN":"update-motd","ELECTRON_RUN_AS_NODE":"1","VSCODE_IPC_HOOK_CLI":"/run/user/1000/vscode-ipc-43cbc652-3c4d-4f4b-bb63-6ef84040a525.sock","VSCODE_L10N_BUNDLE_LOCATION":""}
[cmake] -- Found Python3: /usr/bin/python3.8 (found version "3.8.10") found components: Interpreter 
[cmake] -- Using Python: /usr/bin/python3.8
[cmake] -- The CXX compiler identification is GNU 9.4.0
[cmake] -- The C compiler identification is GNU 9.4.0
[cmake] -- Detecting CXX compiler ABI info
[cmake] -- Detecting CXX compiler ABI info - done
[cmake] -- Check for working CXX compiler: /usr/bin/g++ - skipped
[cmake] -- Detecting CXX compile features
[cmake] -- Detecting CXX compile features - done
[cmake] -- Detecting C compiler ABI info
[cmake] -- Detecting C compiler ABI info - done
[cmake] -- Check for working C compiler: /usr/bin/gcc - skipped
[cmake] -- Detecting C compile features
[cmake] -- Detecting C compile features - done
[cmake] -- PLATFORM="unittest" ; PLATFORMS="unittest;posix"
[cmake] -- CMAKE_C_COMPILER="/usr/bin/gcc"
[cmake] -- CMAKE_CXX_COMPILER="/usr/bin/g++"
[cmake] -- Using ccache
[cmake] -- Configuring done
[cmake] -- Generating done
[cmake] Generate graphviz: /home/mbjerking/workspace/test/build/unittest-gcc9/harald.dot
[cmake] -- Build files have been written to: /home/mbjerking/workspace/test/build/unittest-gcc9
[cmakefileapi-parser] Read reply folder: /home/mbjerking/workspace/test/build/unittest-gcc9/.cmake/api/v1/reply
[cmakefileapi-parser] Found index files: ["cache-v2-361ad6efacb5b83a0076.json","cmakeFiles-v1-88e67a5254f2ce2e9112.json","codemodel-v2-302de44623d38be025b1.json","directory-.-Debug-f5ebdc15457944623624.json","index-2024-09-12T05-58-37-0263.json","toolchains-v1-2781238ec0fa0b9996f9.json"]
[extension] [2464] cmake.cleanConfigure finished (returned {"result":0,"resultType":0})
[extension] [3351] cmake.selectConfigurePreset started
[presetController] Start selection of configure presets. Found 11 presets.
[presetController] Opening configure preset selection QuickPick
[preset] Preset unittest-gcc9 in CMakePresets.json can't inherit from preset unittest in CMakeUserPresets.json
[preset] Preset unittest-clang in CMakePresets.json can't inherit from preset unittest in CMakeUserPresets.json

Additional Information

CMakeLists.txt
CMakePresets.json
CMakeUserPresets.json

@michaelbjerking
Copy link
Author

I cleaned up my user setting's to no longer see "[driver] NOTE: You are configuring with preset unittest-gcc9,"

The user setting has the following cmake option:
"cmake.configureOnOpen": true,
"cmake.options.statusBarVisibility": "visible",
"cmake.loggingLevel": "debug",

I can select presets in status bar, but get e.g below log, and then that preset disappears from statusbar selection:
[preset] Preset unittest-gcc9 in CMakePresets.json can't inherit from preset unittest in CMakeUserPresets.json

@gcampbell-msft
Copy link
Collaborator

@michaelbjerking In the presets and UserPresets that you linked, there are no presets in UserPresets, they are only in presets. I wasn't able to repro with the files you dropped, is it possible those files need to be updated to match the problem you're describing?

@michaelbjerking
Copy link
Author

michaelbjerking commented Sep 12, 2024

The error can be reproduce with latest VsCode 1.93 (we only got the problem after latest update) and the inheritance problem occurred just by having the "empty" CMakeUserPresets file (version only).

@gcampbell-msft
Copy link
Collaborator

@michaelbjerking Interesting, in that case, I wasn't able to reproduce the problem, it seemed to work as expected for me. @v-frankwang Could you also help us try to reproduce?

@michaelbjerking
Copy link
Author

michaelbjerking commented Sep 13, 2024

Just reproduced bug in WSL workspace with only the above 3 file, using VsCode 1.93.1.

> lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.3 LTS
Release:        22.04
Codename:       jammy

Two extension:
twxs.cmake
ms-vscode.cmake-tools

Local setting in "%AppData%/Roaming/Code/User/settings:"

{
    "workbench.colorTheme": "Default Dark Modern",
    "security.allowedUNCHosts": [
        "wsl.localhost",
        "NAS2022"
    ],
    "window.zoomLevel": 2,
    "diffEditor.ignoreTrimWhitespace": false,
    "cmake.configureOnOpen": true,
    "cmake.options.statusBarVisibility": "visible",
    "cmake.loggingLevel": "debug"
}

@gcampbell-msft gcampbell-msft added bug a bug in the product regression used to work and no longer does. Regressions are typically high priority labels Sep 13, 2024
@gcampbell-msft
Copy link
Collaborator

@michaelbjerking What is the impact of the possible bug? Does it block you from using certain features? Or is it just an output message?

@michaelbjerking
Copy link
Author

Each build entry you select (which then post the error), is then deleted from the dropdown list, and you can't select it again.

@gcampbell-msft
Copy link
Collaborator

@michaelbjerking Interesting, I'm not seeing the error output, and I actually don't see that string anywhere in the codebase, but I am seeing the behavior of it not showing up in the dropdown list after selecting, so I'll investigate. THanks!

@gcampbell-msft
Copy link
Collaborator

@michaelbjerking To clarify for our investigation. You are able to successfully use the configuration or build preset upon initial selection of the preset, but then, if you try to change it and then come back to that same preset, you have to either restart VS Code, resave your presets file, etc, in order to do that?

@michaelbjerking
Copy link
Author

Yes, I didn't find a way to get "preset droplist" back, so would have to restart VS Code.

@gcampbell-msft
Copy link
Collaborator

@michaelbjerking I've just confirmed that you can workaround this in a much easier way simply by re-saving either your CMakePresets.json or your CMakeUserPresets.json.

@gcampbell-msft
Copy link
Collaborator

@michaelbjerking I have a PR open here: #4081, please feel free to take a look and even download the vsix from the description to help test. You'll have to download the .zip and then change the file extension to .vsix in order to install and test.

@michaelbjerking
Copy link
Author

Tested cmake-tools.vsix and the dropdown list works, and I don't get any [preset] errors in output.

@G-Harmon
Copy link

I might be hitting this as well. How do I tell if I have an affected version? (sorry if this is obvious; I'm very new to VS Code world.)
extension says:

Published   2016-04-16, 15:09:51
Last released   2024-09-19, 13:28:43
Last updated   2024-09-19, 12:21:03
Identifier   ms-vscode.cmake-tools

@v-frankwang
Copy link
Collaborator

@G-Harmon You'll need to wait until this PR: is merged to be unaffected on this PR : #4081 merged version and on subsequent versions, and currently the only time you don't run into this problem is when installing the CMake Tools extension through the vsix mentioned in comment: #4059 (comment) above.

@danfabo
Copy link

danfabo commented Sep 25, 2024

I had the same problem, #4081 fixed it for me as well.

@v-frankwang
Copy link
Collaborator

@danfabo Thanks so much for your comment, and glad your issue was resolved!

@sejapou
Copy link

sejapou commented Sep 26, 2024

Had the same issue and #4081 solved it.

@v-frankwang
Copy link
Collaborator

@sejapou Thanks so much for your comment, and glad your issue was resolved!

@gcampbell-msft gcampbell-msft added this to the 1.20 milestone Oct 1, 2024
@gcampbell-msft gcampbell-msft self-assigned this Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug a bug in the product regression used to work and no longer does. Regressions are typically high priority
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

6 participants