RTEMS WAF compile_commands.json generation for BSP, user app and kernel

Hello everyone, I’ve been struggling for a few last days to generate a compile_commands.json file using WAF. I’m working on Windows. Are there any examples or solutions to enable basic code navigation? I also have the option to use the Microsoft C/C++ extension, but it requires precisely configuring include paths and defines.

Thanks in advance.

I tried adding waf’s clang_compilation_database.py as documented in the top of it but I got an error I did not understand:

No function 'clangdb_i386/pc686' defined in /opt/work/chris/rtems/kernel/rtems.git/wscript

I suggest as the next step asking Thomas the waf maintainer what the error is and how to handle it?

1 Like

Yes, thank you, this will be a very useful option. I also have a question for you, as I understand you are one of the RTEMS developers. I’m curious about which IDE your team uses and whether you use IntelliSense. How can one set up an environment with minimal hassle to enable code navigation and autocompletion?

I can only speak for myself about a workflow. I use the same workflow and tools on FreeBSD, Linux, MacOS and even Windows. It is:

  1. SSH
  2. tmux
  3. Emacs

My use of Emacs goes back to the early 1990s and it is not the important. There are a lot of great editors around. The important bit is only text terminals. I use to use X windowing and a GUI desktop and then I started to work part time for a while in the early 2000s. I wanted to be able to walk out of an office and pick up remotely. I could connect to my desktop machine but I could not get to my editor and get it to save files. Things like RDP did not exist. In the end I decided to give away the GUI and desktop and only use text terminals. It is a small amount of time to change but I not go back.

I use a MacBook as a terminal and I work only with ssh and tmux sessions. I can on the other side of world or a plane and performance is great and usable. The MacBook handles the web, email and chats.

Any updates on this? If there’s a solution it would be good to share it here so others can find it.

I’ve had success using bear (GitHub - rizsotto/Bear: Bear is a tool that generates a compilation database for clang tooling. · GitHub) to generate a compile_commands.json during the build process: bear -- ./waf build

Depending on the target and language server used, further fixups to the compile_commands.json may be required (i.e. the implicit GCC include directories may need to be added explicitly to the compile_commands.json)

Nice and thanks for letting us know.

Hey @amar does it work on FreeBSD for you? It maybe something in the FreeBSD port of bear.

What do you mean? Is there a problem? I’ve used bear on FreeBSD for multiple projects I did try it with RTEMS years ago but ran into no problems.

What’s going on?

If I run bear -- ./waf build in rtems.git on FreeBSD it never completes and I have to stop it. I end up with a massive number of processes running.

I’ll try to do that this week I just realised I don’t have any tools built anymore. I’ll have to do that first just rearranging some things.