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

Always rebuilds sources with autodetected clang and ninja on linux. #2289

Closed
Ivan-Viktorov opened this issue Dec 14, 2021 · 7 comments · Fixed by #2352
Closed

Always rebuilds sources with autodetected clang and ninja on linux. #2289

Ivan-Viktorov opened this issue Dec 14, 2021 · 7 comments · Fixed by #2352
Labels
bug a bug in the product Feature: kits
Milestone

Comments

@Ivan-Viktorov
Copy link

Ivan-Viktorov commented Dec 14, 2021

Brief Issue Summary

On linux scan for kits founds /bin/clang++-X instead of /usr/bin/clang++-X, which breaks ninja (see ninja-build/ninja#1330 ninja-build/ninja#1400).

It would be nice, if scan for kits would prefer /usr/bin/compiler to /bin/compiler.

Steps to reproduce:

  • Get linux os, where /bin is symlink to usr/bin (fedora 35, for example).
  • Install clang
  • scan for kits
  • select clang kit (it would point to /bin/clang*)
  • try build a project
  • try build project one more time, it will rebuild all sources, even none was modified.

If you change path of clang compiler from /bin/clang to /usr/bin/clang in .local/share/CMakeTools/cmake-tools-kits.json, ninja stops to rebuild all sources and rebuilds only modified, as expected.

@bobbrow
Copy link
Member

bobbrow commented Dec 14, 2021

Thank you for reporting this. So is the problem just the usage of a symlink? In other words, if we do a realpath on it before setting it in the Kit, will that solve the problem?

@bobbrow bobbrow added bug a bug in the product Feature: kits labels Dec 14, 2021
@Ivan-Viktorov
Copy link
Author

In other words, if we do a realpath on it before setting it in the Kit, will that solve the problem?

I think yes. This should solve it.

@teonik
Copy link

teonik commented Jan 9, 2022

I stumbled upon the same problem. Manually changing clang's path in cmake-tools-kits.json, as Ivan-Viktorov suggested, seems to fix this issue.

@nidefawl
Copy link

I was having the same problem.

This should be fixed in vscode-cmake-tools.
ninja, cmake and clang just keep pointing fingers at each other and provide no fix.

@bobbrow
Copy link
Member

bobbrow commented Feb 1, 2022

realpath is actually not the solution here. clang++ and clang ultimately point to the same binary and if I realpath it, you can't compile C++ anymore without additional switches. I think the solution that will work better for this is to prioritize the paths we find that are first in the $PATH when we do our deduplication.

@bobbrow
Copy link
Member

bobbrow commented Feb 1, 2022

(I started working on a fix for this, BTW)

@bobbrow
Copy link
Member

bobbrow commented Mar 1, 2022

The fix for this issue is available in 1.10 "pre-release". You can help us validate it by:

  1. Opening the extensions panel in VS Code
  2. Selecting the CMake Tools extension
  3. Clicking the "Switch to Pre-release Version" button

image

@github-actions github-actions bot locked and limited conversation to collaborators Apr 3, 2022
@bobbrow bobbrow modified the milestones: On Deck, 1.10.0 Apr 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug a bug in the product Feature: kits
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants