vscode-cmake-tools icon indicating copy to clipboard operation
vscode-cmake-tools copied to clipboard

No cache object found when manually configuring build folder before cmake-tools

Open mortenfc opened this issue 1 year ago • 2 comments

Brief Issue Summary

Only way to get rid of the error [rollbar] Unhandled exception: Unhandled Promise rejection: Post-folder-open Error: No cache object found [object Object]

Is to remove build folder and then ask cmake-tools to configure without configuring with terminal.

What I tried:

  • Reset Cmake Tool Extension
  • rm -rf build && cmake -C CMakeConfig/linux_gcc7.cmake --preset=gcc7_linux_x86_64 -DAMSR_BUILD_TESTING=ON -DAMSR_BUILD_TEST2020=ON -DAMSR_BUILD_DOC=ON -DAMSR_BUILD_EXAMPLE=ON
    -DBULLSEYE_ENABLE=ON -DAMSR_BUILD_BENCHMARK=ON -DCMAKE_CXX_FLAGS=(string join ' ' (cmake -LA -N . | grep CMAKE_CXX_FLAGS_INIT |
    cut -d= -f2) -- "-Wfatal-errors") -DAMSR_BUILD_TEST2020=ON -DAMSR_BUILD_TESTING=ON -DCMAKE_CXX_FLAGS_DEBUG="-g -O0"

We have a LOT of presets and targets. A gazillion .jsons are created, might be related

CMake Tools Diagnostics

No response

Debug Log

No response

Additional Information

No response

mortenfc avatar Oct 17 '24 08:10 mortenfc

@mortenfc Thank you for posting this issue. If you reopen the project a bit and then configure it in the terminal does it work? Can you provide a simple reproduction of the project and some detailed reproduction steps to help us quickly investigate this issue?:)

v-frankwang avatar Oct 18 '24 06:10 v-frankwang

That's gonna be hard. perhaps you know some open source repo with a lot of targets and prefixes? Then I can play around with that

mortenfc avatar Oct 18 '24 12:10 mortenfc

@gcampbell-msft Can you help find a: https://github.com/microsoft/vscode-cmake-tools/issues/4132#issuecomment-2422410463source code repository mentioned by a user? He will use the library we provided to reproduce the problem.

v-frankwang avatar Oct 21 '24 03:10 v-frankwang

@mortenfc There are a couple of large open source projects that we use commonly for testing. Here are two: https://github.com/Kitware/CMake, https://github.com/ninja-build/ninja

gcampbell-msft avatar Oct 21 '24 16:10 gcampbell-msft

I figured out removing <build_dir>/.cmake/api and then reconfiguring is enough to fix the problem. Perhaps, in short term, the user should be told to try and remove that instead of the mysterious " No cache object found "

mortenfc avatar Dec 06 '24 14:12 mortenfc

@mortenfc Thanks for looking into this and We're happy to see your issue resolved. We'll wait for more polls before posting your suggestion!

Yingzi1234 avatar Dec 13 '24 10:12 Yingzi1234

@mortenfc We also have this setting: cmake.deleteBuildDirOnCleanConfigure that deletes the entire folder when a clean is performed.

gcampbell-msft avatar Dec 16 '24 14:12 gcampbell-msft

Okay. That is not desirable to me as bunch of cached things exist in build dir, mainly clangd index files which takes over an hour to generate.

mortenfc avatar Dec 16 '24 17:12 mortenfc

@mortenfc Got it, that makes sense, thanks for the insight, in that case, I think I'll re-open this issue and mark it as an enhancement with the idea that we can possibly give some remediation suggestions in the output message rather than simply "No cache object found".

gcampbell-msft avatar Dec 17 '24 14:12 gcampbell-msft