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

[cppkafka] bumped to 0.4.0 #31182

Merged
merged 1 commit into from
May 2, 2023

Conversation

krjakbrjak
Copy link
Contributor

In this version some of the issues were solved:

  1. No need for dynamic fix patch as it was solved inside the project.
  2. CMake configs are installed

@krjakbrjak
Copy link
Contributor Author

@microsoft-github-policy-service agree

@krjakbrjak krjakbrjak marked this pull request as draft April 29, 2023 17:36
@krjakbrjak krjakbrjak force-pushed the cppkafka-bumped-version branch 2 times, most recently from 3feef2a to 8be6d08 Compare May 1, 2023 17:40
@krjakbrjak krjakbrjak marked this pull request as ready for review May 1, 2023 17:43
Copy link
Contributor

@dg0yt dg0yt left a comment

Choose a reason for hiding this comment

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

I'm surprised by the new patches.

Comment on lines 17 to 33
if (CPPKAFKA_RDKAFKA_STATIC_LIB)
add_definitions("-DLIBRDKAFKA_STATICLIB")
+else ()
+ set(RDKAFKA_REQUIRES "rdkafka >= 0.9.4")
endif()

if (NOT CPPKAFKA_CONFIG_DIR)
diff --git a/cmake/cppkafka.pc.in b/cmake/cppkafka.pc.in
index b5d432c..5dc8af2 100644
--- a/cmake/cppkafka.pc.in
+++ b/cmake/cppkafka.pc.in
@@ -9,6 +9,6 @@ Url: https://github.com/mfontanini/cppkafka
Description: C++ wrapper library on top of RdKafka
Version: @CPPKAFKA_VERSION@
Requires:
-Requires.private: rdkafka >= 0.9.4
+Requires.private: @RDKAFKA_REQUIRES@
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the purpose of this patch? The logic seems inverted.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dg0yt Well, the problem here is that the original .pc file always requires rdkafka, and that fails when rdkafka was statically linked (because there would be no such file. When rdkafka is built as static library the config file is rdkafka-static). I agree this particular patch is not suitable for all use cases. A better way would be to have a patch that will append the suffix (-static) to rdkafka in Requires.private.

Copy link
Contributor

@dg0yt dg0yt May 2, 2023

Choose a reason for hiding this comment

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

A better way would be to have a patch that will append the suffix (-static) to rdkafka in Requires.private.

This, and even more changes, to rdkafka.

Both Libs.private and Requires.private are exclusively for static linkage, for additonal link libraries.
IIUC rdkafka got it wrong in two ways: By installing different names for different linkage (inconvenient for downstream usage, as in this port), and by publishing additional link libraries only for dynamic linkage (when this information is already carried by DLLs/shared objects).

I assume you don't want to touch librdkafka now, so just replace rdkafka with rdkafka-static. This should have no disadvantage for dynamic linkage. But for a fully working set of pkgconfig files, more work is needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dg0yt the branch has been updated.

Comment on lines +34 to +35
Libs: -L${libdir} -L${sharedlibdir} -lcppkafka
Cflags: -I${includedir} -I${includedir}/cppkafka -I@Boost_INCLUDE_DIRS@
Copy link
Contributor

Choose a reason for hiding this comment

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

I would be concerned about the two lib search dirs and about Boost_INCLUDE_DIRS not being a single dir here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is the part of the original .pc file.


add_library(${TARGET_NAME} ${CPPKAFKA_LIBRARY_TYPE} ${SOURCES})
+IF(MSVC)
+ target_compile_definitions(${TARGET_NAME} PUBLIC NOMINMAX)
Copy link
Contributor

Choose a reason for hiding this comment

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

PUBLIC NOMINMAX has impacts in consumers of the targets, no matter if actually including a TARGET_NAME header. Is this intented?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, should be changed to PRIVATE.

In this version some of the issues were solved:
1. No need for dynamic fix patch as it was solved inside the project.
2. CMake configs are installed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants