Skip to content

include all libraries in compilation database #2600

Open
@Shoxx98

Description

@Shoxx98

Describe the request

clangd-based projects often use compilation databases for definition linking.
The most convenient setup to set up for developing firmware for arduino-based microcontrollers in neovim currently is to have a workflow also including lspconfig, arduino-language-server, clangd and arduino-cli. However, this does not work so well, as the library linking during editing is not fully there , so the workflow gets disrupted by not working goto_definition functionality and code completion.
If you want to have this obligatory functionality working, you would have to ditch the arduino-language-server and move to compilation databases generated by arduino-cli or platformio.
However, both lack the feature to link a complete set of system libraries, so the issue persists on the alternatives.
E.g.: If you try to #include <stdlib.h> in any file, it will not be found during code editing. I have not yet confirmed if the code generated by arduino-cli even works using this setup, but, looking at these issues, I have very little hope.

The workaround used by Visual Studio (and potentially the arduino IDEs) generates their own files to link everything, but their approach could change and is not processed by clangd (as it should be!).

Apparently, a workaround currently exists, but is imo difficult to setup (as I have not succeeded in doing so) and is, well, only a workaround.

related issues:
#1286
Softmotions/acdb#2

Describe the current behavior

arduino-cli compile -b arduino:sam:arduino_due_x --only-compilation-database --build-path=$PWD/build - does not link to all libraries used to compile the project

Arduino CLI version

arduino-cli Version: 0.35.3-arch Commit: 95cfd65

Operating system

Linux

Operating system version

6.8.9-4-cachyos

Additional context

No response

Issue checklist

  • I searched for previous requests in the issue tracker
  • I verified the feature was still missing when using the nightly build
  • My request contains all necessary details

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions