Problems compiling with PlatformIO

You should not have to do that though. Someone should file an issue with Platformio. That is a bug.

1 Like

I was suspecting it :grin:
Iā€™m not sure I can fill a bug with enough information. Letā€™s wait to see if itā€™s something related to my own computer or if it happens to someone else.

(Edited from original context for migration purposes)

Agreed. So far we donā€™t have enough to go on to make a proper bug report.
Ideally weā€™d at least want steps to reproduce the problem.

@HomineLudens
I recently encountered a similar issue after updating my nxplpc version and made an issue about it on the PlatformIO forums.

I mentioned it to @jonne and he said itā€™s probably the same as this issue, and sure enough the fix that fixed this issue fixed my issue, so I think itā€™s an issue with the particular nxplpc version.

I updated from (I think) v3.3.something to v3.4.1, so Iā€™m guessing somewhere between those points the system broke.
I plan to follow it up assuming someone responds to my issue.
I may have to chase it on GitHub instead.

2 Likes

Good plan.

@Pharap

Iā€™m changing my mind again. If you ā€œInstallā€ a library through the manager in PIO, it gets copied to a .hidden directory.

Thereā€™s no other way but to go seek that dir copy the files over to your project etc.

I fail to see this as easy for a beginner

Am I totally misunderstandin the lib manager because like this (libs essentially hidden) how am I going to explain copy-pasting the platform.ini etc? Help, any advice welcome.

I donā€™t think it was hidden on Windows, but I could be wrong.
(I have ā€˜show hidden filesā€™ turned on so I often donā€™t notice if somethingā€™s supposed to be hidden.)

I can see that it would be hidden on Mac by default because of the leading dot (though Iā€™d argue thatā€™s a flaw in Macā€™s file system design - making anything prefixed with a dot hidden by default instead of just using file attributes).

To copy which files?

platformio.ini isnā€™t hidden.

Though Iā€™m guessing if Mac hides all folders begining with a dot then .pioenvs, .vscode, .travis.yml and .gitignore are probably all hidden on Mac?

Iā€™m sure a script could get around that though.
E.g. maybe an ā€˜after successful buildā€™ script could copy the .bin file up to the project folder.

I think a lot of our problems with ā€œhow to make this easy for beginnersā€ will be solvable by scripting.
Itā€™s usually easier to explain ā€œmove this file from this hidden folder into this other folderā€ to a computer than it is to a non-technical person.

Itā€™s almost impossible to find something thatā€™s easy for a beginner and still provides all the powertools that an advanced programmer would want/need.
Linking libraries in is difficult enough as it is even when you do know what youā€™re doing.

The Arduino IDE is easy for beginners to use, and we all know what most programmers think of the Arduino IDE - they bin it and use VSCode or Visual Studio instead.


Itā€™s imperative that we have a cross-platform C++11-capable IDE available.

If we settle for something that isnā€™t cross platform, thatā€™s a significant fraction of potential users gone.

If we settle for something that doesnā€™t have C++11 support then we have to be prepare to put up with all the people asking ā€œwhy doesnā€™t this game compile? why does it say ā€˜error: requires C++11ā€™?ā€.

So far I think that even with these minor setbacks VSCode + PlatformIO is easier to use than a full scale IDE like EmBitz because you donā€™t have to worry about build targets,
you just have different projects instead of different build targets.
And often you can just copy a project and rename it without having to fiddle about with any IDE menus.

The only other alternative to VSCode at the moment is @FMangaā€™s work on Code::Blocks.

We could perhaps look in to making some kind of makefile that will work with a larger IDE (e.g. Code::Blocks) or trying to get the custom GCC to work with something like VSCode,
but Iā€™m expecting either of those will be more work than trying to improve what weā€™ve already got.

(If EmBitz had been cross platform in the first place then we wouldnā€™t have to be worrying about any of this.)


Iā€™ll look more into how PlatformIO works and how to script it if I get chance, but Iā€™m trying to cut down on the number of projects I work on concurrently because I keep having to put things on hold.

I had stopped work on that since PlatformIO seamed to be the better solution. If itā€™s insufficient for some reason, based on my brief experience rooting through the Code::Blocks source code, I think itā€™d be easier to just make a VSCode plugin that includes GCC and the PokittoLib.

1 Like

I concur.

Lightweight editors like Atom and VSCode seem to be very popular with ā€˜hobbyistā€™ programmers at the moment.
(I presume theyā€™re still mainly using heavyweight IDEs in business/ā€˜professionalā€™ programing.)

I havenā€™t looked into how easy it is to make an extension for VSCode, but thatā€™s a possibility if we canā€™t iron out the issues with PIO.
(Though so far apart from this issue thatā€™s cropped up from updating the platform, I havenā€™t had any other problems with PlatformIO, so Iā€™m not in a hurry to drop it.)

Making our own extension would still be a fair bit of extra work though. Weā€™d have to decide if we were going to use just GCC for compiling or mix GCC and makefiles, and weā€™d need to develop an easy to use project settings format so people could have custom compiler flags (because frankly neither bare compiler settings or makefiles are beginner friendly).

(Maybe we could even take a leaf out of PlatformIOā€™s book and use SCons - programmatic Python scripts for build configuration.)

Iā€™m not in a hurry either, but thatā€™s because Iā€™m happy using emacs+make. :stuck_out_tongue:
I did not mean to say we should be ditching PlatformIO. I only suggested making an extension as the alternative to Code::Blocks if itā€™s ever decided that PlatformIO is a problem.

VSCode uses JSON files for configuration, that would be the more natural fit. Ideally, the extension would just handle the build process on its own and users wouldnā€™t have to mess with flags unless they really wanted to.

I didnā€™t take it that way.
I just wanted to clarify that my thoughts about making a VSCode extension shouldnā€™t imply that I want to get rid of PlatformIO.

I agree, itā€™s probably one of the better alternatives.

Iā€™m not a big fan of JSON because Iā€™m always being bitten by missing commas or having too many commas,
but if an API for manipulating JSON is built-in and there arenā€™t built-in APIs for other options (e.g. XML, INI, YAML) then itā€™ll probably have to be JSON.

But allowing Pokitto projects might need to include a config file (equivalent to the current platformio.ini) that specifies extra build flags, like -std=c++14 for people who want to go beyond C++11 and the dreaded -fpermissive to make Arduboy projects slightly easier to port.

Allowing such a file to be bundled with projects means that the experts can tweak the flags to their hearts content and the beginners wouldnā€™t have to worry - they can just rely on the config file that comes with the project they download to handle the flags for them.
(And of course, if the config doesnā€™t specify otherwise, default to -std=c++11.)

If thatā€™s the case, how do you do source level debugging? Command-line gdb?

1 Like

Emacs has gdb support built in.

Edit: isnā€™t debugging a paid feature in platformio? I tested debugging in VSCode using the Cortex plugin, works OK.

1 Like

Ah? Sounds good. Sure you didnā€™t start the 30 day PIO pro trial by mistake?

I didnā€™t install PIO at all, yet. I keep meaning to do so, but I havenā€™t had much time lately.

1 Like

The documentation indicates that you need an account but doesnā€™t mention needing to pay to use the debugger.
The pricing page on their website on the other hand does seem to indicate that the debugger is a paid for feature.

Personally I donā€™t use a proper debugger very much because Iā€™ve got used to not having one for AVR chips,
I tend to just print everything onto the screen when I run into a problem.
Even when writing C# I tend to print to the console for debugging more than I use the step feature.

This one? I would assume it could be used alongside PlatformIO.

I tend to rely on the debugger a lot. Partially because of habits from javascript, where you check for run-time errors instead of compile-time. Also, itā€™s hard to use print to debug code that needs to run a few hundred thousand times per second (emulator cores).

Yup.

2 Likes

Usually I put a conditional statement in place that specifically looks for invalid values, even if I do use a proper debugger.

If I get the time Iā€™ll look into whether it can be used alongside PlatformIO.

If I donā€™t get the time, maybe someone else reading this can check.