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

Selecting Clang as the kit compiles with /usr/bin/c++ (g++) #1233

Closed
CalebAdrianXYZ opened this issue May 11, 2020 · 6 comments · Fixed by #2309
Closed

Selecting Clang as the kit compiles with /usr/bin/c++ (g++) #1233

CalebAdrianXYZ opened this issue May 11, 2020 · 6 comments · Fixed by #2309
Labels
Feature: kits more info needed More info is needed from the community for us to properly triage and investigate.

Comments

@CalebAdrianXYZ
Copy link

Brief Issue Summary

I noticed that the binary c++ was being used for compilation with the clang kit as opposed to clang++ on Linux. Investigating this, I found that "scan for kits" populates an entry for clang with an empty CXX variable.

cmake-tools-kits.json is populated as follows:

[
  {
    "name": "Clang 10.0.0",
    "compilers": {
      "C": "/usr/bin/clang-10"
    }
  },
  {
    "name": "GCC 9.1.0",
    "compilers": {
      "C": "/usr/bin/gcc",
      "CXX": "/usr/bin/g++"
    }
  },
  {
    "name": "GCC 9.3.0",
    "compilers": {
      "C": "/usr/bin/gcc",
      "CXX": "/usr/bin/g++"
    }
  },
  {
    "name": "GCC for i686-w64-mingw32 9.3.0",
    "compilers": {
      "C": "/usr/bin/i686-w64-mingw32-gcc-9.3.0"
    }
  },
  {
    "name": "GCC for x86_64-pc-linux-gnu 9.3.0",
    "compilers": {
      "C": "/usr/bin/x86_64-pc-linux-gnu-gcc-9.3.0"
    }
  },
  {
    "name": "GCC for x86_64-w64-mingw32 9.3.0",
    "compilers": {
      "C": "/usr/bin/x86_64-w64-mingw32-gcc-9.3.0"
    }
  }
]

which clang++ reports /usr/bin/clang++ on my system.

Expected:

  1. Clang kit variable CXX is populated with /usr/bin/clang++ (or whatever is correct)
  2. Selecting Clang kit compiles with clang++

Apparent Behavior:

  1. Selecting Clang as the kit compiles with /usr/bin/c++

Platform and Versions

  • Operating System: Arch Linux
  • CMake Version: 3.17.2
  • VSCode Version: 1.44.2
  • CMake Tools Extension Version: 1.3.1
  • Compiler/Toolchain: clang 10.0.0
@andreeis
Copy link
Contributor

For some reason the extension is not finding your clang++ compiler.
Please share the log created during the scan for kits operation. It will contain the clang++ path that the extension is looking at ("Detected Clang compiler:").

@andreeis andreeis added Feature: kits more info needed More info is needed from the community for us to properly triage and investigate. labels May 13, 2020
@CalebAdrianXYZ
Copy link
Author

CMake Tools log

2020-05-15T20:37:17.798Z [debug] [kitsController] Rescanning for kits
2020-05-15T20:37:17.798Z [debug] [kit] Scanning for Kits on system
2020-05-15T20:37:17.800Z [debug] [kit] Skipping scan of not existing path /home/caleb/.local/bin
2020-05-15T20:37:17.800Z [debug] [kit] Found 0 kits in directory /home/caleb/.local/bin
2020-05-15T20:37:17.800Z [debug] [kit] Scanning directory /home/caleb/.scripts for compilers
2020-05-15T20:37:17.800Z [debug] [kit] Scanning directory /home/caleb/.bin for compilers
2020-05-15T20:37:17.800Z [debug] [kit] Scanning directory /home/caleb/.cargo/bin for compilers
2020-05-15T20:37:17.802Z [debug] [kit] Scanning directory /usr/local/sbin for compilers
2020-05-15T20:37:17.803Z [debug] [kit] Scanning directory /usr/local/bin for compilers
2020-05-15T20:37:17.803Z [debug] [kit] Scanning directory /usr/bin for compilers
2020-05-15T20:37:17.803Z [debug] [kit] Scanning directory /var/lib/flatpak/exports/bin for compilers
2020-05-15T20:37:17.803Z [debug] [kit] Scanning directory /usr/lib/jvm/default/bin for compilers
2020-05-15T20:37:17.803Z [debug] [kit] Scanning directory /usr/bin/site_perl for compilers
2020-05-15T20:37:17.803Z [debug] [kit] Scanning directory /usr/bin/vendor_perl for compilers
2020-05-15T20:37:17.804Z [debug] [kit] Scanning directory /usr/bin/core_perl for compilers
2020-05-15T20:37:17.814Z [debug] [kit] Found 0 kits in directory /home/caleb/.scripts
2020-05-15T20:37:17.814Z [debug] [kit] Found 0 kits in directory /home/caleb/.cargo/bin
2020-05-15T20:37:17.814Z [debug] [kit] Found 0 kits in directory /home/caleb/.bin
2020-05-15T20:37:17.814Z [debug] [kit] Found 0 kits in directory /usr/local/bin
2020-05-15T20:37:17.815Z [debug] [kit] Found 0 kits in directory /usr/local/sbin
2020-05-15T20:37:17.815Z [debug] [kit] Found 0 kits in directory /var/lib/flatpak/exports/bin
2020-05-15T20:37:17.818Z [debug] [kit] Found 0 kits in directory /usr/lib/jvm/default/bin
2020-05-15T20:37:17.818Z [debug] [kit] Found 0 kits in directory /usr/bin/site_perl
2020-05-15T20:37:17.818Z [debug] [kit] Found 0 kits in directory /usr/bin/vendor_perl
2020-05-15T20:37:17.820Z [debug] [kit] Found 0 kits in directory /usr/bin/core_perl
2020-05-15T20:37:17.842Z [debug] [kit] Testing Clang binary: /usr/bin/clang
2020-05-15T20:37:17.843Z [debug] [kit] Testing Clang binary: /usr/bin/clang
2020-05-15T20:37:17.852Z [debug] [kit] Testing Clang binary: /usr/bin/clang-10
2020-05-15T20:37:17.852Z [debug] [kit] Testing Clang binary: /usr/bin/clang-10
2020-05-15T20:37:17.885Z [debug] [kit] Testing GCC binary: /usr/bin/gcc
2020-05-15T20:37:17.908Z [debug] [kit] Testing GCC binary: /usr/bin/i686-w64-mingw32-gcc
2020-05-15T20:37:17.920Z [debug] [kit] Testing GCC binary: /usr/bin/i686-w64-mingw32-gcc-9.3.0
2020-05-15T20:37:17.998Z [debug] [kit] Testing GCC binary: /usr/bin/x86_64-pc-linux-gnu-gcc
2020-05-15T20:37:18.010Z [debug] [kit] Testing GCC binary: /usr/bin/x86_64-pc-linux-gnu-gcc-10.1.0
2020-05-15T20:37:18.021Z [debug] [kit] Testing GCC binary: /usr/bin/x86_64-w64-mingw32-gcc
2020-05-15T20:37:18.031Z [debug] [kit] Testing GCC binary: /usr/bin/x86_64-w64-mingw32-gcc-9.3.0
2020-05-15T20:37:18.048Z [debug] [kit] Detected GCC compiler: /usr/bin/x86_64-w64-mingw32-gcc-9.3.0
2020-05-15T20:37:18.048Z [debug] [kit] Detected GCC compiler: /usr/bin/x86_64-w64-mingw32-gcc
2020-05-15T20:37:18.048Z [debug] [kit] Detected GCC compiler: /usr/bin/x86_64-pc-linux-gnu-gcc-10.1.0
2020-05-15T20:37:18.049Z [debug] [kit] Detected GCC compiler: /usr/bin/x86_64-pc-linux-gnu-gcc
2020-05-15T20:37:18.049Z [debug] [kit] Detected GCC compiler: /usr/bin/i686-w64-mingw32-gcc-9.3.0
2020-05-15T20:37:18.049Z [debug] [kit] Detected GCC compiler: /usr/bin/i686-w64-mingw32-gcc
2020-05-15T20:37:18.050Z [debug] [kit] Detected GCC compiler: /usr/bin/gcc
2020-05-15T20:37:18.050Z [debug] [kit] Detected Clang compiler: /usr/bin/clang-10
2020-05-15T20:37:18.050Z [debug] [kit] Detected Clang compiler: /usr/bin/clang
2020-05-15T20:37:18.051Z [debug] [kit] Found 9 kits in directory /usr/bin
2020-05-15T20:37:18.051Z [info] [kit] Found Kit: Clang 10.0.0
2020-05-15T20:37:18.051Z [info] [kit] Found Kit: Clang 10.0.0
2020-05-15T20:37:18.051Z [info] [kit] Found Kit: GCC 10.1.0
2020-05-15T20:37:18.051Z [info] [kit] Found Kit: GCC for i686-w64-mingw32 9.3.0
2020-05-15T20:37:18.052Z [info] [kit] Found Kit: GCC for i686-w64-mingw32 9.3.0
2020-05-15T20:37:18.052Z [info] [kit] Found Kit: GCC for x86_64-pc-linux-gnu 10.1.0
2020-05-15T20:37:18.052Z [info] [kit] Found Kit: GCC for x86_64-pc-linux-gnu 10.1.0
2020-05-15T20:37:18.052Z [info] [kit] Found Kit: GCC for x86_64-w64-mingw32 9.3.0
2020-05-15T20:37:18.052Z [info] [kit] Found Kit: GCC for x86_64-w64-mingw32 9.3.0
2020-05-15T20:37:18.053Z [debug] [kitsController] Saving kits to /home/caleb/.local/share/CMakeTools/cmake-tools-kits.json
2020-05-15T20:37:18.053Z [debug] [kitsController] Saving new kits to /home/caleb/.local/share/CMakeTools/cmake-tools-kits.json
2020-05-15T20:37:18.054Z [debug] [extension] [8460] cmake.scanForKits finished (returned undefined)
2020-05-15T20:37:18.055Z [debug] [kit] Reading kits file /home/caleb/.local/share/CMakeTools/cmake-tools-kits.json
2020-05-15T20:37:18.067Z [info] [kit] Successfully loaded 7 kits from /home/caleb/.local/share/CMakeTools/cmake-tools-kits.json

@caradhras2
Copy link

Hi, I have the same issue, adding clang++ manually changes nothing. I noticed that cmake is called with DCMAKE_C++_COMPILER=clang++ instead of DCMAKE_CXX_COMPILER=clang++ which does not work.
gcc

@Eric-Brown
Copy link

I had the same issue as well. Currently working around the issue by manually changing the clang 10 entry in cmake-tools-kit.json to read:

  {
    "name": "Clang 10.0.1",
    "compilers": {
      "C": "/usr/local/bin/clang-10",
      "CXX": "/usr/local/bin/clang++" // Changed to path where clang++ is located
    }
  }

What's odd is that I only just started having this issue with clang-10 being selected as a kit.

@bobbrow
Copy link
Member

bobbrow commented May 20, 2020

@caradhras2 do you still have an issue if you change the "C++" property under "compilers" to "CXX" in your Kit?

@toohes
Copy link

toohes commented Jul 5, 2021

@Eric-Brown thank You.
Appending "CXX" line works for me.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Feature: kits more info needed More info is needed from the community for us to properly triage and investigate.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants