makefiles/feature_precheck: check libc availability prior deciding usage#15993
makefiles/feature_precheck: check libc availability prior deciding usage#15993kfessel wants to merge 2 commits intoRIOT-OS:masterfrom
Conversation
maribu
left a comment
There was a problem hiding this comment.
this looks much less scary that I had imagined :-)
makefiles/features_precheck.inc.mk
Outdated
| @@ -0,0 +1,17 @@ | |||
| # Check if provided features are available | |||
|
|
|||
| ifneq (,$(filter picolibc,$(FEATURES_PROVIDED)) $(filter newlib,$(FEATURES_PROVIDED))) | |||
There was a problem hiding this comment.
The outer if can be dropped, can't it?
There was a problem hiding this comment.
No it can (i wanted to avoid the rest of the check if not nesecary but the shell checks a only done if the feature is provided).
I will remove it
makefiles/features_precheck.inc.mk
Outdated
| # Check if provided features are available | ||
|
|
||
| ifneq (,$(filter picolibc,$(FEATURES_PROVIDED)) $(filter newlib,$(FEATURES_PROVIDED))) | ||
| ifneq (,$(filter picolibc,$(FEATURES_PROVIDED))) |
There was a problem hiding this comment.
You need to white-list this file in dist/tools/buildsystem_sanity_check/check.sh:75. Please also update the comment in the line above.
There was a problem hiding this comment.
You need to white-list this file in
dist/tools/buildsystem_sanity_check/check.sh:75. Please also update the comment in the line above.
Huh? This completely bypasses the intention of the check...
There was a problem hiding this comment.
No, this was added when FEAUTES_OPTIONAL was added to replace the paddern
ifneq (,$(filter foo,$(FEAUTRES_PROVIDES)))
USEMODULE += optional_submodule
endifThe intention was to enforce the use of FEATURES_OPTIONAL instead. But this here is unrelated.
There was a problem hiding this comment.
No, this was added when
FEAUTES_OPTIONALwas added to replace the paddernifneq (,$(filter foo,$(FEAUTRES_PROVIDES))) USEMODULE += optional_submodule endifThe intention was to enforce the use of
FEATURES_OPTIONALinstead. But this here is unrelated.
I'm not sure I understand, FEATURES_OPTIONAL should not be checked either, only FEATURES_USED. The buildsystem check is there so that there are no conditionals against FEATURES_OPTIONAL, FEATURES_PROVIDED, FETURES_REQUIRED, see original or #10179 and
RIOT/dist/tools/buildsystem_sanity_check/check.sh
Lines 56 to 75 in 3a9f8d5
makefiles/features_precheck.inc.mk
Outdated
| ifneq (,$(filter picolibc,$(FEATURES_PROVIDED))) | ||
| # Test if picolibc.specs is available | ||
| ifneq ($(shell $(LINK) -specs=picolibc.specs -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0) | ||
| FEATURES_PROVIDED := $(filter-out picolibc,$(FEATURES_PROVIDED)) |
There was a problem hiding this comment.
Maybe just use FEATURES_BLACKLIST? That way it would be more obvious that the feature is not provided due to the setup, rather than due to missing upstream support.
There was a problem hiding this comment.
seem reasonable i test if it keeps working and change
There was a problem hiding this comment.
BLACKLISTING does not work as intended
There was a problem hiding this comment.
as i just saw you also fixed the Blacklist problem i had in #15973
fjmolinas
left a comment
There was a problem hiding this comment.
NACK, didn't look at the other changes yet, but I'm against moving the include order.
| # Include Board and CPU configuration | ||
| INCLUDES += $(addprefix -I,$(wildcard $(BOARDDIR)/include)) | ||
| include $(BOARDDIR)/Makefile.include | ||
| INCLUDES += -I$(RIOTCPU)/$(CPU)/include | ||
| include $(RIOTCPU)/$(CPU)/Makefile.include | ||
|
|
||
| # Import all toolchain settings | ||
| include $(RIOTMAKE)/toolchain/$(TOOLCHAIN).inc.mk |
There was a problem hiding this comment.
This is reverting a long effort of changing the order of inclusion: #9913
There was a problem hiding this comment.
we can also have a error message telling the user that he has to blacklist the provided but not exiting toolchain that the dependency solver prefered for a reason unknown to the user (maybe it was listed first somewhere, or it is alphanumerical first)
makefiles/features_precheck.inc.mk
Outdated
| ifneq (,$(filter picolibc,$(FEATURES_PROVIDED))) | ||
| # Test if picolibc.specs is available | ||
| ifneq ($(shell $(LINK) -specs=picolibc.specs -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0) | ||
| FEATURES_PROVIDED := $(filter-out picolibc,$(FEATURES_PROVIDED)) |
There was a problem hiding this comment.
This is not declarative, FEATURES so far are declarative.
There was a problem hiding this comment.
I think: I fixed that with blacklisting as @maribu suggested
@kfessel can you explain the reasoning for this change better? |
| # provide this macro | ||
| TOOLCHAINS_SUPPORTED ?= gnu | ||
| # Import all toolchain settings | ||
| include $(RIOTMAKE)/toolchain/$(TOOLCHAIN).inc.mk |
There was a problem hiding this comment.
Isn't this is the only thing that needs to be moved?
There was a problem hiding this comment.
No, we need access to the specific toolchain therefore the cpu prefix definition has to move up
(can't ask x86 gcc if picolibc for arm is available)
| ifneq (,$(filter picolibc,$(FEATURES_PROVIDED))) | ||
| # Test if picolibc.specs is available | ||
| ifneq ($(shell $(LINK) -specs=picolibc.specs -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0) | ||
| FEATURES_BLACKLIST += picolibc | ||
| endif | ||
| endif |
There was a problem hiding this comment.
Why is there a need to check if the FEATURE is provided? Can't you simply blacklist if not present?
There was a problem hiding this comment.
as you guessed it is to avoid the shell call, if not need, and why should we auto blacklist something no one is talking about.
There was a problem hiding this comment.
This is what I mean BTW:
Lines 176 to 179 in a5b9136
picolibc most of the time anyway, we will want to call this at least once.
| ifneq (,$(filter picolibc,$(FEATURES_PROVIDED))) | ||
| # Test if picolibc.specs is available | ||
| ifneq ($(shell $(LINK) -specs=picolibc.specs -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0) | ||
| FEATURES_BLACKLIST += picolibc | ||
| endif | ||
| endif |
There was a problem hiding this comment.
| ifneq (,$(filter picolibc,$(FEATURES_PROVIDED))) | |
| # Test if picolibc.specs is available | |
| ifneq ($(shell $(LINK) -specs=picolibc.specs -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0) | |
| FEATURES_BLACKLIST += picolibc | |
| endif | |
| endif | |
| # Test if picolibc.specs is available | |
| ifneq ($(shell $(LINK) -specs=picolibc.specs -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0) | |
| FEATURES_BLACKLIST += picolibc | |
| endif |
Is it as it is now to avoid the shell call? In that case, I would assign it to a variable once and the check that variable, similar to what is done with OS.
There was a problem hiding this comment.
maybe we should but i do not see a huge performance penalty atm.
I will have a look at OS.
There was a problem hiding this comment.
So this can be used to opportunistically enable picolibc and fall back to newlib if it's not installed?
Shouldn't the first step be testing it as the default libc in the ci?
|
will rebase to solve for conflicting change in master |
1d9b00b to
94bb72d
Compare
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions. |
|
So this can be used to opportunistically enable picolibc and fall back to newlib if it's not installed? |
yes this was the intention the stall:bot is digging deep :nice: without picolibc-arm... on the system: since #16008 got merged is at least failing loud providing a kinda fix with this PR it would just fallback to use newlibc |
|
Can you give it a rebase? |
|
My change requests still stand here. |
|
Thinking about this again I'm still against it, if we change to have If we move to Features so far are all declarative, I do not see the need to change because of |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions. |
94bb72d to
29d5dfe
Compare
Contribution description
Add a feature pre-check for picolibc and newlibc into the make process
Testing procedure
make things with either having or not having picolibc or newlib installed
Issues/PRs references
Fixes #15325
@maribu , @nmeum , @benpicco : might what to have a look at it