Issues building with fresh marlin firmware and PlatformIO 2.2.1

Not sure what the issue is. I’ve tried removing and reinstalling PlatformIO multiple times and different marlin firmware’s and still the same error during building. Only this that has changed from before i was able to build is an update to PlatformIO, and a new processor which I don’t think would cause any issues.

CalledProcessError: Command '"C:\Users\Tony\.platformio\packages\toolchain-atmelavr\bin\avr-g++.exe" -D__MARLIN_FIRMWARE__ -D__MARLIN_DEPS__ -w -dM -E -x c++ buildroot/share/PlatformIO/scripts/common-dependencies.h' returned non-zero exit status 1.:

  File "C:\users\tony\.platformio\penv\lib\site-packages\platformio\builder\main.py", line 168:
    env.SConscript(item, exports="env")
  File "C:\Users\Tony\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py", line 598:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\Tony\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py", line 287:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\Marlin-bugfix-2.0.x\buildroot\share\PlatformIO\scripts\common-dependencies.py", line 327:
    apply_features_config()
  File "C:\Marlin-bugfix-2.0.x\buildroot\share\PlatformIO\scripts\common-dependencies.py", line 141:
    if not env.MarlinFeatureIsEnabled(feature):
  File "C:\Users\Tony\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Environment.py", line 219:      
    return self.method(*nargs, **kwargs)
  File "C:\Marlin-bugfix-2.0.x\buildroot\share\PlatformIO\scripts\common-dependencies.py", line 292:
    load_marlin_features()
  File "C:\Marlin-bugfix-2.0.x\buildroot\share\PlatformIO\scripts\common-dependencies.py", line 280:
    define_list = subprocess.check_output(cmd, shell=True).splitlines()
  File "C:\Users\Tony\.platformio\python3\lib\subprocess.py", line 411:
    **kwargs).stdout
  File "C:\Users\Tony\.platformio\python3\lib\subprocess.py", line 512:
    output=stdout, stderr=stderr)

That doesn’t look right. I’m a Linux user but I’m thinking that the path should be c:\users\tony\.platformio\... there’s a backslsh missing between “tony” and “.platformio”.

Can you check your %PATH% in control panel please.

Cheers,
Norm.

The misisng \ is just because of a missing format error, shows up when formatted as code.

@tonyhle, can you please provide the following info

"C:\Users\Tony\.platformio\packages\toolchain-atmelavr\bin\avr-g++.exe" -D__MARLIN_FIRMWARE__ -D__MARLIN_DEPS__ -w -dM -E -x c++ buildroot/share/PlatformIO/scripts/common-dependencies.h

in a PlatformIO CLI?

1 Like
pio system info
--------------------------  -----------------------------------------------------
PlatformIO Core             5.0.4
Python                      3.7.7-final.0
System Type                 windows_amd64
Platform                    Windows-10
File System Encoding        utf-8
Locale Encoding             cp1252
PlatformIO Core Directory   C:\Users\Tony\.platformio
PlatformIO Core Executable  C:\Users\Tony\.platformio\penv\Scripts\platformio.exe
Python Executable           c:\users\tony\.platformio\penv\scripts\python.exe
Global Libraries            0
Development Platforms       1
Tools & Toolchains          5
--------------------------  -----------------------------------------------------

What does the default_envs = ? line say in the platformio.ini
default_envs = mega2560

You’ve cloned from GitHub - MarlinFirmware/Marlin: Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine. with the default branch 2.0.x?
Yes

What is the output when you manually execute
"C:\Users\Tony\.platformio\packages\toolchain-atmelavr\bin\avr-g++.exe" -D__MARLIN_FIRMWARE__ -D__MARLIN_DEPS__ -w -dM -E -x c++ buildroot/share/PlatformIO/scripts/common-dependencies.h

https://pastebin.com/k7iW6K2S

That paste was auto-deleted, you can use https://hastebin.com/ instead?

tried hastebin didn’t work for me. https://pastebin.com/84XGX3ue this link should work

:sweat_smile: Pastebin is a quick deleter.

(Ctrl+S to save in hastebin, then the URL is updated at the top which is distributable)

hastebin won’t save my paste, getting server errors

Okay hm. Well the output shows that everything is good though. Does the program invocation still fail with CalledProcessError if you build normally now?

Does disabling any antivirus program that mightr be active change anything?

Yeah still getting the same error

CalledProcessError: Command 'avr-g++.exe -D__MARLIN_FIRMWARE__ -D__MARLIN_DEPS__ -w -dM -E -x c++ buildroot/share/PlatformIO/scripts/common-dependencies.h' returned non-zero exit status 1.:
  File "C:\users\tony\.platformio\penv\lib\site-packages\platformio\builder\main.py", line 168:
    env.SConscript(item, exports="env")
  File "C:\Users\Tony\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py", line 598:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\Tony\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py", line 287:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "D:\Marlin-2.0.x\buildroot\share\PlatformIO\scripts\common-dependencies.py", line 286:
    apply_features_config()
  File "D:\Marlin-2.0.x\buildroot\share\PlatformIO\scripts\common-dependencies.py", line 118:
    if not env.MarlinFeatureIsEnabled(feature):
  File "C:\Users\Tony\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Environment.py", line 219:
    return self.method(*nargs, **kwargs)
  File "D:\Marlin-2.0.x\buildroot\share\PlatformIO\scripts\common-dependencies.py", line 262:
    load_marlin_features()
  File "D:\Marlin-2.0.x\buildroot\share\PlatformIO\scripts\common-dependencies.py", line 250:
    define_list = subprocess.check_output(cmd, shell=True).splitlines()
  File "C:\Users\Tony\.platformio\python3\lib\subprocess.py", line 411:
    **kwargs).stdout
  File "C:\Users\Tony\.platformio\python3\lib\subprocess.py", line 512:
    output=stdout, stderr=stderr)

Aha but the path has changed. Before it contained the full path

Can you remove the .pio folder in the Marlin project and retry building?

Deleted the .pio folder and did a clean.

Results:

Verbose mode can be enabled via `-v, --verbose` option
CalledProcessError: Command 'avr-g++.exe -D__MARLIN_FIRMWARE__ -D__MARLIN_DEPS__ -w -dM -E -x c++ buildroot/share/PlatformIO/scripts/common-dependencies.h' returned non-zero exit status 1.:
  File "C:\users\tony\.platformio\penv\lib\site-packages\platformio\builder\main.py", line 168:
    env.SConscript(item, exports="env")
  File "C:\Users\Tony\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py", line 598:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\Tony\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py", line 287:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "D:\Marlin-2.0.x\buildroot\share\PlatformIO\scripts\common-dependencies.py", line 286:
    apply_features_config()
  File "D:\Marlin-2.0.x\buildroot\share\PlatformIO\scripts\common-dependencies.py", line 118:
    if not env.MarlinFeatureIsEnabled(feature):
  File "C:\Users\Tony\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Environment.py", line 219:
    return self.method(*nargs, **kwargs)
  File "D:\Marlin-2.0.x\buildroot\share\PlatformIO\scripts\common-dependencies.py", line 262:
    load_marlin_features()
  File "D:\Marlin-2.0.x\buildroot\share\PlatformIO\scripts\common-dependencies.py", line 250:
    define_list = subprocess.check_output(cmd, shell=True).splitlines()
  File "C:\Users\Tony\.platformio\python3\lib\subprocess.py", line 411:
    **kwargs).stdout
  File "C:\Users\Tony\.platformio\python3\lib\subprocess.py", line 512:
    output=stdout, stderr=stderr)

Does the folder

exist?

Is there further a bin folder in there that contains a avr-g++ executable?

C:\Users\Tony.platformio\packages\toolchain-atmelavr exists and has a bin folder with avr-g++ exe

After a build, is there a .gcc_path file in the .pio\build\mega2560 folder of the Marlin project folder? What’s the content?

there is a .gcc_path file, contents are

avr-g++.exe

Hmm that should have been regenerated with the C:\Users\Tony\.platformio\packages\toolchain-atmelavr\bin\avr-g++.exe path when the .pio folder was deleted and rebuilt.

When you remove that .gcc_path file and hit “Build” again, does it still fail?

Does it fail when you manually replace the contents of that file with the path above?

Do you have a global AVR-GCC installation, by chance?

when i remove the gcc path and rebuild stills fails. I don’t not have another AVR-GCC installation, just a normal gcc from the mingw-64 install, not sure if that will impact it or not. Also it still fails when I replace the contents of the GCC path inside the build folder with “C:\Users\Tony.platformio\packages\toolchain-atmelavr\bin\avr-g++.exe”

With the same error that includes the full path?

Could you also again open a PIO CLI like in the first post and execute the two commands

"C:\Users\Tony\.platformio\packages\toolchain-atmelavr\bin\avr-g++.exe" -D__MARLIN_FIRMWARE__ -D__MARLIN_DEPS__ -w -dM -E -x c++ buildroot/share/PlatformIO/scripts/common-dependencies.h
$LASTEXITCODE

and post in pastebin/xyz what that outputs.

Btw, your case is really interesting, since we had sporadic reports of Marlin’s build script failing (this compiler-find logic), but we can’t figure out why exactly, since it is working on all machines I and the Marlin developers are testing it on ([BUG] 'CC' is not recognized as an internal or external command · Issue #20671 · MarlinFirmware/Marlin · GitHub). So I really appreciate your patience and the information we can gather from here to maybe finally erridicate this problem.

https://paste-bin.xyz/20110

PS D:\Marlin-2.0.x> $LASTEXITCODE
0

No worries i’m glad that someone is trying to help me with this issue. Also does the compiler act different when using different processors ie. amd to intel? Recently updated to amd from intel.