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

Fix symbols missing when static linking ngtcp2,nghttp3 and nghttp2 using cmake and MSVC on Windows. #10364

Closed
wants to merge 5 commits into from

Conversation

owent
Copy link

@owent owent commented Jan 29, 2023

Fixes #10363

  • Try to detect if we can use static library of nghttp2,nghttp3 and ngtcp2.
    • Define NGHTTP3_STATICLIB, NGTCP2_STATICLIB, NGHTTP2_STATICLIB as needed。
  • Add some common libraries needed by openssl.

set(CMAKE_REQUIRED_DEFINITIONS "-Dssize_t=__int64")
else()
set(CMAKE_REQUIRED_DEFINITIONS "-Dssize_t=long long")
endif()
Copy link
Member

Choose a reason for hiding this comment

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

This type defines seem unrelated to a static/dynamic build. Why do you need those?

Copy link
Author

Choose a reason for hiding this comment

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

nghttp2 use ssize_t but not define it.

Copy link
Author

Choose a reason for hiding this comment

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

The failed jobs seem not a problem of this PR, could you please help me to find out what's the problem?

Copy link
Member

Choose a reason for hiding this comment

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

nghttp2 use ssize_t but not define it.

We've built curl with nghttp2 for many years already without having to add any extra defines. Why does the need start now? And if we actually do need them, they are still unrelated to the static builds and should not be done in the same PR that fixes the linking of static libs.

Copy link
Author

@owent owent Jan 30, 2023

Choose a reason for hiding this comment

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

ssize_t is already defined before by https://github.com/curl/curl/blob/curl-7_87_0/CMakeLists.txt#L1013-L1026 and https://github.com/curl/curl/blob/curl-7_87_0/lib/curl_config.h.cmake#L776 . It's available for all the sources of curl , but unavailable for check_symbol_exists(). I tried to add the same definitions to CMAKE_REQUIRED_DEFINITIONS just to make sure check_symbol_exists(nghttp2_version "nghttp2/nghttp2.h" HAVE_NGHTTP2_DYNAMICLIB) and check_symbol_exists(nghttp2_version "nghttp2/nghttp2.h" HAVE_NGHTTP2_STATICLIB) can work correctly, this setting will be restored by cmake_pop_check_state() after this checking is done and do not take any effect on curl building.

Copy link
Member

Choose a reason for hiding this comment

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

thanks for explaining, I think I understand now. It is necessary for this "hack" to work.

I will leave the judgement for if this is worth merging to someone who better understands and reads cmake.

Copy link
Author

Choose a reason for hiding this comment

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

thanks for explaining, I think I understand now. It is necessary for this "hack" to work.

I will leave the judgement for if this is worth merging to someone who better understands and reads cmake.

Thanks a lot.

@bagder bagder added the HTTP/3 h3 or quic related label Jan 29, 2023
@owent owent changed the title Fix missing some symbols when static linking ngtcp2,nghttp3 and nghttp2. Fix symbols missing when static linking ngtcp2,nghttp3 and nghttp2 using cmake and MSVC on Windows. Jan 30, 2023
…ing cmake and MSVC on Windows.

Signed-off-by: owent <admin@owent.net>
@bagder
Copy link
Member

bagder commented Aug 21, 2023

Sorry, I see no votes or voices in favor of this PR. Maybe because not many people build static on Windows with cmake.

@bagder bagder closed this Aug 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

Unresolved symbols when static linking ngtcp2,nghttp3,nghttp2 using cmake and MSVC on Windows.
2 participants