-
Notifications
You must be signed in to change notification settings - Fork 166
Auto-detection of <threadapi> based on <target-os> #160
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
Conversation
* <threadapi> has an additional value "native" which is the default. If build request doesn't specify other value, it is replaced either with "pthread" or "win32" depending on <target-os>. * <tag> modifies name of generated library only if resulting <threadapi> value differs from one that would have been chosen to replace "native" according to <target-os>.
Hi, I'm not an expert on Bjam. AFAIK, the default is already the native, isn't it? |
Currently the default value for
Here I'm trying to cross-compile for QNX and my native API is Even if I explicitly specify |
I don't understand how that tag is used. Could you help me? What should be the name of the library depending on and ? |
Hi, in https://ci.appveyor.com/project/viboes/thread/build/1.0.57-develop we see some issues with
|
When Boost.Thread is compiled with non-native For Windows it's possible to use both options, and we'll get the names On other platforms native variant (and perhaps the only one) is Boost.Build can also add its own suffixes not considered here. |
Thanks for the explanation about the tag. Any comment about the regression for native_handle? |
The native_handle test run as follows
where thread-run2-noit-pthread is defined as https://github.com/boostorg/thread/blob/develop/test/Jamfile.v2#L163
It is like with your changed I suspect that the default Do you know how to fix this? |
I tried to change the |
Regression (I hope) is fixed. Perhaps there is a more elegant solution, but I just added the same detection logic into "test/Jamfile.v2". |
Yes. This was the route cause and it fixes the issue for Boost.Thread tests. We need however to add it on the usage-requirement, otherwise any other library that depends on Boost.Thread will have the same issue, isn't it? |
You're right. But I'm not an expert on Bjam too:) |
Would you mind to check with the Boost.Build experts what can be done here? |
I would be grateful for expert advice:) So, we have:
I'm not sure but the latter, probably, causes target to be build with each of feature values separately (for non-free features). The questions:
Please correct me if I'm mistaken somewhere (especially in describing the problem). |
I've send a mail to the Boost.Build ML (boost-build@lists.boost.org) |
build/Jamfile.v2
Outdated
} | ||
|
||
feature.feature threadapi : native pthread win32 : propagated ; | ||
feature.feature threadapi : pthread win32 : optional propagated ; |
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.
I don't know too much of bjam, but shouldn't this go to the threadapi.jam file?
test/Jamfile.v2
Outdated
@@ -18,7 +18,7 @@ | |||
|
|||
# bring in rules for testing | |||
import testing ; | |||
import property-set ; | |||
import threadapi ; |
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.
Does it mean that now any Boost library that needs Boost.Thread needs to import threadapi.jam?
test/Jamfile.v2
Outdated
@@ -107,24 +107,9 @@ project | |||
<toolset>msvc:<cxxflags>/wd4512 | |||
<toolset>msvc:<cxxflags>/wd6246 | |||
|
|||
<conditional>@detect_threadapi | |||
<conditional>@threadapi.detect |
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.
.... and declare this conditional?
This looks quite good. Andrey, what do you think about this PR? |
Hi,
Definition of |
Ok, so we need to add some documentation for the projects that would use threadapi. If you don't know how to do it, you can post the text here. I don't see anything about the libraries that can be built depending on the parameters. It will be a good occasion to add it. |
I'm not a Boost.Build expert, but the intention seems valid. I'm not sure I understood it though - will this change require modification of users' projects? There are a few dependent libraries in Boost and probably quite a few Boost.Build-based projects out there as well. It would be preferable if those continued to compile as they are. |
The default has changed. Instead of been derived from the os.name it is derived from the . The deduced with the default is the same as the one deduced previously with os.name so I don't believe there will be any regression. Now if the user set the target-os he will obtain the good library. |
I've decided to merge it and see how it behaves on regression tests. We could fix it later if there is some issue or rollback this change. |
@karzhenkov Thanks you very much for working on this feature/fix. |
But then |
I believe that it needed changes because the intermediary change defaulted threadapi to native. I believe that https://github.com/boostorg/thread/blob/develop/test/Jamfile.v2#L21 and https://github.com/boostorg/thread/blob/develop/test/Jamfile.v2#L110 shouldn't be needed now. @karzhenkov could you confirm? |
I've tried commenting these lines and everything is ok for the moment. The test takes some time. |
I think, usage requirements is unsuitable instrument here. They are intended for free features only (Boost.Build ML). And they are added to the property set after selecting target alternatives (The Build Process), This can be important. A project that needs to know the underlaying threading API when building Nevertheless, I believe that the impact of this PR on other projects will not be critical:
|
Hi, well the test seems to say that we need to uncomment :( https://ci.appveyor.com/project/viboes/thread/build/1.0.108-develop As you said , the native_handle error are there :( This will mean that we have potentially break some users that use . I believe the number of concerned user should be small enough compared to the number of users that could benefit from this feature. |
@karzhenkov We need to advertise this on the documentation. Have you time to work on this? |
@karzhenkov The results confirm what you said. https://ci.appveyor.com/project/viboes/thread/build/1.0.111-develop |
Well, I could spend some time to describe the potentially breaking changes. However, I would like to understand how dangerous they are. The The value of The changes concern users invoking The former may provide Perhaps some caveats are required for jam-programmers who may rely on undocumented behavior. I think that most likely there are no such projects. Do we really have potentially breaking changes? As of the work on the documentation in more general sense, I will consider this possibility, but it will not be too fast. |
You are surely right, maybe there are no such project. Don't worry for the documentation. I'll try to do my best. |
Yes, I use on both Windows and Linux to cross compile for VxWorks. b2 cross-compile=vxworks with
Auto detection with cross-compilation while admirable is often broken, I'm happy if isn't confused with in the jam scripts. |
Hi karzhenkov, I have a report that the develop branch is broken. The user is doing the following in a linux platform
and here it is what he gets
I'll try to reproduce this from a clean repository. From my side I just have run the tests from the test directory as
and every thing worked correctly. |
Adding |
Hi I used standard command from Boost top-level directory:
It works with gcc (mingw-w4) and with qcc (for QNX). The error occurs with the following command:
This is a problem, and I have no solution yet. This command requests the compilation of In fact, these versions are identical: Maybe there is a way to tell Another idea (also not ideal) is to include the Maybe the Boost.Build ML will help. |
You can see my post to the ML http://boost.2283326.n4.nabble.com/PR-to-cross-compiling-Boost-Thread-Help-needed-tt4698930.html No response for the moment :( I wonder how is it that the regression test are working. Are all the testers using If |
I think Bjam is not perfect. It can't scale well, as creates new builds for older projects when new ones define their own features. Regression tests may succeed because they probably don't cause the I propose to move |
@kuhlenough You probably get different names for |
Yes, when compiling on Windows I add. |
Currently Boost.Thread selects the default
<threadapi>
value based on host system name. How to make it dependent of<target-os>
was discussed in tickets #3393 and #7706. My solution is somewhat similar to this proposal but also allows<threadapi>
to be specified in build request and improves the<tag>
feature behavior:<threadapi>
has an additional valuenative
which is the default.If build request doesn't specify other value, it is replaced
either with "pthread" or "win32" depending on
<target-os>
.<tag>
modifies name of generated library only if resulting<threadapi>
value differs from one that would have been chosen to replace
native
according to
<target-os>.