Skip to main content
Motla1
Associate II
July 2, 2026
Solved

[Bug] Can't use LTO (-flto) on macOS, because GNU Tools for STM32 is located in "Application Support" folder which contains a space

  • July 2, 2026
  • 1 reply
  • 58 views

Create a new project on macOS using STM32CubeIDE for VSCode.

In the CMakeLists.txt file, add:

add_link_options(-flto=auto -ffat-lto-objects)

Build the project.

You should get a linker error like this, because GNU Tools for STM32 is located in the “Application Support” folder which contains a space, so lto-wrapper can’t manage to access its dependencies:

[build] Linking C executable core_mcu_firmware.elf
[build] make[3]: /Users/romain/Library/Application: Permission denied
[build] make[3]: /Users/romain/Library/Application: Permission denied
[build] make[3]: *** [/var/folders/hb/49ldjdz961l9dtpyqq8dqhcr0000gn/T//ccLALceE.ltrans1.ltrans.o] Error 1
[build] make[3]: *** Waiting for unfinished jobs....
[build] make[3]: *** [/var/folders/hb/49ldjdz961l9dtpyqq8dqhcr0000gn/T//ccLALceE.ltrans0.ltrans.o] Error 1
[build] lto-wrapper: fatal error: make returned 2 exit status
[build] compilation terminated.
[build] /Users/romain/Library/Application Support/stm32cube/bundles/gnu-tools-for-stm32/14.3.1+st.2/bin/../lib/gcc/arm-none-eabi/14.3.1/../../../../arm-none-eabi/bin/ld: error: lto-wrapper failed
[build] collect2: error: ld returned 1 exit status

 

Best answer by Motla1

@Cartu38 OpenDev Yep, that worked perfectly! Thank you!

you can change it in command line with: 

cube --set cube_bundle_path <path>

and check: 

cube --get-current-value cube_bundle_path

 

MNA

https://community.st.com/stm32cubeide%2Dfor%2Dvisual%2Dstudio%2Dcode%2Dmcus%2D133/stm32%2Dvscode%2Dclangd%2Dnot%2Dworking%2Dunder%2Dwindows%2Dwith%2Dspace%2Din%2Duser%2Dfolder%2D161573?postid=728022#post728022

1 reply

Cartu38 OpenDev
Graduate II
July 10, 2026

@Motla1 
Maybe clue is to locate yourself bundles repository to a more convinient place. See 

 

Motla1
Motla1AuthorBest answer
Associate II
July 11, 2026

@Cartu38 OpenDev Yep, that worked perfectly! Thank you!

you can change it in command line with: 

cube --set cube_bundle_path <path>

and check: 

cube --get-current-value cube_bundle_path

 

MNA

https://community.st.com/stm32cubeide%2Dfor%2Dvisual%2Dstudio%2Dcode%2Dmcus%2D133/stm32%2Dvscode%2Dclangd%2Dnot%2Dworking%2Dunder%2Dwindows%2Dwith%2Dspace%2Din%2Duser%2Dfolder%2D161573?postid=728022#post728022