CLion build stalls when including external library (arduino)

Hi there,

I have been struggling for several days now. I love using CLion, but I have the problem whereby I can take code that compiles just fine in the Arduino IDE and copy it into a Platformio project in CLion setup for the Arduino and it will not compile:

====================[ Build | Production | uno ]================================
"C:\Program Files\JetBrains\CLion 2021.3.3\bin\cmake\win\bin\cmake.exe" --build C:\Users\320051849\CLionProjects\untitled6\cmake-build-uno --target Production

Even more frustrating is that the build just hangs, without giving me any feedback as to what the problem is. I’ve narrowed it down to the inclusion of a library header file - when this is included, the build hangs. In this case it is a library for controlling a LCD from the arduino. I get the same issue whether it is the UTFT library, the LCD_WIKI libraries or (most recently) the DFRobot_GDL library - all result in the same problem. Bear in mind that these are example HW libraries that all work fine in the Arduino IDE!

I’ve tried both copying the library files to the /lib directory as well as adding the Arduino library path to the platformio.ini file. In both cases, after re-init, CLion is able to find the libraries, but the #include statement causes the build to hang. If I remove the #include statement, the build completes successfully and the program is uploaded to the Arduino, but of course I then have no support for my LCD!

I’ve also tried switching from the default compiler to the AVR-GCC and AVR-G++ compilers from the AVR toolchain but it makes no difference.

I’m tearing out what little hair I have left at this stage. I don’t want to give up on the CLion/PlatformIO combination, but I am out of ideas at this stage and I can’t afford to waste any more time on this.
Has anyone else perhaps experienced this issue, or could lend some advice? It would be most gratefully received!

I am using the latest version of PlatformIO and also of CLion, my board is an Arduino Mega (I also have an Uno, same problem) and I am running Windows 10.

Can you upload the project for reproducabiblity?

Sure, thanks for taking the time to look!

Link here

That seems to be a 404.


Ah, a typo in the URL. Apologies. Should be working now.

Well I definitely can’t reproduce that on CLion 2021.2, even with all includes activated…

What version of CLion are you using?

That is bizarre. Thank you for trying. I am using CLion 2021.3.3. I am using the 30-day trial and was about to purchase a full license, but now I am not sure I will do that.

Incidentally, if I copy the files over to VS Code, it compiles just fine as well, and the compiler actually gives me some output (warnings, etc) and failure errors if there is something wrong, instead of the hanging empty build screen in CLion.

It’s a shame as I am already very familiar with PyCharm and so I was enjoying using CLion, but I think I will just switch over to VSCode. It’s free and it works.

Hm I just upgraded my CLion version to the latest 2021.3.3 and I’m too starting to see strange behavior – the output of the compile task (pio run) only seems to appear after the process has exited, and is not live-updated as previously. While building still works for me, after pressing the build button, it just seems to hang there for 5 seconds

until it finishes building and all output appears at once

This should definitely be reported at under the PlatformIO tag.

OK, thanks for your help. I am glad to hear that you were able to more-or-less reproduce the issue. I’ll report the bug.