cancel
Showing results for 
Search instead for 
Did you mean: 

Compilation failure after upgrade to STM32CubeMX 6.15

Ykrons
Visitor

Hi,

I have upgraded recently to STM32CubeMX 6.15 on Linux and regenerate code for my STM32G491RE project (that uses iostream). Since this, it gives me compilation errors on missing libc symbols (for example putwc).

 

After investigations, it seems the linker script generated has changed and I wonder if it is expected.

Last part of the script has changed from:

/DISCARD/ :
{
libc.a ( * )
libm.a ( * )
libgcc.a ( * )
}

to

/DISCARD/ :
{
libc.a:* ( * )
libm.a:* ( * )
libgcc.a:* ( * )
}

 

Could you confirm this is valid and the expected behavior of the new declaration ?

 

Regards

 

3 REPLIES 3
Andrew Neil
Super User

Welcome to the forum

Please see How to write your question to maximize your chances to find a solution for best results

What version of CubeMX did you upgrade from ?

Not clear if you're trying to use an old CubeMX Project (ioc file) in your new CubeMX ?

If you create a new project from scratch using the the new CubeMX, does that work?

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
Ghofrane GSOURI
ST Employee

Hello @Ykrons 

Could you please provide more details about the version of you operating system ?

THX

Ghofrane

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Ykrons
Visitor

Hi,

Sorry I have missed a lot of details.

First, I'm using STM32CubeMX v6.15 installed on XUbuntu 24.04.03. CMake is v3.28.3 and gcc v14.2 from arm.

I'm creating a new project in STM32CubeMX for Nucleo-G491RE board keeping all default options, then changes Toolchain/IDE to "CMake" and generate the code.

Then I can successfully build with:

  • cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=cmake/gcc-arm-none-eabi.cmake -G "Unix Makefiles" -S . -B build/
  • cmake --build build

Then I'm adding C++ iostream usage:

  • I rename main.c into main.cpp (and update the CMakeLists.txt accordingly) to switch to C++
  • I add iostream usage in main.cpp:
    • #include <iostream> at the top
    • std::cout << "Test" << std::endl; somewhere in the main method

A rebuild now fails reporting undefined reference for putwc/getwc.

Ykrons_0-1757417761280.png

Then I change the linker script to end with the following extract (:* removed) and it solves the compilation failure:

/DISCARD/ :
{
libc.a ( * )
libm.a ( * )
libgcc.a ( * )
}

 

Regards