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

Compiledb behavior, include-toolchains doesn't apply to private libraries #4762

Closed
1 task done
pvbaudin opened this issue Oct 19, 2023 · 1 comment
Closed
1 task done

Comments

@pvbaudin
Copy link
Contributor

pvbaudin commented Oct 19, 2023

  • PlatformIO Core.
    If you’ve found a bug, please provide an information below.

Configuration

Operating system:
mac os 13.5.2

PlatformIO Version (platformio --version):
PlatformIO Core, 6.1.11

Description of problem

Following instructions from here
If you set COMPILATIONDB_INCLUDE_TOOLCHAIN and run pio run -t compiledb, you generate compile_commands.json toolchains are included with files in src but any private libraries compiled from the lib directory do not have the toolchains included.

This causes a bit of a headache using clangd in neovim as the LSP gives errors for system libraries included in private libraries. One solution is to manually include toolchain paths in library.json build flags, but I imagine the expected behavior of the COMPILATIONDB_INCLUDE_TOOLCHAIN flag should be to include the toolchains for all files compiled in the project

Steps to Reproduce

  1. Following instructions from here and set include toolchains to true
  2. pio run -t compildedb
  3. inspect generated compile_commands.json and observe that libraries in the lib directory dont include toolchains in their compiler commands

Actual Results

toolchains not included in private library build command

impact: clangd LSP in neovim can't find c standard libraries when viewing private library files

Expected Results

toolchains included in private library build command
clangd properly resolved standard libraries included in private library source files

If problems with PlatformIO Build System:

The content of platformio.ini:

[env:uno]
platform = atmelavr
board = uno
framework = arduino
extra_scripts = pre:clang_helper.py

Source file to reproduce issue:
minimal project demonstrating issue here
compile_commands.json

pvbaudin added a commit to pvbaudin/platformio-core that referenced this issue Oct 20, 2023
…ns to compiledb include paths and added a call to it in the library building step for user defined libraries, allowing the automatic inclusion of toolchains in private lib compiledb generation
pvbaudin added a commit to pvbaudin/platformio-core that referenced this issue Oct 20, 2023
…ns to compiledb include paths and added a call to it in the library building step for user defined libraries, allowing the automatic inclusion of toolchains in private lib compiledb generation
@pvbaudin
Copy link
Contributor Author

Proposed fix in PR #4763

@ivankravets ivankravets added this to the 6.1.12 milestone Nov 16, 2023
ivankravets pushed a commit that referenced this issue Nov 16, 2023
Issue #4762 separated out the optional addition of toolchains to compiledb include paths and added a call to it in the library building step for user defined libraries, allowing the automatic inclusion of toolchains in private lib compiledb generation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants