Cannot compile a useable Marlin 2.0 firmware

That is an excessively long filename, and Windows has restrictions on filename length. Can you move the C:\\Users\\user\\Downloads\\BIGTREETECH-SKR-mini-E3-master (1)\\BIGTREETECH-SKR-mini-E3-master\\ folder content to something shorter like C:\Marlin?

3 Likes

Thanks a lot!!! I think that’s it. Took me few days…

I am trying to compile Marlin because I was having problems with another project that I am migrating from .ino to .cpp. It has many files to link and I am geting problems with objects being out of scope.Hard for a Fortran programmer to deal with.
My Marlin compiles and dies almost at the end with:

Compiling .pio\build\mega2560\src\src\lcd\menu\menu_configuration.cpp.o
Compiling .pio\build\mega2560\src\src\lcd\menu\menu_custom.cpp.o
Compiling .pio\build\mega2560\src\src\lcd\menu\menu_delta_calibrate.cpp.o
Compiling .pio\build\mega2560\src\src\lcd\menu\menu_filament.cpp.o
Assembler messages:
Fatal error: can't create .pio\build\mega2560\src\src\lcd\menu\menu_delta_calibrate.cpp.o: No such file or directory
*** [.pio\build\mega2560\src\src\lcd\menu\menu_delta_calibrate.cpp.o] Error 1
Assembler messages:
Fatal error: can't create .pio\build\mega2560\src\src\lcd\menu\menu_filament.cpp.o: No such file or directory
*** [.pio\build\mega2560\src\src\lcd\menu\menu_filament.cpp.o] Error 1
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Owner\\Documents\\PlatformIO\\Projects\\Marlin 2\\.pio\\build\\mega2560\\.sconsign.py38.tmp':
  File "C:\Users\Owner\.platformio\packages\tool-scons\script\..\engine\SCons\Script\Main.py", line 1381:
    _exec_main(parser, values)
  File "C:\Users\Owner\.platformio\packages\tool-scons\script\..\engine\SCons\Script\Main.py", line 1344:
    _main(parser)

Q1. What are the double slashes in the first error?
Q2. I havedownloaded many libraries- how do I guess which one needs to be rolled back because it links with Ardino code compiled with a different version of gcc, or from a different branch.

When python prints an encoded string, it just escapes it, so a double backlash slash is the escaped version of a backslash slash.

I don’t think the libraries used when compiling within Arduino IDE are the problem there.

Sounds like some internal mixup of python versions. Can you remove the complete .pio\ folder of the project and recompile? What version of Python are you running? I’ve seen Python 3.8 causing problems while Python 3.7 doesn’t.

Another source of error are long filenames which Windows doesn’t really like. Try moving the project from 'C:\Users\Owner\Documents\PlatformIO\Projects\Marlin 2 to a shorter path.

1 Like

I have moved my code up to top level directory.
Python re-installed itself as 3.8.1 32 bit. Are ther simple instructions to roll back Python to 3.7?

Here is the section of the compiler failing - note that it was 2 files sooner.

Compiling .pio\build\mega2560\src\src\lcd\menu\menu_cancelobject.cpp.o
Compiling .pio\build\mega2560\src\src\lcd\menu\menu_configuration.cpp.o
Compiling .pio\build\mega2560\src\src\lcd\menu\menu_custom.cpp.o
Assembler messages:
Fatal error: can’t create .pio\build\mega2560\src\src\lcd\menu\menu_custom.cpp.o: No such file or directory
*** [.pio\build\mega2560\src\src\lcd\menu\menu_custom.cpp.o] Error 1
Assembler messages:
Fatal error: can’t create .pio\build\mega2560\src\src\lcd\menu\menu_configuration.cpp.o: No such file or directory
*** [.pio\build\mega2560\src\src\lcd\menu\menu_configuration.cpp.o] Error 1
FileNotFoundError: [Errno 2] No such file or directory: ‘C:\Marlin 2\.pio\build\mega2560\.sconsign.py38.tmp’:
File “C:\Users\Owner.platformio\packages\tool-scons\script…\engine\SCons\Script\Main.py”, line 1381:
_exec_main(parser, values)
File “C:\Users\Owner.platformio\packages\tool-scons\script…\engine\SCons\Script\Main.py”, line 1344:
_main(parser)
File “C:\Users\Owner.platformio\packages\tool-scons\script…\engine\SCons\Script\Main.py”, line 1119:
nodes = _build_targets(fs, options, targets, target_top)
File “C:\Users\Owner.platformio\packages\tool-scons\script…\engine\SCons\Script\Main.py”, line 1318:
jobs.run(postfunc = jobs_postfunc)
File “C:\Users\Owner.platformio\packages\tool-scons\script…\engine\SCons\Job.py”, line 113:
postfunc()
File “C:\Users\Owner.platformio\packages\tool-scons\script…\engine\SCons\Script\Main.py”, line 1315:
SCons.SConsign.write()
File “C:\Users\Owner.platformio\packages\tool-scons\script…\engine\SCons\SConsign.py”, line 117:
syncmethod()
File “C:\Users\Owner.platformio\packages\tool-scons\script…\engine\SCons\dblite.py”, line 147:
f = self._open(self._tmp_name, “wb”, self._mode)
Exception ignored in: <function dblite.del at 0x03854418>
Traceback (most recent call last):
File “C:\Users\Owner.platformio\packages\tool-scons\script…\engine\SCons\dblite.py”, line 143, in del
File “C:\Users\Owner.platformio\packages\tool-scons\script…\engine\SCons\dblite.py”, line 140, in close
File “C:\Users\Owner.platformio\packages\tool-scons\script…\engine\SCons\dblite.py”, line 147, in sync
FileNotFoundError: [Errno 2] No such file or directory: ‘C:\Marlin 2\.pio\build\mega2560\.sconsign.py38.tmp’
=================================== [FAILED] Took 317.34 seconds ===================================

Environment Status Duration

I ran verbose, and here is an example compile.
I did get an lto error in my other program - might it be linked? How do I remove -flto?

avr-g++ -o .pio\build\mega2560\src\src\gcode\temp\M141_M191.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -fmax-errors=5 -g -fmerge-all-constants -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega2560 -DPLATFORMIO=40301 -DARDUINO_AVR_MEGA2560 -D__MARLIN_FIRMWARE__ -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10808 -IMarlin -I.pio\libdeps\mega2560\TMC26XStepper -I.pio\libdeps\mega2560\SlowSoftI2CMaster -I.pio\libdeps\mega2560\SailfishRGB_LED -I.pio\libdeps\mega2560\SailfishLCD -I.pio\libdeps\mega2560\Arduino-L6470\src -I.pio\libdeps\mega2560\LiquidTWI2 -I.pio\libdeps\mega2560\Adafruit_MAX31865 -I.pio\libdeps\mega2560\U8glib-HAL_ID1932\src -IC:\Users\Owner.platformio\packages\framework-arduino-avr\libraries\Wire\src “-I.pio\libdeps\mega2560\Adafruit NeoPixel_ID28” -I.pio\libdeps\mega2560\TMCStepper_ID5513\src -IC:\Users\Owner.platformio\packages\framework-arduino-avr\libraries\SPI\src -IC:\Users\Owner.platformio\packages\framework-arduino-avr\libraries\SoftwareSerial\src -I.pio\libdeps\mega2560\LiquidCrystal_ID887\src -IC:\Users\Owner.platformio\packages\framework-arduino-avr\cores\arduino -IC:\Users\Owner.platformio\packages\framework-arduino-avr\variants\mega Marlin\src\gcode\temp\M141_M191.cpp

I think build_unflags should do that one…

The unflag -flto made it compile much further but I got the LTO error again.
Any idea about the delete permission?

Compiling .pio\build\mega2560\FrameworkArduino\wiring_pulse.c.o
Compiling .pio\build\mega2560\FrameworkArduino\wiring_shift.c.o
Archiving .pio\build\mega2560\libFrameworkArduino.a
Archiving .pio\build\mega2560\lib727\libU8glib-HAL_ID1932.a
Linking .pio\build\mega2560\firmware.elf
lto-wrapper.exe: fatal error: deleting LTRANS file C:\Users\Owner\AppData\Local\Temp\ccp7dxNF.ltrans1.o: Permission denied
c:/users/owner/.platformio/packages/toolchain-atmelavr/bin/../lib/gcc/avr/5.4.0/../../../../avr/bin/ld.exe: error: lto-wrapper failed
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\mega2560\firmware.elf] Error 1

I then tried -fno-lto in the build flags

and it failed earlier

Compiling .pio\build\mega2560\src\src\lcd\menu\menu.cpp.o
Compiling .pio\build\mega2560\src\src\lcd\menu\menu_advanced.cpp.o
Assembler messages:
Fatal error: can't create .pio\build\mega2560\src\src\lcd\menu\menu_advanced.cpp.o: No such file or directory
Assembler messages:
Fatal error: can't create .pio\build\mega2560\src\src\lcd\menu\menu.cpp.o: No such file or directory
*** [.pio\build\mega2560\src\src\lcd\menu\menu_advanced.cpp.o] Error 1
*** [.pio\build\mega2560\src\src\lcd\menu\menu.cpp.o] Error 1
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Marlin 2\\.pio\\build\\mega2560\\.sconsign.py38.tmp':
  File "C:\Users\Owner\.platformio\packages\tool-scons\script\..\engine\SCons\Script\Main.py", line 1381:
    _exec_main(parser, values)
  File "C:\Users\Owner\.platformio\packages\tool-scons\script\..\engine\SCons\Script\Main.py", line 1344:
    _main(parser)
  File "C:\Users\Owner\.platformio\packages\tool-scons\script\..\engine\SCons\Script\Main.py", line 1119:
    nodes = _build_targets(fs, options, targets, target_top)
  File "C:\Users\Owner\.platformio\packages\tool-scons\script\..\engine\SCons\Script\Main.py", line 1318:
    jobs.run(postfunc = jobs_postfunc)
  File "C:\Users\Owner\.platformio\packages\tool-scons\script\..\engine\SCons\Job.py", line 113:     
    postfunc()
  File "C:\Users\Owner\.platformio\packages\tool-scons\script\..\engine\SCons\Script\Main.py", line 1315:
    SCons.SConsign.write()
  File "C:\Users\Owner\.platformio\packages\tool-scons\script\..\engine\SCons\SConsign.py", line 117:
    syncmethod()
  File "C:\Users\Owner\.platformio\packages\tool-scons\script\..\engine\SCons\dblite.py", line 147:  
    f = self._open(self._tmp_name, "wb", self._mode)
Exception ignored in: <function dblite.__del__ at 0x03284418>
Traceback (most recent call last):
  File "C:\Users\Owner\.platformio\packages\tool-scons\script\..\engine\SCons\dblite.py", line 143, in __del__
  File "C:\Users\Owner\.platformio\packages\tool-scons\script\..\engine\SCons\dblite.py", line 140, in close
  File "C:\Users\Owner\.platformio\packages\tool-scons\script\..\engine\SCons\dblite.py", line 147, in sync
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Marlin 2\\.pio\\build\\mega2560\\.sconsign.py38.tmp'
=================================== [FAILED] Took 260.81 seconds ===================================

.sconsign.py38.tmp existed with a size of 4.4 Mbyte.

Problem solved. Removed Python 3.8.1
Installed Python 3.7.7

Linking .pio\build\mega2560\firmware.elf
Building .pio\build\mega2560\firmware.hex
Checking size .pio\build\mega2560\firmware.elf
Advanced Memory Usage is available via “PlatformIO Home > Project Inspect”
RAM: [=== ] 33.9% (used 2781 bytes from 8192 bytes)
Flash: [=== ] 33.6% (used 85222 bytes from 253952 bytes)
=================== [SUCCESS] Took 544.11 seconds ===================

1 Like

Thank you so much maxgerhardt you saved me so much headache!!!

Hello everyone. I’m new to 3D printing and compiling and I keep having this error.
Can anyone help me with some advice?
Thank you

Processing STM32F103RC_bigtree_512K_USB (platform: ststm32; board: genericSTM32F103RC; framework: arduino)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: Redirecting...
PLATFORM: ST STM32 (12.0.0) > STM32F103RC (48k RAM. 256k Flash)
HARDWARE: STM32F103RCT6 72MHz, 48KB RAM, 512KB Flash
DEBUG: Current (blackmagic) External (blackmagic, cmsis-dap, jlink, stlink)
PACKAGES:

  • framework-arduinoststm32 4.10900.200819 (1.9.0)
  • framework-cmsis 2.50501.200527 (5.5.1)
  • tool-stm32duino 1.0.2
  • toolchain-gccarmnoneeabi 1.90201.191206 (9.2.1)
    Converting Marlin.ino
    LDF: Library Dependency Finder → Library Dependency Finder (LDF) — PlatformIO latest documentation
    LDF Modes: Finder ~ chain, Compatibility ~ soft
    Library Manager: Installing git+https://github.com/bigtreetech/Adafruit_NeoPixel
    FileNotFoundError: [WinError 2] The system cannot find the file specified:
    File “C:\Users\brati.platformio\penv\Lib\site-packages\platformio\builder\main.py”, line 177:
    env.SConscript(“$BUILD_SCRIPT”)
    File “C:\Users\brati.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Script\SConscript.py”, line 591:
    return _SConscript(self.fs, *files, **subst_kw)
    File “C:\Users\brati.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Script\SConscript.py”, line 280:
    exec(compile(scriptdata, scriptname, ‘exec’), call_stack[-1].globals)
    File “C:\Users\brati.platformio\platforms\ststm32\builder\main.py”, line 99:
    target_elf = env.BuildProgram()
    File “C:\Users\brati.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Util.py”, line 658:
    return self.method(*nargs, **kwargs)
    File “C:\Users\brati.platformio\penv\Lib\site-packages\platformio\builder\tools\platformio.py”, line 62:
    env.ProcessProjectDeps()
    File “C:\Users\brati.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Util.py”, line 658:
    return self.method(*nargs, **kwargs)
    File “C:\Users\brati.platformio\penv\Lib\site-packages\platformio\builder\tools\platformio.py”, line 140:
    project_lib_builder = env.ConfigureProjectLibBuilder()
    File “C:\Users\brati.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Util.py”, line 658:
    return self.method(*nargs, **kwargs)
    File “C:\Users\brati.platformio\penv\Lib\site-packages\platformio\builder\tools\piolib.py”, line 1062:
    project.install_dependencies()
    File “C:\Users\brati.platformio\penv\Lib\site-packages\platformio\builder\tools\piolib.py”, line 898:
    lm.install(spec)
    File “c:\users\brati.platformio\penv\lib\site-packages\platformio\package\manager_install.py”, line 48:
    pkg = self._install(
    File “c:\users\brati.platformio\penv\lib\site-packages\platformio\package\manager\library.py”, line 81:
    return super(LibraryPackageManager, self).install(
    File “c:\users\brati.platformio\penv\lib\site-packages\platformio\package\manager_install.py”, line 97:
    pkg = self.install_from_url(spec.url, spec, silent=silent)
    File “c:\users\brati.platformio\penv\lib\site-packages\platformio\package\manager_install.py”, line 141:
    vcs = VCSClientFactory.new(tmp_dir, url)
    File “c:\users\brati.platformio\penv\lib\site-packages\platformio\package\vcsclient.py”, line 54:
    obj = getattr(sys.modules[name], “%sClient” % type
    .title())(
    File “c:\users\brati.platformio\penv\lib\site-packages\platformio\package\vcsclient.py”, line 137:
    self.configure()
    File “c:\users\brati.platformio\penv\lib\site-packages\platformio\package\vcsclient.py”, line 146:
    result = proc.exec_command([cls.command, “–exec-path”])
    File “c:\users\brati.platformio\penv\lib\site-packages\platformio\proc.py”, line 117:
    p = subprocess.Popen(*args, **kwargs)
    File “C:\Users\brati.platformio\python3\lib\subprocess.py”, line 951:
    self._execute_child(args, executable, preexec_fn, close_fds,
    File “C:\Users\brati.platformio\python3\lib\subprocess.py”, line 1420:
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
    ===================================================================================== [FAILED] Took 1.68 seconds =====================================================================================

Environment Status Duration


STM32F103RC_bigtree_512K_USB FAILED 00:00:01.678
================================================================================ 1 failed, 0 succeeded in 00:00:01.678 ================================================================================The terminal process “C:\Users\brati.platformio\penv\Scripts\platformio.exe ‘run’” terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

Install git.

1 Like

Thank you very much…that solved 1 of my problems but I have too many errors trying to compile this firmware…

Which ones? What repository and branch are you using for the Marlin firmware? Which configuration .h files are you using? What 3D Printer is your target?

The printer is from a friend who died of cancer not long ago and he wanted me to share his hobby so I don’t know to much about configuration .h or branch. All I know is that the printer is Ender 3 pro with SKR Mini E3 V1.2, BlTouch, dual Z axis, dual gear extruder, and the touch screen is TFT35 E3 V3.0
This is the link to some files that he had.

Ah, I can see that that is an older version of Marlin. With recent PlatformIO and platform changes (like switching some boards from the Maple core the the STM32 core) have made older Marlin versions uncompilable. But one can do a few platformio.ini to get it running again.

In the platformio.ini line 343, change

[env:STM32F103RC_bigtree_512K_USB]
platform          = ststm32

to

[env:STM32F103RC_bigtree_512K_USB]
platform          = ststm32@~6.1

and change

  Adafruit_MAX31865=https://github.com/adafruit/Adafruit_MAX31865/archive/master.zip

to

  Adafruit MAX31865 library@~1.1.0

(beware the two spaces at the front).

After that, remove the .pio folder of the project (to remove old build artefacts) and try to compile again. It should now give you

Building .pio\build\STM32F103RC_bigtree_512K_USB\firmware.bin
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [===       ]  27.8% (used 13680 bytes from 49152 bytes)
Flash: [=====     ]  48.8% (used 255764 bytes from 524288 bytes)
============== [SUCCESS] Took 42.70 seconds ==============

Environment                   Status    Duration
----------------------------  --------  ------------
STM32F103RC_bigtree_512K_USB  SUCCESS   00:00:42.699
=============== 1 succeeded in 00:00:42.699 ===============

Thank you. I managed to compile the firmware (but man, do I have a lot to learn)