microsoft / vscode-go

An extension for VS Code which provides support for the Go language. We have moved to https://github.com/golang/vscode-go
Other
5.93k stars 648 forks source link

Incorrect CC and CXX on vs-code #3213

Closed iamshreeram closed 4 years ago

iamshreeram commented 4 years ago

What version of Go, VS Code & VS Code Go extension are you using?

Describe the bug

vs-code is using different CC and CXX from what is configured in my system. Is there a way to configure it manually?

Steps to reproduce the behavior:

  1. Go to 'Terminal' of vscode and enter go env
  2. C and C++ compilers are different from what is in my system.
  3. Compilers in my vscode terminal - CC="x86_64-apple-darwin13.4.0-clang" and CXX="x86_64-apple-darwin13.4.0-clang++".
  4. Compilers on my system are these - CC="clang" and CXX="clang++"
  5. Compilers used by vscode are not available on my mac. I don't know where this information is pulled from.
  6. There is no way i could update these setting / preference in vs-code.
hyangah commented 4 years ago

@iamshreeram The extension itself don't set those environment variables, but inherit from what VS Code itself sees. Are those CC and CXX environment variables set in any of your login shell (https://code.visualstudio.com/docs/editor/integrated-terminal#_why-are-there-duplicate-paths-in-the-terminals-path-environment-variable-andor-why-are-they-reversed) or in the terminal app where you launched the code app for the first time? You can check that by inspecting "Developer: Toggle Developer Tools" -> From the "Console" tab, query process.env.CC or process.env.CXX. If they are undefined, they were not set.

The next thing to check is whether other extensions are setting them - this can be done by disabling all other extensions, and checking the process.env.CC.

Meanwhile you can set the environment variables used for tools by setting go.toolsEnvVars.

iamshreeram commented 4 years ago

@hyangah , Both process.env.CC and process.env.CXX are empty. They are returning undefined.

Thanks for go.toolsEnvVars. This is working.