Skip to content

Conversation

@pfalcon
Copy link
Contributor

@pfalcon pfalcon commented May 6, 2019

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

@SebastianBoe
Copy link
Contributor

We are also going to need a APP_LINK_WITH_PTHREAD Kconfig option as shown here:

4c60c51

This is to allow the user to opt-out of this feature.

@pfalcon
Copy link
Contributor Author

pfalcon commented May 6, 2019

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)

@pfalcon
Copy link
Contributor Author

pfalcon commented May 6, 2019

We are also going to need a APP_LINK_WITH_PTHREAD Kconfig option as shown here:

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.)

@SebastianBoe
Copy link
Contributor

SebastianBoe commented May 6, 2019

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".

@pfalcon
Copy link
Contributor Author

pfalcon commented May 6, 2019

The feature itself does require the option to be present for it to at all work.

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...

@pfalcon pfalcon force-pushed the posix-zephyr_interface_library branch from de40e1a to 4a51b7e Compare May 6, 2019 16:35
@pfalcon
Copy link
Contributor Author

pfalcon commented May 7, 2019

@PiotrZierhoffer, @tgorochowik: This is an example of trying to improve a little bit build process of POSIX apps.

@pfalcon pfalcon force-pushed the posix-zephyr_interface_library branch from 4a51b7e to a0bd9ee Compare June 6, 2019 14:32
@pfalcon pfalcon requested review from andrewboie and nashif as code owners June 6, 2019 14:32
@pfalcon pfalcon changed the title [DNM] lib: posix: Switch to use zephyr_interface_library_named cmake directive lib: posix: Switch to use zephyr_interface_library_named cmake directive Jun 6, 2019
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@galak
Copy link
Contributor

galak commented Jun 17, 2019

Sorry for taking a while to review, can you rebase and resolve the conflicts.

nashif
nashif previously requested changes Jun 17, 2019
Copy link
Member

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

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

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.

@pfalcon pfalcon force-pushed the posix-zephyr_interface_library branch from 2380a2a to df4176f Compare June 18, 2019 09:48
@zephyrbot zephyrbot added area: C Library C Standard Library area: Tests Issues related to a particular existing or missing test labels Jun 18, 2019
@pfalcon pfalcon force-pushed the posix-zephyr_interface_library branch from df4176f to 5c38c0f Compare June 18, 2019 16:24
@pfalcon
Copy link
Contributor Author

pfalcon commented Jun 18, 2019

@galak

can you rebase and resolve the conflicts.

Done, build is green.

@pfalcon
Copy link
Contributor Author

pfalcon commented Jul 1, 2019

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]>
@pfalcon pfalcon force-pushed the posix-zephyr_interface_library branch from 20da625 to 0880977 Compare August 8, 2019 06:30
pfalcon added 4 commits August 8, 2019 12:08
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]>
@pfalcon pfalcon force-pushed the posix-zephyr_interface_library branch from 0880977 to a40cc0d Compare August 8, 2019 09:14
@pfalcon
Copy link
Contributor Author

pfalcon commented Aug 8, 2019

should be APP_LINK_WITH_POSIX

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.

@pfalcon pfalcon dismissed nashif’s stale review August 8, 2019 11:22

Request CMake library rename is integrated.

@pfalcon
Copy link
Contributor Author

pfalcon commented Aug 8, 2019

@carlescufi, @galak, @ioannisg: Please consider merging this long-waiting, long-approved PR.

@ioannisg ioannisg added the bug The issue is a bug, or the PR is fixing a bug label Aug 8, 2019
@ioannisg
Copy link
Member

ioannisg commented Aug 8, 2019

@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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Build System area: C Library C Standard Library area: POSIX POSIX API Library area: Tests Issues related to a particular existing or missing test bug The issue is a bug, or the PR is fixing a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Application compiled with CONFIG_POSIX_API doesn't have access to POSIX headers

8 participants