microsoft / microsoft/vscode-cpptools

Support for generic GCC toolchains

Offen
#6,798 8 Kommentare 17 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

embedded Feature Request Language Service
Vorherrschende Sprache
TypeScript
Sterne
6.2k
Forks
1.7k
Ø Merge
14 Std. 46 Min.
Gemergte PRs (30 T.)
61

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit der Behandlung von compilerPath in c_cpp_properties.json und der Ausgabe von C/C++: Log Diagnostics, insbesondere mit der Erkennung des -dumpmachine-Ziels. Verfolge, wie das avr-Ziel „Unhandled default compiler target value detected“ erreicht; als abgeschlossen gilt die Bereitstellung von Standards, Include-Pfaden und vordefinierten Makros für eingebettete Toolchains durch generische GCC-Ziele mit ordnungsgemäßem IntelliSense.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
cpp, typescript
Bereich
compilers, devtools, embedded-iot
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.