platformio-core icon indicating copy to clipboard operation
platformio-core copied to clipboard

Compilation database references non-existent file

Open adbancroft opened this issue 3 years ago • 0 comments

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

You can erase any parts of this template not applicable to your Issue.


Configuration

Operating system:

Win10 x64

PlatformIO Version (platformio --version):

PlatformIO Core, version 6.1.4

Description of problem

For an Arduino compatible project, the .ino files are pre-processed into a temporary CPP file. That file is deleted by the PIO build after compilation (there is no flag to keep it: https://community.platformio.org/t/how-to-preserve-keep-temporary-ino-cpp-file/24824)

pio run --target compiledb references this file, which makes the compilation database useless.

Steps to Reproduce

  1. Create a project with framework=arduino
  2. Rename main.cpp to project_name.ino (this is the norm for the Arduino IDE)
  3. Run pio run --target compiledb

Actual Results

compile_commands.json references a non-existent file: C:\\dev\\compiledb_bug\\src\\compiledb_bug.ino.cpp

Expected Results

compile_commands.json references real files (preferably the original INO files)

If problems with PlatformIO Build System:

The content of platformio.ini:

[env:megaatmega2560]
platform = atmelavr
board = megaatmega2560
framework = arduino```

adbancroft avatar Sep 17 '22 14:09 adbancroft