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

PIO fails to generate compile_commands.json for an MBED project #3378

Closed
1 task done
asmfreak opened this issue Feb 13, 2020 · 3 comments
Closed
1 task done

PIO fails to generate compile_commands.json for an MBED project #3378

asmfreak opened this issue Feb 13, 2020 · 3 comments
Assignees
Labels
Milestone

Comments

@asmfreak
Copy link

asmfreak commented Feb 13, 2020

What kind of issue is this?

  • 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:

$ uname -a
Linux  5.4.7-arch1-1 #1 SMP PREEMPT Tue, 31 Dec 2019 17:20:16 +0000 x86_64 GNU/Linux

PlatformIO Version (platformio --version):

$ pio --version
PlatformIO, version 4.2.1a1

Description of problem

This is a continuation of #2990. Compilation DB fails to be generated if used on MBED project.

Steps to Reproduce

  1. mkdir someproject
  2. pio project init
  3. Paste platformio.ini from below
  4. Paste mbed_app.json from below
  5. Run pio -t compiledb

Actual Results

Processing BASE (board: bluepill_f103c8; framework: mbed; platform: ststm32)
----------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/bluepill_f103c8.html
PLATFORM: ST STM32 5.7.0 > BluePill F103C8
HARDWARE: STM32F103C8T6 72MHz, 20KB RAM, 64KB Flash
DEBUG: Current (stlink) External (blackmagic, jlink, stlink)
PACKAGES: 
 - framework-mbed 5.51401.191023 (5.14.1) 
 - toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)
Collecting mbed sources...
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 13 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Building compilation database .pio/build/BASE/compile_commands.json
TypeError: changed_since_last_build_node() takes exactly 4 arguments (3 given):
  File "[HOME]/.platformio/packages/tool-scons/script/../engine/SCons/Script/Main.py", line 1346:
    _exec_main(parser, values)
  File "[HOME]/.platformio/packages/tool-scons/script/../engine/SCons/Script/Main.py", line 1309:
    _main(parser)
  File "[HOME]/.platformio/packages/tool-scons/script/../engine/SCons/Script/Main.py", line 1091:
    nodes = _build_targets(fs, options, targets, target_top)
  File "[HOME]/.platformio/packages/tool-scons/script/../engine/SCons/Script/Main.py", line 1283:
    jobs.run(postfunc = jobs_postfunc)
  File "[HOME]/.platformio/packages/tool-scons/script/../engine/SCons/Job.py", line 111:
    self.job.start()
  File "[HOME]/.platformio/packages/tool-scons/script/../engine/SCons/Job.py", line 410:
    task.executed()
  File "[HOME]/.platformio/packages/tool-scons/script/../engine/SCons/Script/Main.py", line 226:
    SCons.Taskmaster.OutOfDateTask.executed(self)
  File "[HOME]/.platformio/packages/tool-scons/script/../engine/SCons/Taskmaster.py", line 310:
    t.release_target_info()
  File "[HOME]/.platformio/packages/tool-scons/script/../engine/SCons/Node/FS.py", line 2990:
    self.changed(allowcache=True)
  File "[HOME]/.platformio/packages/tool-scons/script/../engine/SCons/Node/FS.py", line 3241:
    has_changed = SCons.Node.Node.changed(self, node)
  File "[HOME]/.platformio/packages/tool-scons/script/../engine/SCons/Node/__init__.py", line 1460:
    if _decider_map[child.changed_since_last_build](child, self, prev_ni):

Expected Results

Generated compile_commands.json

If problems with PlatformIO Build System:

The content of platformio.ini:

[platformio]
include_dir = include
lib_dir = lib
test_dir = test
build_cache_dir = .cache

[env]
lib_ignore = 
	mbed-rtos, mbed-LWIP, mbed-events, mbed-fs,
	mbed-net, mbed-netsocket, mbed-rpc, mbed-dsp,
	mbed-USBHost, mbed-USBDevice
upload_protocol = stlink
platform = ststm32
build_flags =
    -D MBED_BUILD_PROFILE_RELEASE
    -D MBED_FAULT_HANDLER_DISABLED
    -D ARDUINOJSON_USE_ARDUINO_STRING=0
    -D ARDUINOJSON_ENABLE_STD_STRING=1

[bluepill]
board = bluepill_f103c8
f_cpu = 72000000L
framework = mbed
lib_deps = modrob_mbed

[env:BASE]
board = ${bluepill.board}
board_build.f_cpu = ${bluepill.f_cpu}
framework = ${bluepill.framework}
build_flags = ${env.build_flags}

mbed_app.json

{
  "macros": [
    "NDEBUG=1"
  ],
  "target_overrides": {
    "*": {
      "target.console-uart": false,
      "platform.stdio-flush-at-exit": false,
      "platform.stdio-convert-newlines": false
    }
  },
  "requires": ["bare-metal", "minimal-printf"]
}
@ivankravets ivankravets added this to the 4.2.1 milestone Feb 13, 2020
@valeros
Copy link
Member

valeros commented Feb 14, 2020

Hi @asmfreak ! Thanks for the report. I followed every step you described above and wasn't able to reproduce the issue neither on Ubuntu 18.04 nor on Windows. Is there anything special about your environment?

@asmfreak
Copy link
Author

My setup should be pretty standard.
I'm running Arch Linux.
I had my version of PIO installed in a virtual environment with Python 2 from an Atom plugin and kept it since.

$ . ~/.platformio/penv/bin/activate
$ python --version 
Python 2.7.17

Should I try recreating the venv with Python 3?

@ivankravets
Copy link
Member

Thanks for the report! The PIO Core 4.2.1 is planned for release today.

chenrui333 pushed a commit to Homebrew/homebrew-core that referenced this issue Feb 18, 2020
- [x] Have you followed the [guidelines for contributing](https://github.com/Homebrew/homebrew-core/blob/master/CONTRIBUTING.md)?
- [x] Have you checked that there aren't other open [pull requests](https://github.com/Homebrew/homebrew-core/pulls) for the same formula update/change?
- [x] Have you built your formula locally with `brew install --build-from-source <formula>`, where `<formula>` is the name of the formula you're submitting?
- [x] Is your test running fine `brew test <formula>`, where `<formula>` is the name of the formula you're submitting?
- [x] Does your build pass `brew audit --strict <formula>` (after doing `brew install <formula>`)?

-----

* Improved VSCode template with special ``forceInclude`` field for direct includes via ``-include`` flag ([issue #3379](platformio/platformio-core#3379))
* Improved support of PIO Home on card-sized PC (Raspberry Pi, etc.) ([issue #3313](platformio/platformio-core#3313))
* Froze "marshmallow" dependency to 2.X for Python 2 ([issue #3380](platformio/platformio-core#3380))
* Fixed "TypeError: unsupported operand type(s)" when system environment variable is used by project configuration parser ([issue #3377](platformio/platformio-core#3377))
* Fixed an issue when Library Dependency Finder (LDF) ignores custom "libLDFMode" and "libCompatMode" options in [library.json](http://docs.platformio.org/page/librarymanager/config.html)
* Fixed an issue when generating of compilation database "compile_commands.json" does not work with Python 2.7 ([issue #3378](platformio/platformio-core#3378))

Closes #50367.

Signed-off-by: Rui Chen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants