2023-11-28 05:27 AM - edited 2023-11-28 05:31 AM
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?
2024-01-01 07:52 AM
Try the internal builder until a better fix is available.
2024-03-21 12:09 AM
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=$@
2024-04-29 05:40 PM
Hey ST this is still in 1.15.1. Do you plan to fix this or should I look at workarounds?
2024-04-29 06:07 PM
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."
2024-04-29 10:57 PM
Hi Pavel,
Are you suggesting I can make a change to fix the error or is your comment for ST?
Dan
2024-04-29 11:09 PM
The issue has already been reported and it should be addressed with the CubeIDE 1.16 release.
2024-04-30 06:06 AM - edited 2024-04-30 06:07 AM
Comment for ST.
Have you tried to switch to internal builder and get rid of these makefiles altogether?
2024-04-30 06:22 AM - edited 2024-04-30 06:23 AM
Yes, there is no warning but with internal builder is the flash usage 5% bigger.
2024-07-02 02:02 PM
Sadly, seems not, just tried.
Only fix so far was enabling creation of cyclomatic complexity info (the .cyclo file that the make rule declares that wants to build without actually doing that unless the option is checked).
STM should really open source the toolchain, cant' keep up with itself.
2024-07-02 11:21 PM
Unfortunately still not fixed in v1.16.