The output and link shows that the command could be executed successfully and the return-code of the invocation was 0 meaning no-error.
Then how in the world does it do a non-zero exit v
when compiled in VSCode + PlatformIO? >.<
Do you have any antivirus installed beyond the default/builtin Windows defender?
Can you also
follow this guide in conjunction with docs to add the C:\Users\Tony\.platformio\python3\Scripts
folder to the PATH
? (Check that it exists first)
compeltely remove all folders within C:\Users\Tony\.platformio\packages
and C:\Users\Tony\.platformio\platforms
then completely remove the Marlin project folder
Reclone it fresh from the repo
Open a terminal (Windows + R → cmd.exe
), change directory into the Marlin folder where the platformio.ini
using the cd <path>
command and execute pio run
. Does it stilll fail, and if yes, with what exact error?
tonyhle
January 17, 2021, 9:21pm
22
Nothing but windows defender installed/active
Just to clarify, just run “pio run”? Trying that errors out saying the pio is not a recognized command. I looked at the docs and installed platformio, which created a virtual environment with platformio installed
My bad, the path that needs to be added to the SYSTEM
PATH should be C:\Users\Tony\.platformio\penv\Scripts
. If you open this folder you also see the pio
executable in it, right?
tonyhle
January 18, 2021, 2:06am
24
D:\Marlin-2.0.x>pio run
Processing mega2560 (platform: atmelavr; board: megaatmega2560; framework: arduino)
------------------------------------------------------------------------------------------------------------------------
Platform Manager: Installing atmelavr
Platform Manager: atmelavr @ 3.1.0 has been installed!
The platform 'atmelavr' has been successfully installed!
The rest of the packages will be installed later depending on your build environment.
Tool Manager: Installing platformio/toolchain-atmelavr @ ~1.50400.0
Unpacking [####################################] 100%
Tool Manager: toolchain-atmelavr @ 1.50400.190710 has been installed!
Tool Manager: Installing platformio/framework-arduino-avr @ ~5.1.0
Unpacking [####################################] 100%
Tool Manager: framework-arduino-avr @ 5.1.0 has been installed!
Tool Manager: Installing platformio/tool-scons @ ~4.40001.0
Tool Manager: tool-scons @ 4.40001.0 has been installed!
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\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 420:
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "C:\Users\Tony\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 524:
raise CalledProcessError(retcode, process.args,
============================================= [FAILED] Took 34.02 seconds =============================================
Environment Status Duration
------------- -------- ------------
mega2560 FAILED 00:00:34.016
======================================== 1 failed, 0 succeeded in 00:00:34.016 ========================================
D:\Marlin-2.0.x>
Here are the results
Very interesting. But we should be getting to the bottom of this. Can you please
open the platformio.ini
of the Marlin project and after the board
line in the mega2560 environment
add the line
custom_verbose = 1
Then, remove the .pio
folder in the project again, build the project and show logs. They should be more verbose now.
Then, please
It should hopefully start printing PATH:
… and give some debug output as to why Marlin thinks that’s the right compiler path.
tonyhle
January 18, 2021, 5:08pm
26
maxgerhardt:
custom_verbose = 1
Processing mega2560 (platform: atmelavr; board: megaatmega2560; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
PATH: ['C:\\Users\\Tony\\.platformio\\packages\\toolchain-atmelavr\\bin', 'C:\\Users\\Tony\\.platformio\\python3', 'C:\\Program Files\\AdoptOpenJDK\\jre-8.0.265.01-hotspot\\bin', 'C:\\Program Files\\AdoptOpenJDK\\jre-11.0.8.10-hotspot\\bin', 'C:\\Program Files (x86)\\AdoptOpenJDK\\jre-8.0.265.01-hotspot\\bin', 'C:\\Windows\\system32', 'C:\\Windows', 'C:\\Windows\\System32\\Wbem', 'C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\', 'C:\\Windows\\System32\\OpenSSH\\', 'C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common', 'C:\\Program Files\\dotnet\\', 'C:\\Program Files\\nodejs\\', 'C:\\Program Files\\NVIDIA Corporation\\NVIDIA
NvDLISR', 'C:\\Program Files (x86)\\mingw-w64\\i686-8.1.0-posix-dwarf-rt_v6-rev0\\mingw32\\bin\\', 'C:\\Users\\Tony\\.platformio\\penv\\Scripts', 'C:\\Program Files\\PuTTY\\', 'C:\\Users\\Tony\\AppData\\Local\\Programs\\Python\\Python39\\Scripts\\', 'C:\\Users\\Tony\\AppData\\Local\\Programs\\Python\\Python39\\', 'C:\\Users\\Tony\\AppData\\Local\\Microsoft\\WindowsApps', 'C:\\Users\\Tony\\AppData\\Roaming\\npm', 'C:\\Users\\Tony\\AppData\\Local\\Programs\\Microsoft VS Code\\bin']
Searching directory: C:\Users\Tony\.platformio\packages\toolchain-atmelavr\bin
Searching file avr-addr2line.exe (dir C:\Users\Tony\.platformio\packages\toolchain-atmelavr\bin)
Searching file avr-ar.exe (dir C:\Users\Tony\.platformio\packages\toolchain-atmelavr\bin)
Searching file avr-as.exe (dir C:\Users\Tony\.platformio\packages\toolchain-atmelavr\bin)
Searching file avr-c++.exe (dir C:\Users\Tony\.platformio\packages\toolchain-atmelavr\bin)
Searching file avr-c++filt.exe (dir C:\Users\Tony\.platformio\packages\toolchain-atmelavr\bin)
Searching file avr-cpp.exe (dir C:\Users\Tony\.platformio\packages\toolchain-atmelavr\bin)
Searching file avr-elfedit.exe (dir C:\Users\Tony\.platformio\packages\toolchain-atmelavr\bin)
Searching file avr-g++.exe (dir C:\Users\Tony\.platformio\packages\toolchain-atmelavr\bin)
Compiler found: C:\Users\Tony\.platformio\packages\toolchain-atmelavr\bin\avr-g++.exe
============================================================================================ [SUCCESS] Took 1.33 seconds ============================================================================================
Environment Status Duration
------------- -------- ------------
mega2560 SUCCESS 00:00:01.326
Looks like the change to the common-dependencies.py worked, I reverted to the original and the it threw the same error as before. So seems that linked common-dependencies.py is the solution to my issue.
Aha. I’ve learnt from the devs in [BUG] 'CC' is not recognized as an internal or external command · Issue #20671 · MarlinFirmware/Marlin · GitHub that the 2.0.x branch does not have a fix for the common-dependencies.py
file that is however present in the bugfix-2.0.x branch. Can you download https://github.com/MarlinFirmware/Marlin/archive/bugfix-2.0.x.zip , unpack it and try to build it, without any modifications to anything?
tonyhle
January 20, 2021, 6:31pm
28
> Executing task in folder Marlin-bugfix-2.0.x: C:\Users\Tony\.platformio\penv\Scripts\pio.exe run --environment mega2560 <
Processing mega2560 (platform: atmelavr; board: megaatmega2560; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
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 "D:\Marlin-bugfix-2.0.x\buildroot\share\PlatformIO\scripts\common-dependencies.py", line 327:
apply_features_config()
File "D:\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 "D:\Marlin-bugfix-2.0.x\buildroot\share\PlatformIO\scripts\common-dependencies.py", line 292:
load_marlin_features()
File "D:\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\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 420:
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "C:\Users\Tony\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 524:
raise CalledProcessError(retcode, process.args,
============================================================================================================== [FAILED] Took 0.51 seconds ==============================================================================================================
Environment Status Duration
------------- -------- ------------
mega2560 FAILED 00:00:00.514
========================================================================================================= 1 failed, 0 succeeded in 00:00:00.514 =========================================================================================================
The command structure looks absolutely right. I have literally no idea what’s holding this back anymore / causing it to fail with return code 1.
Please open an issue at Issues · MarlinFirmware/Marlin · GitHub referencing this thread and the version of Marlin you’ve downloaded for the Marlin developers.