microsoft / microsoft/vscode-cpptools

Support for generic GCC toolchains

Abierto
#6,798 8 comentarios 17 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

embedded Feature Request Language Service
Lenguaje dominante
TypeScript
Estrellas
6.2k
Forks
1.7k
Merge medio
14 h 46 min
PR fusionados (30 d)
61

Descripción

Type: LanguageService

Describe the bug

  • OS and Version: Windows 10 20H2
  • VS Code Version: 1.52.1
  • C/C++ Extension Version: 1.2.0-insiders
  • Does this issue involve using SSH remote to run the extension on a remote machine?: No
  • A clear and concise description of what the bug is, including information about the workspace (i.e. is the workspace a single project or multiple projects, size of the project, etc).

Many different embedded platforms use GCC as their compiler. This presents a problem for the extension, since it only supports x86, x64, arm and arm64, while there are many embedded platforms (just to name a few: AVR and ESP32). It's impossible to keep track of them all, so we should create a generic GCC target, which will only do the minimal things to get IntelliSense working (get C and C++ standards, get include folders, get predefined macros, etc.)

Steps to reproduce

Create a C++ configuration with a compiler that targets an embedded platform.

Expected behavior

Proper IntelliSense for embedded toolchains.

Logs
cpptools/didChangeCppProperties
Attempting to get defaults from C++ compiler in "compilerPath" property: 'C:/Users/nghuu/.platformio/packages/toolchain-atmelavr/bin/avr-gcc.exe'
Querying compiler for default C++ language standard using command line: "C:/Users/nghuu/.platformio/packages/toolchain-atmelavr/bin/avr-gcc.exe" -x c++ -E -dM nul
Querying compiler for default C language standard using command line: "C:/Users/nghuu/.platformio/packages/toolchain-atmelavr/bin/avr-gcc.exe" -x c -E -dM nul
Querying compiler's default target using command line: "C:/Users/nghuu/.platformio/packages/toolchain-atmelavr/bin/avr-gcc.exe" -dumpmachine
Compiler returned default target value: avr

Unhandled default compiler target value detected: avr

Attempting to get defaults from compiler found on the machine: 'C:\llvm-mingw\bin\gcc.exe'
Querying compiler for default C++ language standard using command line: "C:\llvm-mingw\bin\gcc.exe" -x c++ -E -dM nul
Querying compiler for default C language standard using command line: "C:\llvm-mingw\bin\gcc.exe" -x c -E -dM nul
Querying compiler's default target using command line: "C:\llvm-mingw\bin\gcc.exe" -dumpmachine
Unhandled default compiler target value detected: 
No suitable compiler found. Please set the "compilerPath" in c_cpp_properties.json.
Attempting to get defaults from C compiler in "compilerPath" property: 'C:/Users/nghuu/.platformio/packages/toolchain-atmelavr/bin/avr-gcc.exe'
Attempting to get defaults from compiler found on the machine: 'C:\llvm-mingw\bin\gcc.exe'
No suitable compiler found. Please set the "compilerPath" in c_cpp_properties.json.

Screenshots

Unable to locate avr include files because the default include paths aren't set up properly:
image

Additional context

Default search paths for avr-gcc:

install: c:\users\nghuu\.platformio\packages\toolchain-atmelavr\bin\../lib/gcc/avr/5.4.0/
programs: =c:/users/nghuu/.platformio/packages/toolchain-atmelavr/bin/../libexec/gcc/avr/5.4.0/;c:/users/nghuu/.platformio/packages/toolchain-atmelavr/bin/../libexec/gcc/;c:/users/nghuu/.platformio/packages/toolchain-atmelavr/bin/../lib/gcc/avr/5.4.0/../../../../avr/bin/avr/5.4.0/;c:/users/nghuu/.platformio/packages/toolchain-atmelavr/bin/../lib/gcc/avr/5.4.0/../../../../avr/bin/
libraries: =c:/users/nghuu/.platformio/packages/toolchain-atmelavr/bin/../lib/gcc/avr/5.4.0/;c:/users/nghuu/.platformio/packages/toolchain-atmelavr/bin/../lib/gcc/;c:/users/nghuu/.platformio/packages/toolchain-atmelavr/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/avr/5.4.0/;c:/users/nghuu/.platformio/packages/toolchain-atmelavr/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/

The include paths are there, but the extension isn't grabbing it.

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza con el manejo de compilerPath en c_cpp_properties.json y la salida de C/C++: Log Diagnostics, especialmente con la detección del destino de -dumpmachine. Sigue cómo el destino avr llega a “Unhandled default compiler target value detected”; se considera terminado cuando los destinos GCC genéricos proporcionen estándares, rutas de inclusión y macros predefinidas para toolchains embebidas, con IntelliSense adecuado.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
cpp, typescript
Área
compilers, devtools, embedded-iot
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.