Skip to main content
SKape
Associate II
Question

STM32CubeIDE 1.14.0 flto build warning

Hello. I have the following problem. When I enable flto optimization in a (freshly generated) project, several dozen warnings appear during compilation.

Sample warnings:

Drivers/STM32L4xx_HAL_Driver/Src/subdir.mk:88: warning: pattern recipe did not update peer target 'Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_cortex.su'.

Drivers/STM32L4xx_HAL_Driver/Src/subdir.mk:88: warning: pattern recipe did not update peer target 'Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal.cyclo'.

This problem was not present on the previous version 1.13.2

How to solve this problem?

    27 replies

    ST Technical Moderator

    Hello @SKape

    First let me thank you for posting.

    Could you please provide the exact parameter settings that you used in order to reproduce your issue.

    I will be waiting for your feedback.

    Thx

    Souhaib 

    To give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.
    SKape
    SKapeAuthor
    Associate II

    I'm generating a new one STM32 project using Wizard, for example for STM32F103CB.
    In the project settings, in the compiler options (Tool Settings/MCU GCC Compiler/Miscellaneous/Other flags), I add the -flto option.
    I add the same to the linker options. And that's all.
    34 warnings appear during compilation.

    SKape
    SKapeAuthor
    Associate II

    @Souhaib MAZHOUD Were you able to reproduce the issue?

    ST Technical Moderator

    Hello @SKape 
    Yes, this problem is reproduced in my side, I will check it internally and get back to you as soon as possible.

    Thank you

    To give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.
    ST Technical Moderator

    Hello again,

    After check, this issue is reported internally to our team (Internal ticket number: 167964) and this will be fixed as soon as possible.

    Thank you!

    Souhaib

    To give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.
    AHoll.2
    Associate II

    Hello,

    i'd like to add, that i get the same problem (lots of "pattern recipe did not update peer target" from the build output, CubeIDE 1.14.0, STM32G474), but for a different reason (not using "-flto).

    I use "-Wswitch-enum" for the whole project, but explicitly removed this setting for the "Driver" file tree.

    Please also see here for a possible useful hint:

    https://stackoverflow.com/questions/74449959/makefile-warning-pattern-recipe-did-not-update-peer-target

    It seems this problem was introduced by version 4.4 of gnu-make.
    So can i go back to pre-4.4 in CubeIDE, or is it hard-coded?

    Thanks and BR,
    Albert

    Pavel A.

    Try the internal builder until a better fix is available.

     

    MD.8
    Associate

    Having the same issue

    Explorer

    I have also the same issue...

    Schmidt.Andreas
    Explorer

    I also use the -flto flag, so I got the same warnings....

     

    BR

    Andreas

    CsBe
    Explorer II

    The warning still exists with STM32CubeIDE 1.15.0.

    The current plan is that in the next release of GNU make, this will become an error not a warning. So you should address it now. The reason for the change is that there are other errors in how GNU make handles patterns that cannot be fixed without changing this.

    The problem is this rule:

    %-seq %-par :: %.cpp force
     $(MAKE) do_complicated_stuff src=$< TGT=$@

    I'm not sure what you intend for this rule to actually do, but what it tells make it will do is a single invocation of this recipe will create both targets %-seq and %-par. That's what multiple patterns in a single rule means, and has always meant.

    If your recipe does not actually build both of those targets then you will see this issue.

    The simplest thing to do is write the rule twice, once for each target, which will work on all versions of GNU make and was always the correct way to write it:

    %-seq :: %.cpp force
     $(MAKE) do_complicated_stuff src=$< TGT=$@
    %-par :: %.cpp force
     $(MAKE) do_complicated_stuff src=$< TGT=$@

     

    Associate III

    Hey ST this is still in 1.15.1. Do you plan to fix this or should I look at workarounds? 

    Pavel A.

    https://www.gnu.org/software/make/manual/html_node/Pattern-Intro.html

    "Pattern rules may have more than one target; however, every target must contain a % character. Multiple target patterns in pattern rules are always treated as grouped targets (see Multiple Targets in a Rule) regardless of whether they use the : or &: separator.

    There is one exception: if a pattern target is out of date or does not exist and the makefile does not need to build it, then it will not cause the other targets to be considered out of date. Note that this historical exception will be removed in future versions of GNU make and should not be relied on. If this situation is detected make will generate a warning pattern recipe did not update peer target; however, make cannot detect all such situations. Please be sure that your recipe updates all the target patterns when it runs."

     

    Associate III

    Hi Pavel,

    Are you suggesting I can make a change to fix the error or is your comment for ST? 

    Dan

     

     

     

     

     

     

    Pavel A.

    Comment for ST.

    Have you tried to switch to internal builder and get rid of these makefiles altogether?

    CsBe
    Explorer II

    Yes, there is no warning but with internal builder is the flash usage 5% bigger.