forked from apache/pulsar-client-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Release Windows packages #5
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Motivation Currently it's impossible to build Pulsar C++ client on Windows with `LINK_STATIC=ON`. It means users have to package all 3rd-party DLLs as well as `pulsar.dll`, which harms the experience. ### Modifications Enable `LINK_STATIC` when the Vcpkg triplet is `xxx-static`. In this case, find the 3rd party libraries with correct names on Windows. And replace `Threads::Threads` with `CMAKE_THREAD_LIB_INIT`. The most important change is replacing the `/MD` compile option with `/MT`. It should have been done by setting the [`MSVC_RUNTIME_LIBRARY`](https://cmake.org/cmake/help/latest/prop_tgt/MSVC_RUNTIME_LIBRARY.html) property, but it seems not work. So this PR just modifies the `CMAKE_CXX_FLAGS_<CONFIG>` variables. For `pulsarWithAllDeps.lib`, add the actual library (`*.lib`) to `COMMON_LIBS` instead of the target name (`dlfcn-win32::dl`). Some warnings on Windows caused by incorrect compile options are fixed as well. A workflow is added to verify the static build for x64 and x86 Windows. And a simple example is added as `win-examples` to show the `pulsarWithAllDeps.lib` can be linked without any other dependency to run an executable. ### TODO - Add the workflow to build Windows releases when pushing a tag - Support debug building with `LINK_STATIC=ON`
BewareMyPower
added a commit
that referenced
this pull request
Oct 26, 2022
* Support linking static dependencies when building with MSVC See apache#73 * Add Windows packaging
BewareMyPower
added a commit
that referenced
this pull request
Oct 28, 2022
This reverts commit 5c87deb.
BewareMyPower
added a commit
that referenced
this pull request
Nov 22, 2022
### Motivation When I ran the tests of Python wrapper in my local env, I observed a segmentation fault. See the key stacktrace: ``` #3 0x00007ffff6d742c5 in std::unique_lock<std::mutex>::lock() () from /usr/local/lib/python3.8/dist-packages/_pulsar.cpython-38-x86_64-linux-gnu.so #4 0x00007ffff6d72523 in std::unique_lock<std::mutex>::unique_lock(std::mutex&) () from /usr/local/lib/python3.8/dist-packages/_pulsar.cpython-38-x86_64-linux-gnu.so #5 0x00007ffff67de193 in pulsar::ClientImpl::newRequestId (this=0x0) at /home/xyz/github.com/apache/pulsar-client-cpp/lib/ClientImpl.cc:644 #6 0x00007ffff685d2c2 in pulsar::ConsumerImpl::~ConsumerImpl (this=0x7fff9800f9e0, __in_chrg=<optimized out>) at /home/xyz/github.com/apache/pulsar-client-cpp/lib/ConsumerImpl.cc:116 ``` In the destructor of `ConsumerImpl`, `client->newRequestId` might be called. However, `client` might be a null pointer because it's returned by `std::weak_ptr::lock()`. ### Modifications Add null check to avoid the segfault.
BewareMyPower
added a commit
that referenced
this pull request
Nov 28, 2022
…#121) ### Motivation When I ran the tests of Python wrapper in my local env, I observed a segmentation fault. See the key stacktrace: ``` #3 0x00007ffff6d742c5 in std::unique_lock<std::mutex>::lock() () from /usr/local/lib/python3.8/dist-packages/_pulsar.cpython-38-x86_64-linux-gnu.so #4 0x00007ffff6d72523 in std::unique_lock<std::mutex>::unique_lock(std::mutex&) () from /usr/local/lib/python3.8/dist-packages/_pulsar.cpython-38-x86_64-linux-gnu.so #5 0x00007ffff67de193 in pulsar::ClientImpl::newRequestId (this=0x0) at /home/xyz/github.com/apache/pulsar-client-cpp/lib/ClientImpl.cc:644 #6 0x00007ffff685d2c2 in pulsar::ConsumerImpl::~ConsumerImpl (this=0x7fff9800f9e0, __in_chrg=<optimized out>) at /home/xyz/github.com/apache/pulsar-client-cpp/lib/ConsumerImpl.cc:116 ``` In the destructor of `ConsumerImpl`, `client->newRequestId` might be called. However, `client` might be a null pointer because it's returned by `std::weak_ptr::lock()`. ### Modifications Add null check to avoid the segfault.
BewareMyPower
added a commit
that referenced
this pull request
Feb 7, 2023
…#121) ### Motivation When I ran the tests of Python wrapper in my local env, I observed a segmentation fault. See the key stacktrace: ``` #3 0x00007ffff6d742c5 in std::unique_lock<std::mutex>::lock() () from /usr/local/lib/python3.8/dist-packages/_pulsar.cpython-38-x86_64-linux-gnu.so #4 0x00007ffff6d72523 in std::unique_lock<std::mutex>::unique_lock(std::mutex&) () from /usr/local/lib/python3.8/dist-packages/_pulsar.cpython-38-x86_64-linux-gnu.so #5 0x00007ffff67de193 in pulsar::ClientImpl::newRequestId (this=0x0) at /home/xyz/github.com/apache/pulsar-client-cpp/lib/ClientImpl.cc:644 #6 0x00007ffff685d2c2 in pulsar::ConsumerImpl::~ConsumerImpl (this=0x7fff9800f9e0, __in_chrg=<optimized out>) at /home/xyz/github.com/apache/pulsar-client-cpp/lib/ConsumerImpl.cc:116 ``` In the destructor of `ConsumerImpl`, `client->newRequestId` might be called. However, `client` might be a null pointer because it's returned by `std::weak_ptr::lock()`. ### Modifications Add null check to avoid the segfault.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.