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

Option to build using snappy. #7456

Closed
wants to merge 2 commits into from
Closed

Option to build using snappy. #7456

wants to merge 2 commits into from

Conversation

rotrida
Copy link
Contributor

@rotrida rotrida commented Jul 29, 2019

No description provided.

@msftclas
Copy link

msftclas commented Jul 29, 2019

CLA assistant check
All CLA requirements met.

@rotrida
Copy link
Contributor Author

rotrida commented Jul 29, 2019

Adding Snappy compression option.

@LilyWangL
Copy link
Contributor

Related issue: #7454


Feature: snappy
Description: Build with snappy
Build-Depends: snappy
Copy link
Contributor

@myd7349 myd7349 Jul 30, 2019

Choose a reason for hiding this comment

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

snappy is not necessary here, since librdkafka has a bundled version of snappy-c: https://github.com/edenhill/librdkafka/blob/master/src/snappy.c

@myd7349
Copy link
Contributor

myd7349 commented Jul 30, 2019

Hi! @rotrida Sorry for not solving your problem before, as I thought librdkafka is always built with snappy:
https://github.com/edenhill/librdkafka/blob/d443b4f025058172d2c8568376e36e54aba0b8b4/src/win32_config.h#L38
https://github.com/edenhill/librdkafka/blob/master/packaging/cmake/config.h.in#L34

As we can see, librdkafka has two configuration header files:
One named config.h.in, which is supposed to be used when configuring with CMake.
The other one, win32_config.h, is supposed to be used together with the VS solution provided by librdkafka.
Unfortunately, in rd.h:
https://github.com/edenhill/librdkafka/blob/master/src/rd.h#L54-L60
That is, win32_config.h is always used when building with MSVC, even you configure librdkafka with CMake.
And in win32_config.h:

#ifndef WITHOUT_WIN32_CONFIG
#define WITH_SSL 1
#define WITH_ZLIB 1
#define WITH_SNAPPY 1
#define WITH_ZSTD 1
/* zstd is linked dynamically on Windows, but the dynamic library provides
 * the experimental/advanced API, just as the static builds on *nix */
#define WITH_ZSTD_STATIC 1
#define WITH_SASL_SCRAM 1
#define WITH_SASL_OAUTHBEARER 1
#define ENABLE_DEVEL 0
#define WITH_PLUGINS 1
#define WITH_HDRHISTOGRAM 1
#endif

WITHOUT_WIN32_CONFIG is defined here, which has a default value 'ON':
https://github.com/edenhill/librdkafka/blob/d443b4f025058172d2c8568376e36e54aba0b8b4/CMakeLists.txt#L167

@myd7349
Copy link
Contributor

myd7349 commented Jul 30, 2019

I guess this patch should fix the snappy support:

diff --git a/ports/librdkafka/portfile.cmake b/ports/librdkafka/portfile.cmake
index 5bc66fdf..88bcf5e3 100644
--- a/ports/librdkafka/portfile.cmake
+++ b/ports/librdkafka/portfile.cmake
@@ -27,6 +27,7 @@ vcpkg_configure_cmake(
         -DRDKAFKA_BUILD_EXAMPLES=OFF
         -DRDKAFKA_BUILD_TESTS=OFF
         -DWITH_BUNDLED_SSL=OFF
+        -DWITHOUT_WIN32_CONFIG=OFF
         ${FEATURE_OPTIONS}
     OPTIONS_DEBUG
         -DENABLE_DEVEL=ON

@myd7349
Copy link
Contributor

myd7349 commented Jul 30, 2019

I have created a PR in the upstream before: confluentinc/librdkafka#2323

@rotrida
Copy link
Contributor Author

rotrida commented Jul 30, 2019

I have created a PR in the upstream before: edenhill/librdkafka#2323

Great! Thank you for getting into it.

@rotrida rotrida closed this Jul 30, 2019
@myd7349
Copy link
Contributor

myd7349 commented Jul 30, 2019

Hi! @rotrida Please do not close your PR yet. Instead please update your PR like this:

vcpkg_configure_cmake(
    SOURCE_PATH ${SOURCE_PATH}
    PREFER_NINJA
    OPTIONS
        -DRDKAFKA_BUILD_STATIC=${RDKAFKA_BUILD_STATIC}
        -DRDKAFKA_BUILD_EXAMPLES=OFF
        -DRDKAFKA_BUILD_TESTS=OFF
        -DWITH_BUNDLED_SSL=OFF
        -DWITHOUT_WIN32_CONFIG=OFF # ADD THIS OPTION HERE
        ${FEATURE_OPTIONS}
    OPTIONS_DEBUG
        -DENABLE_DEVEL=ON
        -DENABLE_REFCNT_DEBUG=ON
        -DENABLE_SHAREDPTR_DEBUG=ON
        -DWITHOUT_OPTIMIZATION=ON
    OPTIONS_RELEASE
        -DENABLE_DEVEL=OFF
        -DENABLE_REFCNT_DEBUG=OFF
        -DENABLE_SHAREDPTR_DEBUG=OFF
        -DWITHOUT_OPTIMIZATION=OFF
)

and bump the version number in the CONTROL file.

@rotrida rotrida reopened this Jul 30, 2019
@myd7349
Copy link
Contributor

myd7349 commented Jul 30, 2019

Hi! @rotrida Thanks! This way this issue can get a quick fix in vcpkg and maybe other guys can benefit from this PR too.

@myd7349
Copy link
Contributor

myd7349 commented Jul 30, 2019

Superseded by #7469 . So close this one.

@rotrida
Copy link
Contributor Author

rotrida commented Jul 31, 2019

Hi @myd7349 ,

Unfortunatelly removal, adding "-DWITHOUT_WIN32_CONFIG=OFF" didn't worked as expected. We can see at #7469. Do you have any other idea?

Thanks,

Rodrigo.

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.

5 participants