build system: Add libstdcpp feature and doc#14503
Conversation
|
This is going to need KConfig integration. Can someone give me a pointer? |
|
@benpicco and/or @leandrolanzieri: Can you verify the KConfig integration is correct? In the legacy system a dependency to |
I think there may be a confusion on how features are modelled currently in Kconfig. We are defining these Makefiles
Kconfig Therefore I think that the symbol |
|
OK, how instead can we enforce that no platform provides |
But that is not the case currently using Makefiles right? The feature As we are using |
No. You cannot provide a libstdc++ without C++ support. And Murdock would not let a PR adding But if I understood you correct, this will also be the case when using modules to select the features? Should it be |
I think here you are referring to the fact that we have a test that uses the feature
I'm not sure I understood this. Yes, I think we should provide features from modules (e.g. to provide implementations of APIs as you pointed out in #14123 (comment)) when modules are modelled in Kconfig.
Yes, but those symbols are generated automatically. I was pointing out how I think it should be modelled when we model modules dependencies in Kconfig. I was not asking you to add the modules symbols on this PR as that is part of the next step in migration (we still don't handle module inclusion from Kconfig), we are not there just yet. |
Locally this could be done, but it would result in compile time checks in Murdock failing. So it is enforced that this does not happen in the upstream branch.
OK. I dropped the modules. We should keep in mind that during that step to also model the dependency, so that automatic compile time tests are failing if someone provides |
|
Side-note: could be interesting to re-test #14458 when this is merged, as a few of the problems there were also due to |
|
@leandrolanzieri @benpicco should we trigger murdock on this one now? |
|
Btw: May I squash? |
|
From my side yes |
- Add libstdcpp feature to indicate a platform is providing a libstdc++ implementation ready for use - The existing cpp feature now only indicates a working C++ toolchain without libstdc++. (E.g. still useful for the Arduino compatibility layer.) - Added libstdcpp as required feature were needed - Added some documentation on C++ on RIOT
On FreeBSD, libstdc++ is known to not work with -m32. Thus, we don't provide it feature libstdcpp there.
|
Thanks for the reviews! |
|
On FreeBSD, for |
|
@miri: Can you test with |
I knew I shouldn't have deleted that vagrant image ^^" |
|
Don't worry. Our bug tracker and mailing list is open to FreeBSD users, if the ever need this working. (And IMO the FreeBSD bug tracker might be even a better place to complain for |
The nice thing about vagrant, it just takes time to renew the image ;-), just takes a |
As that also removes diff --git a/boards/native/Makefile.include b/boards/native/Makefile.include
index 944d40653..911fc5761 100644
--- a/boards/native/Makefile.include
+++ b/boards/native/Makefile.include
@@ -51,6 +51,9 @@ ifeq ($(OS_ARCH),x86_64)
LINKFLAGS += -m32
endif
ifeq ($(OS),FreeBSD)
+ ifeq ($(DISABLE_LIBSTDCPP),1)
+ LINKFLAGS += -nodefaultlibs -lc -lm -lpthread
+ endif
ifeq ($(OS_ARCH),amd64)
LINKFLAGS += -m32 -DCOMPAT_32BIT -L/usr/lib32 -B/usr/lib32
endifWith this however, there are still link errors remaining: |
Those could be fixed with But I have no idea about the |
I think I have a feeling, why there used to be a dedicated make target to build with debug flags https://stackoverflow.com/a/62744129 (see also #13423) |
|
Ok, reverting that change does not help... |
|
Booya! diff --git a/boards/native/Makefile.include b/boards/native/Makefile.include
index 944d40653..fdc4ad34b 100644
--- a/boards/native/Makefile.include
+++ b/boards/native/Makefile.include
@@ -51,6 +51,9 @@ ifeq ($(OS_ARCH),x86_64)
LINKFLAGS += -m32
endif
ifeq ($(OS),FreeBSD)
+ ifeq ($(DISABLE_LIBSTDCPP),1)
+ LINKFLAGS += -nodefaultlibs -lgcc_s -lc -lc++ -lm -lpthread
+ endif
ifeq ($(OS_ARCH),amd64)
LINKFLAGS += -m32 -DCOMPAT_32BIT -L/usr/lib32 -B/usr/lib32
endif
diff --git a/cpu/native/Makefile.dep b/cpu/native/Makefile.dep
index a1afcf708..81cdae7b1 100644
--- a/cpu/native/Makefile.dep
+++ b/cpu/native/Makefile.dep
@@ -1,3 +1,12 @@
+ifeq (FreeBSD,$(OS))
+ ifneq ($(DISABLE_LIBSTDCPP),1)
+ # static C++ constructors need guards for thread safe initialization
+ ifneq (,$(filter cpp,$(FEATURES_USED)))
+ USEMODULE += cxx_ctor_guards
+ endif
+ endif
+endif
+
ifneq (,$(filter periph_spi,$(USEMODULE)))
USEMODULE += periph_spidev_linux
endif |
|
Will run the tests again first though :-) |
|
All C++-related tests now succeed in #14458, so I will open a PR. |
Contribution description
libstdcppfeature to indicate a platform is providing a libstdc++ implementation ready for usecppfeature now only indicates a working C++ toolchain without libstdc++. (E.g. still useful for the Arduino compatibility layer.)libstdcppas required feature were neededTesting procedure
make info-boards-supportedshould yield the same results as before (especially the C++ tests and the C++ example should be tested)Issues/PRs references
Suggested in #14481 (comment)
Adds the documentation suggested in: #14466