mbed compiler has suddenly broken the behaviour of #include search

02 Oct 2018

Hello mbed

Users are reporting that previously working programs no longer compile in the online IDE.

Reason seems to be that behaviour of compiler with regards to where it looks for included header files has changed.

For example, we have had #include "My_settings.h" in a library. That file has been something the users create inside their project to define behaviour of project (because mbed online ide does not have over-sessions-persistent compiler macros)

Now, we have to make that "../My_settings.h" or the build fails. Everything we have made so far has stopped building properly due to this.

I suspect this is the cause of some other errors I see others reporting here with other targets.

Past 2 years there have been several similar incidents where the behaviour of mbed online compiler internals has been changed & build broken all of a sudden. Every time I get a flood of cries from our users. So far all of those changes have been bugs, ie. they have been reverted. If this change was announced somewhere, I certainly did not notice.

mbed: please test properly with BOTH mbed OS2 and OS5 on SEVERAL targets before you deploy systemwide changes.

03 Oct 2018

Hi Jonne,

We test with many targets with many releases of Mbed 2 and Mbed OS 5 when we update the tools for the online compiler. The bug you mention is not something we would have announced, as it's a bug. In case you were not aware, the online compiler and Mbed CLI share the same tools implementation. With Mbed OS 5.10, we introduced many optimizations around the implementation of #include.

Have you wondered how you could always include any header from any C file? That's because we were adding every directory in your project as an include path. That eventually got really big, and windows has a limit on the size of a command line (32KB). Mbed CLI has to run on windows, so I applied some sensible optimizations, such as only adding include paths to known header files which omits many empty, C or docs only directories from the include search path.

Based on how your including your header file, I don't think this optimization would affect you. However, you have an include issue. This is probably an unintended side effect of changing code: bugs. I would be happy to look into it for you. It would really help speed up the process if you could provide me with a simple reproducer program.

Do you have such a reproducer?


03 Oct 2018

Hi Jimmy

I already fixed this with a workaround, so you'll have to revert the workaround to see what happens


Just import that, go to PokittoLib folder, open Pokitto_settings.h

Change line #include "../My_settings.h" to #include "My_settings.h" (that is what it was before)

As for the other problems, I will admit most had to do with NXP LPC targets and I do not know what is the policy, who tests and what, is it up to NXP or mbed. All I know several LPC targets were broken for a long time after the migration to OS5. I'll have to retry them and give you examples. This was basic blinkies not working due to things like straight jump into software_init_hook from startup although RTOS was missing.

- Jonne

27 Dec 2018

Nice post.

13 Mar 2019

Hi Jonne, Thanks for detailed report on this issue.

It seems to have been resolved. Could you please let us know if you still see this issue?


Naveen, team mbed.