sys/posix: make posix module provide only headers.#10357
sys/posix: make posix module provide only headers.#10357miri64 merged 1 commit intoRIOT-OS:masterfrom
Conversation
cpu/esp32/Makefile.dep
Outdated
| USEMODULE += vfs | ||
| export SPIFFS_STD_OPTION = -std=c99 | ||
| INCLUDES += -I$(RIOTBASE)/sys/include | ||
| # Why is this include here? |
There was a problem hiding this comment.
@gschorcht Why is this INCLUDES += needed? The "use vfs" should have the headers to be included anyways. Is it some build system weirdness?
There was a problem hiding this comment.
@jcarrano Honestly? I can not remember anymore. Probably, these includes were needed during the port sometime in between for the compilation before I could solve all dependencies.
There was a problem hiding this comment.
@jcarrano BTW, I have tested it without this include, it seems to be compilable.
There was a problem hiding this comment.
@jcarrano Please, let me take a deeper look tomorrow or the day after tomorrow, with command
USEMODULE=esp_now make flash BOARD=esp32-wroom-32 -C examples/gnrc_networking
I get now compile errors. This is new 😟
There was a problem hiding this comment.
I could solve this problem. I will provide a pull request which removes these INCLUDES.
|
|
||
| include $(RIOTCPU)/$(CPU)/Makefile.include | ||
|
|
||
| # Why are these includes here (this is a module) |
There was a problem hiding this comment.
@gschorcht Same thing here. Why was it necessary to manually edit "INCLUDES"? I want to know if I can take out the INCLUDES += -I$(RIOTBASE)/sys/posix/include
There was a problem hiding this comment.
@jcarrano Unfortunatly, this is much more tricky. If you take a look at line 8, you will find
INCLUDES = -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/wpa_supplicant/port/include
verwrites all includes defined by $(RIOTBASE)/Makefile.base. This was necessary to change the order of include pathes. Otherwise, header files from $(RIOTBASE)/sys/include/crypto would be used instead of the header files from $(ESP32_SDK_DIR)/components/wpa_supplicant/include/crypto which are in conflict. Maybe there is a better approach, but I couldn't figure out one in the very complex make structure of RIOT when I was porting RIOT to ESP32.
I'm not really sure, I tried to comment out both include lines from $(RIOTBASE)/sys/. It seems to be compilabe without them. Maybe, there not needed anymore and can be removed.
There was a problem hiding this comment.
Finally, I figured out what the reason for these INCLUDES was. Let's suppose you try to compile an application for ESP32 with activated WiFi netdev, e.g. the esp_now module, together with the spiffs package with command:
USEMODULE="spiffs esp_now" make BOARD=esp32-wroom-32 -C tests/shell
- Package
spiffsdepends on modulesmtdandvfs. - If module
mtdis used, the board definition includesmtd.hto declare the default MTD devicemtd0. This is done in the same way innativeandmulleboard definitions. mtd.hincludesvfs.hif modulevfsis enabled.vfs.hincludessys/statvfs.hwhich is found insys/posix/include/sys/statvfs.h.
Because of conflicts between the header files $(ESP32_SDK_DIR)/components/wpa_supplicant/include/crypto used by the ESP32 WiFi modules and $(RIOTBASE)/sys/include/crypto, we have to ensure that the include order is the following:
-I$(ESP32_SDK_DIR)/components/wpa_supplicant/include/crypto
-I$(RIOTBASE)/sys/include/
Unfortunately, I could not find a way to get the include paths of a module in front of RIOT's standard include paths in the INCLUDES variable. Therefore, I had to set INCLUDES for this module from scratch including $(RIOTBASE)/sys/posix/include 😟
Maybe you, @cladmi or @kaspar030 have an idea how to deal with such a case.
There was a problem hiding this comment.
@gschorcht I have seen this inconsistency a while a go but did not have any applied reason to change it except "it looks weird", now there is one :)
For me it feels like the https://github.com/RIOT-OS/RIOT/blob/master/Makefile.include#L239 line should be after processing board and cpu Makefile.include, even after the toolchain and newlib headers (that basically trick this and overwrites the deferred value of INCLUDES
Lines 84 to 89 in 98f42ee
There was a problem hiding this comment.
I just noticed that your issue is for one module makefile and that the header is required for this module only.
For me it is the same case as we have for the NATIVEINCLUDES where implementing the board specific modules require specific includes and do not even need to see RIOT headers.
You basically want to define a ESP32_VENDORMODULE_INCLUDES.
008f5e6 to
2797cd9
Compare
|
I already noticed this issue with dependencies on headers only. As these functions are defined in @miri64 you may have more background on this. I agree with the direction, just want some more feedback. |
|
It looks like also more modules should depend on the new module: |
2797cd9 to
0ce7fda
Compare
|
From your list:
|
miri64
left a comment
There was a problem hiding this comment.
The change is making sense mostly. Just one dependency is missing (which would make one addition redundant)
|
Also for clarity, maybe name the module |
Wouldn't that be too big of an API change? |
Mh isn't it that already... What I see is that you are currently introducing a lot of dependencies on a "new" pseudo-module |
7ba47d8 to
6b766c3
Compare
The build system contains several instances of INCLUDES += -I$(RIOTBASE)/sys/posix/include This is bypassing the module management system, by directly accesing headers without depending on a module. The module is the posix module. That line is also added when one of the posix_* modules is requested. According to the docs, the posix module provides headers only, but in reality there is also inet.c. This patch: - Moves `inet.c` into `posix_inet`, leaving `posix` as a headers-only module. - Rename `posix` as `posix_headers` to make it clear the module only includes headers. - Makes `posix_*` modules depend on `posix_headers`, thus removing the explicit `INCLUDES+=...` in `sys/Makefile.include`. - Ocurrences of `INCLUDES+=...` are replaced by an explicit dependency on `posix_headers`.
|
I changed it to posix_headers and squashed. |
miri64
left a comment
There was a problem hiding this comment.
ACK. Though I agree that the CI should catch all relevant errors if they exist, I sampled some applications, just to be sure:
examples/ccn-lite-relayexamples/posix_socketstests/gnrc_sock_dnstests/pkg_libcoap
Contribution description
The build system contains several instances of
This is bypassing the module management system, by directly accesing headers without depending on a module. The module is the
posixmodule.That line is also added when one of the posix_* modules is requested.
According to the docs, the
posixmodule provides headers only, but in reality there is also inet.c.This patch:
inet.cintoposix_inet, thus leavingposixas a headers-only module.posix_*modules depend onposix, thus removing the explicitINCLUDES+=...insys/Makefile.include.INCLUDES+=...are replaced by an explicit dependency onposix.Testing procedure
This is a build system change, that should not change any behaviour. If I screwed up the CI should catch any modules that fail to build.