Skip to main content
Associate
April 2, 2025
Solved

Linker optimization error when building SPI DMA project

  • April 2, 2025
  • 2 replies
  • 482 views

I'm trying to build a simple project following the MOOC tutorial video for the STM32 HAL's SPI DMA (https://www.youtube.com/watch?v=s9GCTLd6-AM&list=PLnMKNibPkDnGtuIl5v0CvC81Am7SKpj02&index=52&pp=iAQB0gcJCTgDd0p55Nqk).

I can build the prior SPI projects from the earlier tutorials without a problem, but when I try to build this DMA version, I get the following error.


arm-none-eabi-gcc -o "SPI3.elf" @"objects.list"   -mcpu=cortex-m4 -T"C:\Users\ethos\STM32CubeIDE\workspace_1.18.0\SPI3\STM32F401RETX_FLASH.ld" --specs=nosys.specs -Wl,-Map="SPI3.map" -Wl,--gc-sections -static --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -Wl,--start-group -lc -lm -Wl,--end-group
arm-none-eabi-gcc: fatal error: '-fuse-linker-plugin', but liblto_plugin.dll not found
compilation terminated.
make: *** [makefile:64: SPI3.elf] Error 1
"make -j8 all" terminated with exit code 2. Build might be incomplete.


In each case, I've started with a clean project, and like in the videos, I'm using the NUCLEO with the STM32F401RE.  After getting the error with the DMA project, I can still go back and build the prior SPI projects (so polling version & interrupt version) without any problems.  I tried explicitly adding the -fno-lto flag to the linker options, but nothing changed...


arm-none-eabi-gcc -o "SPI3.elf" @"objects.list"   -mcpu=cortex-m4 -T"C:\Users\ethos\STM32CubeIDE\workspace_1.18.0\SPI3\STM32F401RETX_FLASH.ld" --specs=nosys.specs -Wl,-Map="SPI3.map" -Wl,--gc-sections -static -fno-lto --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -Wl,--start-group -lc -lm -Wl,--end-group
arm-none-eabi-gcc: fatal error: '-fuse-linker-plugin', but liblto_plugin.dll not found
compilation terminated.
make: *** [makefile:64: SPI3.elf] Error 1
"make -j8 all" terminated with exit code 2. Build might be incomplete.


I've searched "C:\ST\STM32CubeIDE_1.18.0\STM32CubeIDE\plugins" and confirmed there is no "liblto_plugin.dll".  
I'm using a recently installed copy of STM32CubeIDE, Version: 1.18.0, Build: 24413_20250227_1633 (UTC).
It's not apparent where the "-fuse-linker-plugin" option is being added.
So, how do I (1) get a version of the IDE that includes the plugin or add the plugin to my existing version, or (2) at least temporarily disable linker optimizations so I can proceed?

Best answer by EThosteson

Jumped back to my Windows machine, found that "liblto_plugin.dll" had been quarantined by Malwarebytes.  Pulled it out of quarantine and everything works as expected. Hopefully this saves someone else some time.

2 replies

Associate
April 3, 2025

An update on this.  I took the same configuration & code, installed STM32CubeIDE on my Linux machine, and it works fine.  So, maybe the DLL is missing in the version I got for Windows or wasn't built when it was installed?  Seems strange for the errors to have been project dependent though.

 

EThostesonAuthorBest answer
Associate
April 10, 2025

Jumped back to my Windows machine, found that "liblto_plugin.dll" had been quarantined by Malwarebytes.  Pulled it out of quarantine and everything works as expected. Hopefully this saves someone else some time.