PlatformIO Community

Unable to build sketch: \platformio.exe" does not exist

Hi.
I recently reinstall my windows, then PlatformIO.
The first time I’ve done it, it work out of the box. This time I am unable to build my sketch. Console return:

Executing task in folder 200812-053037-due: c:\Users\[myuser]\OneDrive\Documents\PlatformIO\Projects\200812-053037-due\platformio.exe run <

The terminal process failed to launch: Path to shell executable "c:\Users\<[myuser]\OneDrive\Documents\PlatformIO\Projects\200812-053037-due\platformio.exe" does not exist.

I tried with import a project and create a new one with the same resutl.

win10 home, 120.2212.31.0
vs Code 1.48.0
PlatformIO core 4.3.4 home 3.2.3

I might be making this up, but I’m sure I read (or dreamt!) that the one-drive folder was causing problems.

Can you (humour me!) and create a new folder elsewhere, say c:\users\YOUR_NAME\temp for example, and copy the one-drive based project, in its entirety, into the new folder. Open the project there and try to build it in the new location.

If that works, then you might want to create a new folder for PlatformIO projects, and configure that as the new default location.

Are you using VSCode or Atom to build projects? Or the command line?

If using the editor, open a terminal from within the editor, with the project open which doesn’t compile, and try these commands:

pio run
pio run --target upload

They will compile the project first. If that works, the second command will attempt to upload it. Assuming these work, then the problem is in the VSCode or Atom editor. Perhaps uninstalling and reinstalling PlatformIO will help?

HTH

Cheers,
Norm.

1 Like

It is most probable that onedire cause the problem. I already add another but that I cannot open file via path user/documents, I add to sue use/onedrive/documents (on this tread: cant acces documents).

I tried to remove all onedrive with win10Debloater, no success.

also tried to put the folder outside onedrive folder, and also tried it with terminal pio run:

pio : The term 'pio' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ pio run  --target upload
+ ~~~
+ CategoryInfo          : ObjectNotFound: (pio:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

Was that terminal the one inside VSCode, or outside it? Inside gives access to the pio command, outside needs either the PlatformIO-core installing, or, you need to install the commands from within VSCode itself, where there is an option to do so.

Please try the pio commands from the terminal inside VSCode. Terminal->New Terminal from the menubar, or, CTRL+SHIFT+# in the editor itself. Thanks.

Cheers,
Norm.

1 Like

that was inside vs code…

You’re not imagining things - or if you are, we bother are! :laughing: OneDrive is a pain in the :face_with_symbols_over_mouth: :face_with_symbols_over_mouth: :face_with_symbols_over_mouth: at times - and not just because it is hard to remove cleanly.

@djnitrof I would try changing the default shell in VSCode back to the command prompt (as it is currently powershell) and see if that makes any difference to the pio commands being recognised.

image

I does not seems to help.

If it was inside VSCode, then you should have the pio command available. It sounds to me like your reinstall failed somewhere. Let’s see if we can install the shell commands:

https://docs.platformio.org/en/latest/core/installation.html#windows

Please follow those instructions and add the PlatformIO folder to your path, then start a new commandline (windows key, R, type cmd, click ok) then cd to your source folder and try pio run again.

This is outside the editor this time please. If you still get unrecognised command errors then PlatformIO is most likely a failed install - as far as I can see.

Cheers,
Norm.

1 Like

been able to run PIO, but it fail to compile, seem that it cannot see correctly the include path again. even if I change it to add onedrive in platformio.ini file.

Ok, progress. That’s good, especially as I’m not a Windows guru! :wink:

Can you please post your platformio.ini and your source code please. Between 3 bacticks as before, thanks.

Cheers,
Norm.

update: with a new project, pio run compile.
If I want to use library, I have to edit ini file and all libraries path:

    lib_extra_dirs = ~/OneDrive/Documents/Arduino/libraries

Then, intelliscence and compile work.

But my project do not compile, but it does on arduino compiler…
This is a large progect tith 10 libraries and 900 line long…

It gave me a ultra long list of compiler error, starting with a :

 pedalBoard.ino:392:12: error: 'const char select' redeclared as different kind of symbol  

but, as I said, it compile with arduino.

I’m surprised that it compiles with the Arduino to be honest. That error message implies that the code has a variable named select compiled in the same unit/file/header with a different data type. If I do this:

void setup() {
    int fred;
    char *fred;
}

The compiler complains. Not quite in the same manner though, so maybe there’s something else afoot!

Would you mind zipping up your latest PlatformIO version of the sketch and sending it to me directly please? Assuming there’s nothing confidential in it of course. I’d need the whole lot please.

One thing about lib_extra_dirs, the docs state that this This is a not direct path to a library with source code. It should be a path to storage that contains libraries grouped by folders. For example, D:\PlatformIO\extra\libraries but not D:\PlatformIO\extra\libraries\FooLibrary .

So if your version of FooLibrary has it’s source code in the folder ~/OneDrive/Documents/Arduino/libraries then that’s fine, but if the code for the library is in the ~/OneDrive/Documents/Arduino/libraries folder itself, the it’s not going to work.

Actually, does Windows recognise the use of ~ as the current user’s home directory these days? And does it recognise forward slashes in the Linux manner as directory separators? Perhaps you need to set this instead:

lib_extra_dirs = C:\Users\YOUR_USER\OneDrive\Documents\Arduino\libraries

The format you posted above is in Linux/Mac (?) format, not Windows, as far as I recall.

Cheers,
Norm.

1 Like

not so sensible program, but large one… :stuck_out_tongue: with 5 of my libraries…

But investigating a little more, starting with a new compiling sketch, I tried to add one by one libraries, by now it seem to be ADC_Sampler that is not compiling.

I got only warning, but it still fail…

\OneDrive\Documents\Arduino\libraries\ADC_Sampler\src/ADC_Sampler.h:60:13: warning: 'void enableChX(uint8_t)' defined but not used [-Wunused-function]
static void enableChX(uint8_t pin){
         ^~~~~~~~~
Linking .pio\build\due\firmware.elf
.pio\build\due\libbba\libADC_Sampler.a(ADC_Sampler.cpp.o): In function `_GLOBAL__sub_I__ZN17ADC_Sampler_class11numChannelsE':
ADC_Sampler.cpp:(.text.startup._GLOBAL__sub_I__ZN17ADC_Sampler_class11numChannelsE+0x18): undefined reference to `ADC_sequencer_size'
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\due\firmware.elf] Error 1

The warning is telling you that a function, which has been declared, hasn’t actually been called. That is not causing your error.

This is, however, undefined reference to 'ADC_sequencer_size'. The code is referencing ADC_sequencer_size but it has not been defined.

Cheers,
Norm.

1 Like

oups… did see that… :stuck_out_tongue: to small text. I forgot an extern declaration…

I think I will try to add in the new project section per section the old code to see if I can find witch par is buggy…

[UPDATE] It seems that PIO compiler is very much more sensible that arduino one…
Going step by step, there was the select variable that put as redefine in another symbole, that was part of the SAM core, is was not causing problem before, but changin name fix that.

Also, PIO is very much more sensible to declaration order, I add to change order of many declaration and add some prototype to make it compile.

But now at least, in command promt, it compile.

Still, it still not working in VS code terminal…

1 Like

Hooray! :slightly_smiling_face:

So, we know that it works. This implies that thEre’s a problem in VSCode if that is complaining about platformio.exe not being found.

Restart VSCode and import the Arduino blink sketch, if you have it lying around somewhere, otherwise create it anew.

Does that minimal example compile in the editor? If so, try your own big project now. It should work.

If the blink won’t compile in the editor, I’m thinking there’s a Windows problem to blame. I’m not a Windows guru… :neutral_face:

Cheers,
Norm.

1 Like

no, it does not with a blank sketch…

Is it producing the same error?

I’m afraid you have exhausted my knowlege of Windows and PlatformIO if so. Sorry. :sob: I do not understand how or why it works in command line mode but not from the editor itself. Weird.

Hopefully, someone else here has some hints?

Cheers,
Norm.

Thanks for your time. I’ve open an issus into the Git repo .

Wish I could get help there… Anyway, it no so bad to have compiler into another windows, easier to read lot of text…

Have to learn how to upload and debug dow…

Thanks again.

Regards.

Nitrof

1 Like

Hi,
I also have had a similair problem. Re install did not solve it.
When compiling the simple Arduino blink example I got
" The terminal process failed to launch: Path to shell executable “c:\Users\name\Documents\PlatformIO\Projects\test6\pio.exe” does not exist. "
Very easy to solve however. In directory “C:\Users\name.platformio\penv\Scripts” I copied
“platformio.exe” to a new file “pio.exe”.
Realy very odd. On two other win10 computers platformio worked fine after installation without problems…

win 10 home (2020-04-23)
ver 1909
OS version 18363.1256
vs Code 1.52.1
PlatformIO core 5.0.4 home 3.3.1

B R / Goran