I am trying to compile Marlin 2.1.x for Creality Ender 3 Pro on my Octopi, and I keep getting a segmentation violation on cc1plus. I have opened
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108249
and they are asking for the full command line which is failing, but I don’t know ow to get platformio to show that to me - is there a log somewhere? I’ve provided the “build_flags” but that doesn’t seem to meet the requirement. I added “-Wall -Wextra” to the build flags, but I still don’t see any preprocessed files.
Project tasks → Advanced → Verbose build.
Or, more directly on the CLI
pio run -t clean
pio run -v -j1 > build_log.txt 2>&1
(for Windows, redirects stderr to stdout which is then logged into the file.)
OK. I did that, but I still don’t see the actual infocation of cc1plus (or g++ or whatever entry point they used). I’d attach the file, but I don’t see how to do that. So - I guess I’ll call it preformatted text and paste it in here:
pi@octopi:~/Marlin $ cat build_log.txt
Processing STM32F103RE_creality (extends: STM32F103Rx_creality; board: genericSTM32F103RE; board_build.variant: MARLIN_F103Rx; board_build.offset: 0x7000; board_upload.offset_address: 0x08007000; build_flags: -g3 -D__MARLIN_FIRMWARE__ -DNDEBUG, -fmax-errors=5 -save-temps -Wall -Wextra, -std=gnu++14 -DHAL_STM32, -DUSBCON -DUSBD_USE_CDC, -DTIM_IRQ_PRIO=13, -DADC_RESOLUTION=12, -DMCU_STM32F103RE -DHAL_SD_MODULE_ENABLED, -DSS_TIMER=4 -DTIMER_SERVO=TIM5, -DENABLE_HWSERIAL3 -DTRANSFER_CLOCK_DIV=8; build_unflags: -std=gnu++11, -DUSBCON -DUSBD_USE_CDC; extra_scripts: pre:buildroot/share/PlatformIO/scripts/configuration.py, pre:buildroot/share/PlatformIO/scripts/common-dependencies.py, pre:buildroot/share/PlatformIO/scripts/common-cxxflags.py, pre:buildroot/share/PlatformIO/scripts/preflight-checks.py, post:buildroot/share/PlatformIO/scripts/common-dependencies-post.py, pre:buildroot/share/PlatformIO/scripts/stm32_serialbuffer.py, pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py, buildroot/share/PlatformIO/scripts/offset_and_rename.py, pre:buildroot/share/PlatformIO/scripts/random-bin.py; monitor_speed: 115200; debug_tool: jlink; upload_protocol: jlink; platform: ststm32@~12.1; board_build.core: stm32; build_src_filter: +<src/*> -<src/config> -<src/HAL> +<src/HAL/shared> -<src/tests>, -<src/lcd/HD44780> -<src/lcd/TFTGLCD> -<src/lcd/dogm> -<src/lcd/tft> -<src/lcd/tft_io>, -<src/HAL/STM32/tft> -<src/HAL/STM32F1/tft>, -<src/lcd/e3v2/common> -<src/lcd/e3v2/creality> -<src/lcd/e3v2/proui> -<src/lcd/e3v2/jyersui> -<src/lcd/e3v2/marlinui>, -<src/lcd/menu>, -<src/lcd/menu/game/game.cpp> -<src/lcd/menu/game/brickout.cpp> -<src/lcd/menu/game/invaders.cpp>, -<src/lcd/menu/game/maze.cpp> -<src/lcd/menu/game/snake.cpp>, -<src/lcd/menu/menu_backlash.cpp>, -<src/lcd/menu/menu_bed_corners.cpp>, -<src/lcd/menu/menu_bed_leveling.cpp>, -<src/lcd/menu/menu_cancelobject.cpp>, -<src/lcd/menu/menu_delta_calibrate.cpp>, -<src/lcd/menu/menu_filament.cpp>, -<src/lcd/menu/menu_info.cpp>, -<src/lcd/menu/menu_job_recovery.cpp>, -<src/lcd/menu/menu_language.cpp>, -<src/lcd/menu/menu_led.cpp>, -<src/lcd/menu/menu_media.cpp>, -<src/lcd/menu/menu_mmu2.cpp>, -<src/lcd/menu/menu_password.cpp>, -<src/lcd/menu/menu_power_monitor.cpp>, -<src/lcd/menu/menu_spindle_laser.cpp>, -<src/lcd/menu/menu_temperature.cpp>, -<src/lcd/menu/menu_tmc.cpp>, -<src/lcd/menu/menu_touch_screen.cpp>, -<src/lcd/menu/menu_tramming.cpp>, -<src/lcd/menu/menu_ubl.cpp>, -<src/lcd/menu/menu_x_twist.cpp>, -<src/lcd/extui/anycubic_chiron>, -<src/lcd/extui/anycubic_i3mega>, -<src/lcd/extui/dgus> -<src/lcd/extui/dgus/fysetc> -<src/lcd/extui/dgus/hiprecy> -<src/lcd/extui/dgus/mks> -<src/lcd/extui/dgus/origin>, -<src/lcd/extui/dgus_reloaded>, -<src/lcd/extui/example>, -<src/lcd/extui/ftdi_eve_touch_ui>, -<src/lcd/extui/malyan>, -<src/lcd/extui/mks_ui>, -<src/lcd/extui/nextion>, -<src/lcd/lcdprint.cpp>, -<src/lcd/touch/touch_buttons.cpp>, -<src/sd/usb_flashdrive/lib-uhs2> -<src/sd/usb_flashdrive/lib-uhs3>, -<src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp>, -<src/sd/cardreader.cpp> -<src/sd/Sd2Card.cpp> -<src/sd/SdBaseFile.cpp> -<src/sd/SdFatUtil.cpp> -<src/sd/SdFile.cpp> -<src/sd/SdVolume.cpp>, -<src/HAL/shared/backtrace>, -<src/HAL/shared/cpu_exception>, -<src/HAL/shared/eeprom_if_i2c.cpp>, -<src/HAL/shared/eeprom_if_spi.cpp>, -<src/feature/adc> -<src/gcode/feature/adc>, -<src/feature/ammeter.cpp>, -<src/feature/babystep.cpp>, -<src/feature/backlash.cpp>, -<src/feature/baricuda.cpp> -<src/gcode/feature/baricuda>, -<src/feature/bedlevel/abl> -<src/gcode/bedlevel/abl>, -<src/feature/bedlevel/bdl> -<src/gcode/probe/M102.cpp>, -<src/feature/bedlevel/mbl> -<src/gcode/bedlevel/mbl>, -<src/feature/bedlevel/ubl> -<src/gcode/bedlevel/ubl>, -<src/feature/bedlevel/hilbert_curve.cpp>, -<src/feature/binary_stream.cpp> -<src/libs/heatshrink>, -<src/feature/bltouch.cpp>, -<src/feature/cancel_object.cpp> -<src/gcode/feature/cancel>, -<src/feature/caselight.cpp> -<src/gcode/feature/caselight>, -<src/feature/closedloop.cpp>, -<src/feature/controllerfan.cpp> -<src/gcode/feature/controllerfan>, -<src/feature/cooler.cpp> -<src/gcode/temp/M143_M193.cpp>, -<src/feature/dac> -<src/feature/digipot>, -<src/feature/direct_stepping.cpp> -<src/gcode/motion/G6.cpp>, -<src/feature/e_parser.cpp>, -<src/feature/easythreed_ui.cpp>, -<src/feature/encoder_i2c.cpp>, -<src/feature/ethernet.cpp> -<src/gcode/feature/network/M552-M554.cpp>, -<src/feature/fancheck.cpp>, -<src/feature/fanmux.cpp>, -<src/feature/filwidth.cpp> -<src/gcode/feature/filwidth>, -<src/feature/fwretract.cpp> -<src/gcode/feature/fwretract>, -<src/feature/host_actions.cpp>, -<src/feature/hotend_idle.cpp>, -<src/feature/joystick.cpp>, -<src/feature/leds/blinkm.cpp>, -<src/feature/leds/leds.cpp>, -<src/feature/leds/neopixel.cpp>, -<src/feature/leds/pca9533.cpp>, -<src/feature/leds/pca9632.cpp>, -<src/feature/leds/printer_event_leds.cpp>, -<src/feature/leds/tempstat.cpp>, -<src/feature/max7219.cpp>, -<src/feature/meatpack.cpp>, -<src/feature/mixing.cpp>, -<src/feature/mmu/mmu.cpp>, -<src/feature/mmu/mmu2.cpp> -<src/gcode/feature/prusa_MMU2>, -<src/feature/password> -<src/gcode/feature/password>, -<src/feature/pause.cpp>, -<src/feature/power.cpp>, -<src/feature/power_monitor.cpp> -<src/gcode/feature/power_monitor>, -<src/feature/powerloss.cpp> -<src/gcode/feature/powerloss>, -<src/feature/probe_temp_comp.cpp>, -<src/feature/repeat.cpp>, -<src/feature/runout.cpp> -<src/gcode/feature/runout>, -<src/feature/snmm.cpp>, -<src/feature/solenoid.cpp> -<src/gcode/control/M380_M381.cpp>, -<src/feature/spindle_laser.cpp> -<src/gcode/control/M3-M5.cpp>, -<src/feature/stepper_driver_safety.cpp>, -<src/feature/tmc_util.cpp> -<src/module/stepper/trinamic.cpp>, -<src/feature/tramming.cpp>, -<src/feature/twibus.cpp>, -<src/feature/x_twist.cpp> -<src/gcode/probe/M423.cpp>, -<src/feature/z_stepper_align.cpp>, -<src/gcode/bedlevel/G26.cpp>, -<src/gcode/bedlevel/G35.cpp>, -<src/gcode/bedlevel/G42.cpp>, -<src/gcode/bedlevel/M420.cpp> -<src/feature/bedlevel/bedlevel.cpp>, -<src/gcode/calibrate/G33.cpp>, -<src/gcode/calibrate/G34.cpp>, -<src/gcode/calibrate/G34_M422.cpp>, -<src/gcode/calibrate/G76_M871.cpp>, -<src/gcode/calibrate/G425.cpp>, -<src/gcode/calibrate/M12.cpp>, -<src/gcode/calibrate/M48.cpp>, -<src/gcode/calibrate/M100.cpp>, -<src/gcode/calibrate/M425.cpp>, -<src/gcode/calibrate/M665.cpp>, -<src/gcode/calibrate/M666.cpp>, -<src/gcode/calibrate/M852.cpp>, -<src/gcode/control/M10-M11.cpp>, -<src/gcode/control/M42.cpp> -<src/gcode/control/M226.cpp>, -<src/gcode/config/M43.cpp>, -<src/gcode/config/M217.cpp>, -<src/gcode/config/M218.cpp>, -<src/gcode/config/M221.cpp>, -<src/gcode/config/M301.cpp>, -<src/gcode/config/M302.cpp>, -<src/gcode/config/M304.cpp>, -<src/gcode/config/M305.cpp>, -<src/gcode/config/M540.cpp>, -<src/gcode/config/M575.cpp>, -<src/gcode/config/M672.cpp>, -<src/gcode/control/M7-M9.cpp>, -<src/gcode/control/M211.cpp>, -<src/gcode/control/M350_M351.cpp>, -<src/gcode/control/M605.cpp>, -<src/gcode/feature/advance>, -<src/gcode/feature/camera>, -<src/gcode/feature/i2c>, -<src/gcode/feature/input_shaping>, -<src/gcode/feature/L6470>, -<src/gcode/feature/leds/M150.cpp>, -<src/gcode/feature/leds/M7219.cpp>, -<src/gcode/feature/macro>, -<src/gcode/feature/mixing/M163-M165.cpp>, -<src/gcode/feature/mixing/M166.cpp>, -<src/gcode/feature/pause/G27.cpp>, -<src/gcode/feature/pause/G60.cpp>, -<src/gcode/feature/pause/G61.cpp>, -<src/gcode/feature/pause/M125.cpp>, -<src/gcode/feature/pause/M600.cpp>, -<src/gcode/feature/pause/M603.cpp>, -<src/gcode/feature/pause/M701_M702.cpp>, -<src/gcode/feature/trinamic/M122.cpp>, -<src/gcode/feature/trinamic/M569.cpp>, -<src/gcode/feature/trinamic/M906.cpp>, -<src/gcode/feature/trinamic/M911-M914.cpp>, -<src/gcode/feature/trinamic/M919.cpp>, -<src/gcode/geometry/G17-G19.cpp>, -<src/gcode/geometry/G53-G59.cpp>, -<src/gcode/geometry/M206_M428.cpp>, -<src/gcode/host/M16.cpp>, -<src/gcode/host/M113.cpp>, -<src/gcode/host/M154.cpp>, -<src/gcode/host/M360.cpp>, -<src/gcode/host/M876.cpp>, -<src/gcode/lcd/M0_M1.cpp>, -<src/gcode/lcd/M73.cpp>, -<src/gcode/lcd/M117.cpp>, -<src/gcode/lcd/M250.cpp> -<src/gcode/lcd/M255.cpp> -<src/gcode/lcd/M256.cpp>, -<src/gcode/lcd/M300.cpp>, -<src/gcode/lcd/M414.cpp>, -<src/gcode/lcd/M995.cpp>, -<src/gcode/motion/G2_G3.cpp>, -<src/gcode/motion/G5.cpp>, -<src/gcode/motion/G80.cpp>, -<src/gcode/motion/M290.cpp>, -<src/gcode/probe/G30.cpp>, -<src/gcode/probe/G31_G32.cpp>, -<src/gcode/probe/G38.cpp>, -<src/gcode/probe/M401_M402.cpp>, -<src/gcode/probe/M851.cpp>, -<src/gcode/probe/M951.cpp>, -<src/gcode/scara>, -<src/gcode/sd>, -<src/gcode/sd/M32.cpp>, -<src/gcode/sd/M808.cpp>, -<src/gcode/temp/M104_M109.cpp>, -<src/gcode/temp/M123.cpp>, -<src/gcode/temp/M155.cpp>, -<src/gcode/temp/M192.cpp>, -<src/gcode/temp/M306.cpp>, -<src/gcode/units/G20_G21.cpp>, -<src/gcode/units/M82_M83.cpp>, -<src/gcode/units/M149.cpp>, -<src/libs/BL24CXX.cpp> -<src/libs/W25Qxx.cpp>, -<src/libs/L64XX> -<src/module/stepper/L64xx.cpp> -<src/HAL/shared/HAL_spi_L6470.cpp>, -<src/libs/MAX31865.cpp>, -<src/libs/hex_print.cpp>, -<src/libs/least_squares_fit.cpp>, -<src/libs/nozzle.cpp> -<src/gcode/feature/clean>, -<src/module/delta.cpp>, -<src/module/planner_bezier.cpp>, -<src/module/polargraph.cpp>, -<src/module/printcounter.cpp>, -<src/module/probe.cpp>, -<src/module/scara.cpp>, -<src/module/servo.cpp> -<src/gcode/control/M280.cpp> -<src/gcode/config/M281.cpp> -<src/gcode/control/M282.cpp>, -<src/module/stepper/TMC26X.cpp> +<src/HAL/STM32> +<src/HAL/shared/backtrace>; framework: arduino; lib_deps: ; monitor_eol: LF; monitor_echo: True; monitor_filters: colorize, time, send_on_enter)
--------------------------------------------------------------------------------
cc1plus: internal compiler error: Segmentation fault
0x76a5c10f ???
../sysdeps/unix/sysv/linux/arm/sigrestorer.S:64
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
arm-none-eabi-g++: internal compiler error: Segmentation fault signal terminated program cc1plus
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
Error: Failed to parse Marlin features. See previous error messages.
========================== [FAILED] Took 4.30 seconds ==========================
Environment Status Duration
--------------------------------------- -------- ------------
include_tree IGNORED
mega2560 IGNORED
mega2560ext IGNORED
mega1280 IGNORED
MightyBoard1280 IGNORED
MightyBoard2560 IGNORED
rambo IGNORED
FYSETC_F6 IGNORED
sanguino644p IGNORED
sanguino1284p IGNORED
sanguino1284p_optimized IGNORED
melzi IGNORED
melzi_optimized IGNORED
melzi_optiboot IGNORED
melzi_optiboot_optimized IGNORED
DUE IGNORED
DUE_USB IGNORED
DUE_archim IGNORED
esp32 IGNORED
FYSETC_E4 IGNORED
PANDA IGNORED
mks_tinybee IGNORED
LPC1768 IGNORED
LPC1769 IGNORED
linux_native IGNORED
simulator_linux_debug IGNORED
simulator_linux_release IGNORED
simulator_macos_debug IGNORED
simulator_macos_release IGNORED
simulator_windows IGNORED
SAMD21_minitronics20 IGNORED
SAMD51_grandcentral_m4 IGNORED
STM32F070RB_malyan IGNORED
STM32F070CB_malyan IGNORED
malyan_M300 IGNORED
STM32F103RC_maple IGNORED
STM32F103RE_maple IGNORED
STM32F103RC_meeb_maple IGNORED
STM32F103RC_fysetc_maple IGNORED
STM32F103RC_btt_maple IGNORED
STM32F103RC_btt_USB_maple IGNORED
STM32F103RE_creality_maple IGNORED
STM32F103RC_creality_maple IGNORED
STM32F103RE_creality_smartPro_maple IGNORED
STM32F103RE_btt_maple IGNORED
STM32F103RE_btt_USB_maple IGNORED
STM32F103VE_GTM32_maple IGNORED
STM32F103VE_longer_maple IGNORED
mks_robin_mini_maple IGNORED
mks_robin_nano_v1v2_maple IGNORED
mks_robin_maple IGNORED
mks_robin_pro_maple IGNORED
trigorilla_pro_maple IGNORED
mks_robin_e3_maple IGNORED
mks_robin_e3p_maple IGNORED
mks_robin_lite_maple IGNORED
mks_robin_lite3_maple IGNORED
jgaurora_a5s_a1_maple IGNORED
STM32F103CB_malyan_maple IGNORED
chitu_f103_maple IGNORED
chitu_v5_gpio_init_maple IGNORED
FLY_MINI_maple IGNORED
STM32F103RC_ZM3E2_USB_maple IGNORED
STM32F103VC_ZM3E4_USB_maple IGNORED
STM32F103VE_ZM3E4V2_USB_maple IGNORED
ERYONE_ERY32_MINI_maple IGNORED
STM32F103RE IGNORED
STM32F103VE IGNORED
STM32F103ZE IGNORED
STM32F103RC_btt IGNORED
STM32F103RC_btt_USB IGNORED
PANDA_PI_V29 IGNORED
mks_robin IGNORED
mks_robin_e3 IGNORED
STM32F103RE_creality FAILED 00:00:04.299
STM32F103RE_creality_xfer IGNORED
STM32F103RE_creality_smartPro IGNORED
STM32F103RC_creality IGNORED
STM32F103RC_creality_xfer IGNORED
STM32F103VE_creality IGNORED
STM32F103RE_btt IGNORED
STM32F103RE_btt_USB IGNORED
flsun_hispeedv1 IGNORED
mks_robin_nano_v1v2 IGNORED
mks_robin_nano_v1v2_usbmod IGNORED
mingda_mpx_arm_mini IGNORED
STM32F103CB_malyan IGNORED
FLY_MINI IGNORED
mks_robin_mini IGNORED
mks_robin_lite IGNORED
mks_robin_lite3 IGNORED
mks_robin_pro IGNORED
mks_robin_e3p IGNORED
jgaurora_a5s_a1 IGNORED
STM32F103RC_fysetc IGNORED
STM32F103VE_longer IGNORED
trigorilla_pro IGNORED
trigorilla_pro_disk IGNORED
chitu_f103 IGNORED
chitu_v5_gpio_init IGNORED
STM32F103RC_ZM3E2_USB IGNORED
STM32F103VC_ZM3E4_USB IGNORED
STM32F103VE_ZM3E4V2_USB IGNORED
ARMED IGNORED
FYSETC_CHEETAH_V20 IGNORED
FLYF407ZG IGNORED
FYSETC_S6 IGNORED
FYSETC_S6_8000 IGNORED
FYSETC_SPIDER_KING407 IGNORED
STM32F407VE_black IGNORED
Opulo_Lumen_REV3 IGNORED
Opulo_Lumen_REV4 IGNORED
Anet_ET4_no_bootloader IGNORED
Anet_ET4_OpenBLT IGNORED
BIGTREE_SKR_PRO IGNORED
BIGTREE_SKR_PRO_usb_flash_drive IGNORED
BIGTREE_E3_RRF IGNORED
BIGTREE_GTR_V1_0 IGNORED
BIGTREE_GTR_V1_0_usb_flash_drive IGNORED
BIGTREE_BTT002 IGNORED
BIGTREE_BTT002_VET6 IGNORED
BIGTREE_SKR_2 IGNORED
BIGTREE_SKR_2_USB IGNORED
BIGTREE_SKR_2_USB_debug IGNORED
BIGTREE_SKR_2_F429 IGNORED
BIGTREE_SKR_2_F429_USB IGNORED
BIGTREE_SKR_2_F429_USB_debug IGNORED
BIGTREE_OCTOPUS_V1 IGNORED
BIGTREE_OCTOPUS_V1_USB IGNORED
BIGTREE_OCTOPUS_PRO_V1_F429 IGNORED
BIGTREE_OCTOPUS_PRO_V1_F429_USB IGNORED
BIGTREE_OCTOPUS_V1_F407 IGNORED
BIGTREE_OCTOPUS_V1_F407_USB IGNORED
LERDGEX IGNORED
LERDGEX_usb_flash_drive IGNORED
LERDGES IGNORED
LERDGES_usb_flash_drive IGNORED
LERDGEK IGNORED
LERDGEK_usb_flash_drive IGNORED
rumba32 IGNORED
mks_robin_pro2 IGNORED
mks_robin_nano_v3 IGNORED
mks_robin_nano_v3_usb_flash_drive IGNORED
mks_robin_nano_v3_usb_flash_drive_msc IGNORED
mks_robin_nano_v3_1 IGNORED
mks_robin_nano_v3_1_usb_flash_drive IGNORED
mks_robin_nano_v3_1_usb_flash_drive_msc IGNORED
mks_eagle IGNORED
mks_eagle_usb_flash_drive IGNORED
mks_eagle_usb_flash_drive_msc IGNORED
mks_monster8 IGNORED
mks_monster8_usb_flash_drive IGNORED
mks_monster8_usb_flash_drive_msc IGNORED
TH3D_EZBoard_V2_no_bootloader IGNORED
TH3D_EZBoard_V2_OpenBLT IGNORED
mks_robin_nano_v1_3_f4 IGNORED
mks_robin_nano_v1_3_f4_usbmod IGNORED
Artillery_Ruby IGNORED
STM32F401RC_creality IGNORED
STM32F401RC_creality_jlink IGNORED
STM32F401RC_creality_stlink IGNORED
STM32F401RC_btt IGNORED
mks_skipr_v1 IGNORED
mks_skipr_v1_nobootloader IGNORED
STM32F446_tronxy IGNORED
NUCLEO_F767ZI IGNORED
REMRAM_V1 IGNORED
BTT_SKR_SE_BX IGNORED
STM32H743Vx_btt IGNORED
BTT_EBB42_V1_1_filament_extruder IGNORED
STM32G0B1RE_btt IGNORED
STM32G0B1RE_btt_xfer IGNORED
at90usb1286_cdc IGNORED
at90usb1286_dfu IGNORED
teensy20 IGNORED
teensy31 IGNORED
teensy35 IGNORED
teensy36 IGNORED
teensy41 IGNORED
STM32F103RET6_creality_maple IGNORED
STM32F103RET6_creality IGNORED
STM32F103RET6_creality_xfer IGNORED
STM32F103RC_btt_512K IGNORED
STM32F103RC_btt_512K_USB IGNORED
STM32F103RC_btt_512K_maple IGNORED
STM32F103RC_btt_512K_USB_maple IGNORED
STM32F103RC_meeb IGNORED
STM32F103VE_GTM32 IGNORED
mks_robin_nano35 IGNORED
mks_robin_nano35_maple IGNORED
==================== 1 failed, 0 succeeded in 00:00:04.299 ====================
Then the fault does not originate from directly building a C/C++ source file as part of the firmware, but from from one of Marlin’s extra_scripts invoking the compiler.
One such place could be
so just change this variable to 1
in your Marlin files and retry.
OK. I actually found that in
Marlin/buildroot/share/PlatformIO/scripts/preprocessor.py
Running that, in addition to the other verbose information, I get
"/home/pi/.platformio/packages/toolchain-gccarmnoneeabi/bin/arm-none-eabi-g++" -D__MARLIN_FIRMWARE__
-DNDEBUG -DHAL_STM32 -DUSBCON -DUSBD_USE_CDC -DTIM_IRQ_PRIO=13 -DADC_RESOLUTION=12 -DMCU_STM32F103RE
-DHAL_SD_MODULE_ENABLED -DSS_TIMER=4 -DTIMER_SERVO=TIM5 -DENABLE_HWSERIAL3 -DTRANSFER_CLOCK_DIV=8 -D_
_MARLIN_DEPS__ -w -dM -E -x c++ buildroot/share/PlatformIO/scripts/common-dependencies.h
My understanding of what platformio is doing at this point is clearly deficient. Did it install its OWN version of gcc? That arm-none-eabi-g++ is a substantial program in its own right - I figured it would just be a script to invoke the system g++, but that’s not the case:
pi@octopi:~/Marlin $ file "/home/pi/.platformio/packages/toolchain-gccarmnoneeabi/bin/arm-none-eabi-g++"
/home/pi/.platformio/packages/toolchain-gccarmnoneeabi/bin/arm-none-eabi-g++: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, BuildID[sha1]=fd0d803f6ff2b3e11940e36071c0b1f65d1860bf, not stripped
pi@octopi:~/Marlin $ ls -l "/home/pi/.platformio/packages/toolchain-gccarmnoneeabi/bin/arm-none-eabi-g++"
-rwxr-xr-x 1 pi pi 835932 Jul 2 2020 /home/pi/.platformio/packages/toolchain-gccarmnoneeabi/bin/arm-none-eabi-g++
The entire point of PlatformIO is providing the ecosystem for compiling firmwares with no requirements of preinstalled compilers. PlatformIO downloads the toolchain-gccarmnoneeabi package from the PlatformIO trusted registry, where the PlatformIO staff has initially uploaded the compiler packages and lots of other packages too. PlatformIO does not use the system compiler when compiling embedded firmwares as it cannot be assumed the system has that installed. The only exception of that is when you explicitly tell PlatformIO to build for your native system with the native toolchain, i.e., platform = native
.
And even more, when you want to create a program for an an ARM Cortex Mxx ARMv7e-M based microcontroller (M3, M4, …), you have to use a compiler that can create binaries for that target architecture while running on your computer’s native architecture, aka a cross-compiler. That’s what arm-none-eabi-gcc
is. Using the raspberry pi’s compiler it would just produce a linux-native and ARMv6/7/8 / AArch64 (depending on the used Pi) native binary, that is of absolutely no use for the ARMv7e-M based microcntroller that is supposed to be running the produced firmware.
I understand the need to cross-compile. I thought gcc had been expanded years ago to be able to cross-compile for multiple architectures just by specifying different “back ends” to produce the code. I apologize for my misunderstanding on that point. I’ve come upon this whole PlatformIO business simply out of my need to compile Marlin for my 3D printer, and I’m learning as I go.
That brings me to an interesting situation. The GNU bug report I created is wrong. The cc1plus that is doing the segmentation fault is NOT the system installed cc1plus, but probably this one:
./.platformio/packages/toolchain-gccarmnoneeabi/libexec/gcc/arm-none-eabi/9.3.1/cc1plus
Yeppers. The moment I try to invoke the above, I get the segmentation fault - even with no parameters at all. Can I easily remove and reinstall that? Could it have gotten corrupted during the installation? Since this is an encapsulated distribution where do I go to try to figure this out? Do I delete my gnu bug report, or try to change it to cover this version?
Same segfault with
~/.platformio/packages/toolchain-gccarmnoneeabi/bin/arm-none-eabi-g++ --version
?
No.
pi@octopi:~ $ ~/.platformio/packages/toolchain-gccarmnoneeabi/bin/arm-none-eabi-g++ --version
arm-none-eabi-g++ (xPack GNU Arm Embedded GCC, 32-bit) 9.3.1 20200408 (release)
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
pi@octopi:~ $ ./.platformio/packages/toolchain-gccarmnoneeabi/libexec/gcc/arm-none-eabi/9.3.1/cc1plus
cc1plus: internal compiler error: Segmentation fault
0x769fa10f ???
../sysdeps/unix/sysv/linux/arm/sigrestorer.S:64
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Segmentation fault
pi@octopi:~ $ file ./.platformio/packages/toolchain-gccarmnoneeabi/libexec/gcc/arm-none-eabi/9.3.1/cc
1plus
./.platformio/packages/toolchain-gccarmnoneeabi/libexec/gcc/arm-none-eabi/9.3.1/cc1plus: ELF 32-bit LSB executable, ARM, EABI5 version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, BuildID[sha1]=dcdd1c0ed2d79eb530495158aa34ee422aea943e, not stripped
Okay but that part works. I’m not sure whether you’re supposed to execute cc1plus directly at all like this.
What’s the output of this command? That’s closer to what Marlin would do, but with an empty input file.
~/.platformio/packages/toolchain-gccarmnoneeabi/bin/arm-none-eabi-g++ -w -dM -E -x c++ /dev/null
Does it segfault or print tons of #define
s?
Just segfaults.
pi@octopi:~ $ ~/.platformio/packages/toolchain-gccarmnoneeabi/bin/arm-none-eabi-g++ -w -dM -E -x c++ /dev/null
cc1plus: internal compiler error: Segmentation fault
0x769b810f ???
../sysdeps/unix/sysv/linux/arm/sigrestorer.S:64
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
arm-none-eabi-g++: internal compiler error: Segmentation fault signal terminated program cc1plus
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
Note that when I execute the system installed cc1plus, it just sits waiting for input, or I can run it with “–version” and it silently exits. If I take a “–version” on the end of the toolchain cc1plus, it still segfaults.
Okay, but then this is your minimal example, and that’s with
Sorry - is there an implied action or question here? Not sure what you want me to do at this point.
No, it was just a statement to help on your bug report. That’s the most minimal way to reproduce the error you’re getting, as we’ve found out.
Bug report for GNU? Or whoever is supporting this toolchain? If the latter - how do I reach them? And just to be as rigorous as possible - how would I remove that toolchain and reinstall it?
I think since it’s GCC the bug report in gnu.gcc.org is okay.
From your Marlin project folder:
rm -rf ~/.platformio/packages/toolchain-gccarmnoneeabi
rm -rf ~/.platformio/.cache
pio run
You rock! After removing and reinstalling, it’s compiling! THANK YOU for your kind help and patience with a newbie! How that program got corrupted may remain forever a mystery, but as long as this works, I don’t care.
With all the “verbose” settings, I got literally thousands of warnings in the form of
Marlin/src/HAL/STM32/../../inc/Conditionals_post.h:2177:1: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
but those went away after I turned off the verbose settings. I got some errors about dependent features that needed to be #defined for my config, so I turned those on. … and …
Checking size .pio/build/STM32F103RE_creality/firmware-20230107-152003.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [= ] 11.4% (used 7488 bytes from 65536 bytes)
Flash: [=== ] 29.4% (used 154168 bytes from 524288 bytes)
Building .pio/build/STM32F103RE_creality/firmware-20230107-152003.bin
=================================== [SUCCESS] Took 357.77 seconds ===================================
Environment Status Duration
-------------------- -------- ------------
STM32F103RE_creality SUCCESS 00:05:57.769
==================================== 1 succeeded in 00:05:57.769 ====================================
THANK YOU!!!
Now I need to learn how to use the bootloader across the serial port…