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

[nghttp2-asio] Add nghttp2-asio port #29714

Merged
merged 1 commit into from
Mar 6, 2023
Merged

Conversation

m8mble
Copy link
Contributor

@m8mble m8mble commented Feb 17, 2023

The nghttp2_asio library was formerly part of nghttp2 but by now is distributed as separate library. Add a port for this library.

  • Changes comply with the maintainer guide
  • The name of the port matches an existing name for this component on https://repology.org/ if possible, and/or is strongly associated with that component on search engines.
  • Optional dependencies are resolved in exactly one way. For example, if the component is built with CMake, all find_package calls are REQUIRED, are satisfied by vcpkg.json's declared dependencies, or disabled with CMAKE_DISABLE_FIND_PACKAGE_Xxx
  • The versioning scheme in vcpkg.json matches what upstream says.
  • The license declaration in vcpkg.json matches what upstream says.
  • The installed as the "copyright" file matches what upstream says.
  • The source code of the component installed comes from an authoritative source.
  • The generated "usage text" is accurate. See adding-usage for context. (Note: It doesn't exist, but it's accurate.)
  • The version database is fixed by rerunning ./vcpkg x-add-version --all and committing the result.
  • Only one version is in the new port's versions file.
  • Only one version is added to each modified port's versions file.

@m8mble
Copy link
Contributor Author

m8mble commented Feb 17, 2023

@microsoft-github-policy-service agree

@m8mble
Copy link
Contributor Author

m8mble commented Feb 17, 2023

Could someone explain to me how I can read the error logs?

@Cheney-W Cheney-W added the category:new-port The issue is requesting a new library to be added; consider making a PR! label Feb 20, 2023
@Cheney-W
Copy link
Contributor

Cheney-W commented Feb 20, 2023

Could NOT find Boost (missing: thread) (found suitable version "1.81.0",
  minimum required is "1.54.0")

You could get all of the error logs from https://dev.azure.com/vcpkg/public/_build/results?buildId=85548&view=artifacts&pathAsName=false&type=publishedArtifacts

@Cheney-W Cheney-W changed the title Add nghttp2-asio port [nghttp2-asio] Add nghttp2-asio port Feb 20, 2023
@m8mble m8mble force-pushed the nghttp2-asio branch 2 times, most recently from a331dd1 to 3cd1b8f Compare February 20, 2023 10:54
@m8mble
Copy link
Contributor Author

m8mble commented Feb 20, 2023

Thanks for the review.

Apparently the library isn't supported on windows (yet).

  • I can attempt to fix it via patches. Is it ok to do so here (on your CI resources via patches)?
  • Or should I just disable the new port on windows? (Is "supports": "!windows", in vcpkg.json the right way to do that?)

@Cheney-W
Copy link
Contributor

If the upstream does not support window itself, we can add "supports": "!windows" into the vcpkg.json file. Otherwise, we should use the first solution to fix it.

@m8mble m8mble force-pushed the nghttp2-asio branch 5 times, most recently from 3310b48 to 8635fff Compare February 23, 2023 22:57
@m8mble
Copy link
Contributor Author

m8mble commented Feb 23, 2023

I fixed all compile errors. Some errors "unresolved external symbol" remain when linking dynamically on windows. Most needed symbols come from OpenSSL. I have OpenSSL LIBS='optimized;D:/installed/x64-windows/lib/libssl.lib;debug;D:/installed/x64-windows/debug/lib/libssl.lib;optimized;D:/installed/x64-windows/lib/libcrypto.lib;debug;D:/installed/x64-windows/debug/lib/libcrypto.lib'. Is that correct?

I'm not an expert for windows and could use some help here.

@dg0yt
Copy link
Contributor

dg0yt commented Feb 24, 2023

I have OpenSSL LIBS='optimized;D:/installed/x64-windows/lib/libssl.lib;debug;D:/installed/x64-windows/debug/lib/libssl.lib;optimized;D:/installed/x64-windows/lib/libcrypto.lib;debug;D:/installed/x64-windows/debug/lib/libcrypto.lib'. Is that correct?

AFAICS the package is using CMake. So the natural way to deal with an OpenSSL dependency is find_package(OpenSSL), and link against the provided targets. No Windows know-how needed for this.

There seem to be too many modifications. In particular, I don't see why there is a need to have three add_library when one is enough for vcpkg (without SHARED, STATIC or OBJECT).

@m8mble m8mble force-pushed the nghttp2-asio branch 8 times, most recently from 4b30c3c to a580e72 Compare February 27, 2023 22:39
@m8mble
Copy link
Contributor Author

m8mble commented Feb 27, 2023

I disabled the port for windows. I have a patch for windows but it would need manual testing. Supporting uwp is likely impossible, since boost-asio doesn't support it.

I've added a dependency of nghttp2-asio[tls] on boost-asio[ssl]. Please review this is correct.

@talregev
Copy link
Contributor

Thanks for the review.

Apparently the library isn't supported on windows (yet).

  • I can attempt to fix it via patches. Is it ok to do so here (on your CI resources via patches)?
  • Or should I just disable the new port on windows? (Is "supports": "!windows", in vcpkg.json the right way to do that?)

I think it also nice if you can make a PR in upstream to fix windows compilation.

@m8mble
Copy link
Contributor Author

m8mble commented Feb 28, 2023

Agreed. I already did that in #13.

Cheney-W
Cheney-W previously approved these changes Mar 1, 2023
@Cheney-W Cheney-W added info:reviewed Pull Request changes follow basic guidelines and removed requires:author-response labels Mar 1, 2023
+# Static library
+if(ENABLE_STATIC_LIB)
+ add_library(nghttp2_asio_static STATIC)
+ target_link_libraries(nghttp2_asio_static PUBLIC nghttp2_asio_object $<TARGET_OBJECTS:url-parser>)
Copy link
Contributor

Choose a reason for hiding this comment

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

In general, static and shared libraries should be named the same. This will allow consumers of this library to use a common name. Also as @dg0yt pointed out, I don't think we need that many add_library calls as the library linkage is inferred from BUILD_SHARED_LIBS.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, I can patch with a smaller diff. I just used the very same change that I already submitted upstream. But you are right that this arguably adds more features than strictly necessary.

Please note though, that the library files (not cmake libraries) have identical basenames.

Do you prefer the single add_library call or could the patch be merged as is?

Copy link
Contributor

Choose a reason for hiding this comment

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

What will upstream decide?
When will be the next release?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know. I'm not a maintainer. Upstream has been pretty quiet lately, no releases so far.

Would you prefer a smaller patch?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know what upstream wants. But vcpkg doesn't need Support linking both statically and shared during the same build. This is popular with autotools build systems, but it is sort-of an anti-pattern for CMake build systems, at least as used in vcpkg: You have to add more CMake code everywhere, for cases which could be switched with the standard BUILD_SHARED_LIBS.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alright, no worries. I'll provide a simpler patch.

@dan-shaw dan-shaw added requires:author-response and removed info:reviewed Pull Request changes follow basic guidelines labels Mar 2, 2023
The nghttp2_asio library was formerly part of nghttp2 but by now
is distributed as separate library.
@Cheney-W Cheney-W added info:reviewed Pull Request changes follow basic guidelines and removed requires:author-response labels Mar 6, 2023
@dan-shaw dan-shaw merged commit ee0b818 into microsoft:master Mar 6, 2023
@m8mble m8mble deleted the nghttp2-asio branch March 7, 2023 14:45
@vserdyuk
Copy link
Contributor

vserdyuk commented Mar 20, 2023

I think it also nice if you can make a PR in upstream to fix windows compilation.

I tried to upstream my fixes for building dynamic library with MSVC + building static library on macOS and Linux, nobody seemed to be interested:
nghttp2/nghttp2#1615

@talregev
Copy link
Contributor

talregev commented Mar 20, 2023

Don't worry. maybe it take time. If not, we move forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:new-port The issue is requesting a new library to be added; consider making a PR! info:reviewed Pull Request changes follow basic guidelines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants