Skip to content
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

[wxwidgets] make wxUSE_STL an optional triplet feature disabled by default #19274

Merged
merged 1 commit into from
Aug 19, 2021

Conversation

Be-ing
Copy link
Contributor

@Be-ing Be-ing commented Aug 1, 2021

wxUSE_STL defaults to OFF so that is how it is in Linux
distribution packages. Downstream projects developed with
wxUSE_STL=ON are not necessarily compatible with wxUSE_STL=OFF
without modification. So, by default, go with wxWidgets' default
for compatibility with downstream codebases. vcpkg users who need
wxUSE_STL=ON can still do so by simply opting into the new 'stl'
feature of this port.

https://forums.wxwidgets.org/viewtopic.php?p=165208

Describe the pull request

  • What does your PR fix?

    Fixes downstream applications not building with wxwidgets port

  • Which triplets are supported/not supported? Have you updated the CI baseline?

    all

  • Does your PR follow the maintainer guide?

    yes

  • If you have added/updated a port: Have you run ./vcpkg x-add-version --all and committed the result?

    Yes

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a new experimental fast check for PR issues. Please let us know if this bot is helpful!

After committing all other changes, the version database must be updated
git add -u && git commit
git checkout 261c458af6e3eed5d099144aff95d2b5035f656b -- versions
./vcpkg x-add-version --all
Diff
diff --git a/versions/baseline.json b/versions/baseline.json
index 7e64191..b042cca 100644
--- a/versions/baseline.json
+++ b/versions/baseline.json
@@ -6738,7 +6738,7 @@
     },
     "wxwidgets": {
       "baseline": "3.1.5",
-      "port-version": 2
+      "port-version": 3
     },
     "x-plane": {
       "baseline": "3.0.3",
diff --git a/versions/w-/wxwidgets.json b/versions/w-/wxwidgets.json
index 72eaf13..38622b9 100644
--- a/versions/w-/wxwidgets.json
+++ b/versions/w-/wxwidgets.json
@@ -1,5 +1,10 @@
 {
   "versions": [
+    {
+      "git-tree": "3561ee078b11facb11fbd807f03093262cd52f19",
+      "version-semver": "3.1.5",
+      "port-version": 3
+    },
     {
       "git-tree": "6fa230bffdee1e7d700570c31e6f08367460c0c9",
       "version-semver": "3.1.5",

@PhoebeHui PhoebeHui added the category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist label Aug 2, 2021
Copy link
Contributor

@PhoebeHui PhoebeHui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@PhoebeHui PhoebeHui added the info:reviewed Pull Request changes follow basic guidelines label Aug 2, 2021
@dg0yt
Copy link
Contributor

dg0yt commented Aug 2, 2021

I would like to ask for clarification whether this feature is additive and compatible with binary caching:

  • How does it affect ABI?
  • How does it affect the library's backward compatibility?
  • Basically, it Port B requires wxwidgets[stl], may it break Port A which was built agains wxwidgets[core]?

@Be-ing
Copy link
Contributor Author

Be-ing commented Aug 2, 2021

wxUSE_STL=ON and wxUSE_STL=OFF are not source compatible so I don't imagine they would be ABI compatible.

Basically, it Port B requires wxwidgets[stl], may it break Port A which was built agains wxwidgets[core]?

I suppose so.

@dg0yt
Copy link
Contributor

dg0yt commented Aug 2, 2021

wxUSE_STL=ON and wxUSE_STL=OFF are not source compatible so I don't imagine they would be ABI compatible.

Basically, it Port B requires wxwidgets[stl], may it break Port A which was built agains wxwidgets[core]?

I suppose so.

This is the list of "Do not" for features:
https://github.com/microsoft/vcpkg/blob/master/docs/maintainers/maintainer-guide.md#features

I get the impression that the proposed feature is in conflict with at least one item.

@Be-ing
Copy link
Contributor Author

Be-ing commented Aug 2, 2021

The only alternatives are:

  • Keep this port as-is which is unusable for lots of wxWidgets applications.
  • Provide no option and only use wxUSE_STL=OFF which would make the upstream port unusable if anyone was previously depending on wxUSE_STL=ON.

@Be-ing
Copy link
Contributor Author

Be-ing commented Aug 2, 2021

https://github.com/microsoft/vcpkg/blob/master/docs/maintainers/maintainer-guide.md#do-not-use-features-to-control-alternatives-in-published-interfaces lists some exceptions made for backwards compatibility. I think this case should have an exception made for backwards compatibility.

@dg0yt
Copy link
Contributor

dg0yt commented Aug 2, 2021

I think this case should have an exception made for backwards compatibility.

Don't misunderstand backwards compatibility and the existing exceptions: These ports already had a broken feature list. The feature were left for backwards compatibility.

The only alternatives are:

  • Keep this port as-is which is unusable for lots of wxWidgets applications.
  • Provide no option and only use wxUSE_STL=OFF which would make the upstream port unusable if anyone was previously depending on wxUSE_STL=ON.

There is more:

  • Let the user use overlay ports to change the default.
  • Use another variable in the portfile, and let users override this variable in custom triplets if needed.

@Be-ing
Copy link
Contributor Author

Be-ing commented Aug 2, 2021

Let the user use overlay ports to change the default.

I don't think this is a good idea because the port currently does not work with downstream codebases that were developed with wxWidgets' default of wxUSE_STL=OFF.

Use another variable in the portfile, and let users override this variable in custom triplets if needed.

This would be quite cumbersome. I don't know why that would be better than a port feature.

@dg0yt
Copy link
Contributor

dg0yt commented Aug 2, 2021

Use another variable in the portfile, and let users override this variable in custom triplets if needed.

This would be quite cumbersome. I don't know why that would be better than a port feature.

It creates an entire consistent universe of compatible binaries bound to that particular triplet.

With features, this is not possible: The binaries created from wxwidgets[stl] are incompatible with ports depending on wxwidgets[core] as far as we are told. This is not additive.

@Be-ing
Copy link
Contributor Author

Be-ing commented Aug 2, 2021

I would be annoyed if I had to use a custom triplet just to use wxWidgets with its upstream defaults. But if that's what the vcpkg maintainers decide, it should be documented.

@PhoebeHui PhoebeHui added the requires:vcpkg-team-review This PR or issue requires someone on the vcpkg team to take a further look. label Aug 3, 2021
@strega-nil-ms
Copy link
Contributor

Do you have a repro? I'm trying to figure out why this is necessary, except for the wxUSE_STL_BASED_WXSTRING stuff (which we could fix by defining that).

@Be-ing
Copy link
Contributor Author

Be-ing commented Aug 6, 2021

I am working with this branch of Tenacity: https://github.com/tenacityteam/tenacity/pull/228 This branch is still very much a work-in-progress and I am force pushing frequently.

When I tried to build that branch with the wxwidgets port in wxWidgets/wxWidgets#2402 which uses wxUSE_STL=ON, the build failed with these errors. When I build wxwidgets manually without vcpkg using the default wxUSE_STL=OFF, I am able to build that branch. When I rebuilt wxwidgets manually with wxUSE_STL=ON, I reproduced the compile errors.

@JackBoosY
Copy link
Contributor

I am working with this branch of Tenacity: tenacityteam/tenacity#228 This branch is still very much a work-in-progress and I am force pushing frequently.

When I tried to build that branch with the wxwidgets port in wxWidgets/wxWidgets#2402 which uses wxUSE_STL=ON, the build failed with these errors. When I build wxwidgets manually without vcpkg using the default wxUSE_STL=OFF, I am able to build that branch. When I rebuilt wxwidgets manually with wxUSE_STL=ON, I reproduced the compile errors.

Those failures are due to the upstream doesn't handle the library path. See wxWidgets/wxWidgets#2402.

@talregev
Copy link
Contributor

talregev commented Aug 6, 2021

@JackBoosY Will you help us to continue the PR that solve the problems?

@Be-ing
Copy link
Contributor Author

Be-ing commented Aug 6, 2021

Those failures are due to the upstream doesn't handle the library path. See wxWidgets/wxWidgets#2402.

Yes the first error I posted in https://github.com/tenacityteam/tenacity/pull/228#issuecomment-880113285 was due to that upstream bug. But then I ran into the compile errors because of wxUSE_STL=ON.

@Be-ing
Copy link
Contributor Author

Be-ing commented Aug 6, 2021

https://docs.wxwidgets.org/3.0/classwx_string.html has this note:

If you built wxWidgets with wxUSE_STL set to 1, the implicit conversions to both narrow and wide C strings are disabled and replaced with implicit conversions to std::string and std::wstring.

I think this is the source of the compile error I encountered with wxUSE_STL=ON.

@strega-nil-ms
Copy link
Contributor

strega-nil-ms commented Aug 6, 2021

@Be-ing could you try instead with wxUSE_STL=1, and wxUSE_STL_BASED_WXSTRING=0? I think that that's where the real issue lies.

@Be-ing
Copy link
Contributor Author

Be-ing commented Aug 6, 2021

That's not an available CMake variable:

CMake Warning:
  Manually-specified variables were not used by the project:

    wxUSE_STL_BASED_WXSTRING

@strega-nil-ms
Copy link
Contributor

urggh... okay, I think the best thing is to default to -DwxUSE_STL=OFF then, and allow for turning it back on.

@Be-ing
Copy link
Contributor Author

Be-ing commented Aug 6, 2021

So merge this PR?

@strega-nil-ms
Copy link
Contributor

@Be-ing no, it shouldn't be a feature. Could you turn it off by default, and make turning it back on a triplet option?

@Be-ing
Copy link
Contributor Author

Be-ing commented Aug 9, 2021

Okay, that sounds like a good solution. Is there documentation or an example how to do that? Just set the wxUSE_STL CMake option based on a CMake variable? Then users can choose to set that CMake variable in a custom triplet?

@Be-ing
Copy link
Contributor Author

Be-ing commented Aug 9, 2021

Where would I document that the triplet option exists?

@dg0yt
Copy link
Contributor

dg0yt commented Aug 10, 2021

Where would I document that the triplet option exists?

Good question. Documentation exists for global triplet variables, but not for per-port variables. How about adding a sentence to the port's description field? In this way, it would be visible in online package search. E.g.

To enable 'wxUSE_STL', set 'VCPKG_WXWIDGETS_USE_STL' to 'ON' in a custom triplet file.

@Be-ing Be-ing requested a review from JackBoosY August 11, 2021 15:20
@Be-ing Be-ing changed the title [wxwidgets] make wxUSE_STL an optional feature disabled by default [wxwidgets] make wxUSE_STL an optional triplet feature disabled by default Aug 11, 2021
ports/wxwidgets/portfile.cmake Show resolved Hide resolved
ports/wxwidgets/vcpkg.json Outdated Show resolved Hide resolved
wxUSE_STL defaults to OFF so that is how it is in Linux
distribution packages. Downstream projects developed with
wxUSE_STL=ON are not necessarily compatible with wxUSE_STL=OFF
without modification. So, by default, go with wxWidgets' default
for compatibility with downstream codebases. vcpkg users who need
wxUSE_STL=ON can still do so by simply opting into the new 'stl'
feature of this port.

https://forums.wxwidgets.org/viewtopic.php?p=165208
Signed-off-by: Be <[email protected]>
@PhoebeHui PhoebeHui removed the requires:vcpkg-team-review This PR or issue requires someone on the vcpkg team to take a further look. label Aug 12, 2021
@Be-ing
Copy link
Contributor Author

Be-ing commented Aug 19, 2021

This has been approved by 3 reviewers. Can it be merged?

@strega-nil-ms strega-nil-ms merged commit 996baef into microsoft:master Aug 19, 2021
@Be-ing Be-ing deleted the wxwidgets_stl branch August 19, 2021 16:11
@Be-ing
Copy link
Contributor Author

Be-ing commented Aug 19, 2021

Thanks for reviewing. I am glad we found a solution that works with vcpkg's policies. Now, onto #17111...

@talregev
Copy link
Contributor

talregev commented Aug 19, 2021

@Be-ing @JackBoosY

Now, onto #17111...

I so agree ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist info:reviewed Pull Request changes follow basic guidelines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants