-
Notifications
You must be signed in to change notification settings - Fork 8.2k
lib: posix: Switch to use zephyr_interface_library_named cmake directive #15937
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lib: posix: Switch to use zephyr_interface_library_named cmake directive #15937
Conversation
|
We are also going to need a APP_LINK_WITH_PTHREAD Kconfig option as shown here: This is to allow the user to opt-out of this feature. |
|
These changes are for #15627, and currently don't work as expected (and thus, should not be merged). Discussion of the issue with these changes are at: #15627 (comment) |
So, current issue is that it simply doesn't work as expected. So, let's leave discussion of opt-out for later. (It would start with the fact that there's opt-in with CONFIG_POSIX_API in the first place.) |
|
Sorry, I meant the design-decision for why this option pattern exists is to allow the user to opt-out of the feature. The feature itself does require the option to be present for it to at all work. This is documented in the usage documentation of the function here: https://github.com/zephyrproject-rtos/zephyr/blob/master/cmake/extensions.cmake#L485 I see now that the wrong word is used in the documentation, it says "should", but should say "must". |
Thanks, that helped, but I now see include order conflicts between libc vs POSIX headers (before they were in right order, now they're in wrong). Investigating... |
de40e1a to
4a51b7e
Compare
|
@PiotrZierhoffer, @tgorochowik: This is an example of trying to improve a little bit build process of POSIX apps. |
4a51b7e to
a0bd9ee
Compare
tests/posix/common/CMakeLists.txt
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code should not be commented out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, and also removed this directive from the other posix test.
db70f68 to
2380a2a
Compare
|
Sorry for taking a while to review, can you rebase and resolve the conflicts. |
lib/posix/Kconfig
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be APP_LINK_WITH_POSIX
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be APP_LINK_WITH_POSIX
No, as explained by @SebastianBoe, this should match the existing config symbols, that's why it's APP_LINK_WITH_PTHREAD.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which existing config symbols? If anything is still using PTHREAD, change it POSIX as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If anything is still using PTHREAD, change it POSIX as well.
But this is not subject of this change. The subject of this change is "lib: posix: Switch to use zephyr_interface_library_named cmake directive".
Exploration of more deep changes to POSIX subsys was done in e.g. #12984 . Feel free to merge it if you like it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But this is not subject of this change. The subject of this change is "lib: posix: Switch to use zephyr_interface_library_named cmake directive".
it becomes a subject of this change when you introduce a new Kconfig using the old name and we will be stuck with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we will be stuck with it.
Why would we be stuck with? We'll change it (and hundreds of other mistakes and bugs in Zephyr) when it comes to it.
All in all, I'll defer to @galak, who assigned me to work on POSIX subsys improvements, regarding whether that should be part of this PR or not. In the meantime, working on other assignment from him, and can't work further on this, beyond keeping the build green.
2380a2a to
df4176f
Compare
df4176f to
5c38c0f
Compare
Done, build is green. |
5c38c0f to
20da625
Compare
|
Rebased on the latest master. |
Historically, it used to be "PTHREAD", which is no longer true, as POSIX subsys offers much more functionality than just Pthreads. Use detailed name, like "posix_subsys", to avoid possible confusion with ARCH_POSIX-related matters. Signed-off-by: Paul Sokolovsky <[email protected]>
20da625 to
0880977
Compare
To let any other zephyr_system_include_directories() directives act first and get these paths in an order allowing Zephyr's stuff override compiler headers. Signed-off-by: Paul Sokolovsky <[email protected]>
This is consistent with how newlib headers are treated, and will have effect of ninlibc headers to be further down in the include order. This is important, because some POSIX subsys headers override those of libc. Without this change, we can't streamline POSIX build config using zephyr_interface_library_named() cmake directive, because includes will be in wrong order. Signed-off-by: Paul Sokolovsky <[email protected]>
Similar to how other sub-libraries are defined in Zephyr tree, e.g. "fs", "lgvl", etc. This is supposed to help with the need to explicitly add posix include path to each and every application using POSIX subsys. Fixes: zephyrproject-rtos#15627 Signed-off-by: Paul Sokolovsky <[email protected]>
This is no longer needed after using zephyr_interface_library_named cmake directive in the POSIX subsys source itself. Signed-off-by: Paul Sokolovsky <[email protected]>
0880977 to
a40cc0d
Compare
Ok, made this PR start with a patch to rename CMake library PTHREAD -> posix_subsys. Rebased on master, CI passes. @nashif, as your feedback is addressed, and I'm not sure if you may be on vacation or away, dismissing your review requesting the rename. |
Request CMake library rename is integrated.
|
@carlescufi, @galak, @ioannisg: Please consider merging this long-waiting, long-approved PR. |
Thanks. No rush on this, anyways (it's a bug fix and can be done after feature freeze) |
Similar to how other sub-libraries are defined in Zephyr tree, e.g.
"fs", "lgvl", etc. This is supposed to help with the need to
explicitly add posix include path to each and every application using
POSIX subsys.
Fixes: #15627