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

Build librdkafka on Windows #6095

Merged
merged 5 commits into from
Mar 6, 2020
Merged

Conversation

flappy-sh
Copy link
Contributor

The PR will be reviewed by an osquery committer.
Here are some common things we look for:

  • The code is formatted correctly, considering using make format_check.
  • Common utilities within ./osquery/utils are used where appropriate (avoid reinventions).
  • Modern C++ structures and patterns are used whenever possible.
  • No memory or file descriptor leaks, please check all early-return and destructors.
  • No explicit casting, such as return (int)my_var, instead use static_cast.
  • The minimal amount of includes are used, only include what you use.
  • Comments for methods, structures, and classes follow our common patterns.
  • Status and LOG(N) messages do not use punctuation or contractions.
  • Support for both CMake and BUCK (we are happy to help).
  • The code mostly looks and feels similar to the existing codebase.

-->
Hi, this PR implements the #5678 . Let me know if there are more any additional changes required.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Dec 3, 2019

CLA Check
The committers are authorized under a signed CLA.

Copy link
Contributor

@muffins muffins left a comment

Choose a reason for hiding this comment

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

For the most part this lgtm, although I'm really not familiar with Kafka, so I'll leave accepting to someone a bit more well versed. I had a note about comments, but over lgtm. Thanks a lot for shipping this!

libraries/cmake/source/librdkafka/CMakeLists.txt Outdated Show resolved Hide resolved
libraries/cmake/source/librdkafka/CMakeLists.txt Outdated Show resolved Hide resolved
libraries/cmake/source/librdkafka/CMakeLists.txt Outdated Show resolved Hide resolved
libraries/cmake/source/librdkafka/CMakeLists.txt Outdated Show resolved Hide resolved
libraries/cmake/source/librdkafka/CMakeLists.txt Outdated Show resolved Hide resolved
@Smjert
Copy link
Member

Smjert commented Dec 4, 2019

Also please check the CI which is failing.

@Smjert Smjert changed the title Kafka windows Build librdkafka on Windows Dec 4, 2019
@Smjert
Copy link
Member

Smjert commented Dec 5, 2019

@flappy-sh you can disregard my comment about xxhash, I've dealt with it here #6101

@Smjert
Copy link
Member

Smjert commented Dec 13, 2019

Beware that you have probably mixed a merge with a rebase and now the PR it's including commits that were already merged in master.

@flappy-sh
Copy link
Contributor Author

Hello @Smjert , sorry for the delay was on holiday. Regarding the merge and rebase , i am still testing,
Small question , why the azure pipelines use 2017 and the instruction for local build say 2019 ?

@Smjert
Copy link
Member

Smjert commented Jan 22, 2020

Hello @Smjert , sorry for the delay was on holiday. Regarding the merge and rebase , i am still testing,
Small question , why the azure pipelines use 2017 and the instruction for local build say 2019 ?

@flappy-sh don't worry, happy to have you back!
We mainly kept the last good known Windows Server version tested, so Windows Server 2016.
On the CI to use VS2019 we would have to switch to Windows Server 2019.
While the instructions make you install VS2019, the toolchain used is v141, which is the same for VS2017.
The only thing that now changes is the SDK, which I noticed only now that there's a considerable mismatch of versions. I'll look into pinning a specific version.

@flappy-sh
Copy link
Contributor Author

@Smjert okay , testing is almost complete . Now i have to address the merge rebase 'issue' and the headers are published correctly from libzstd as you requested! Let me know if there are more changes(i also have to remove the testing comments)

includes old commits like: added comments, updated comments , fixed some whitespace , added submodule , fixed comments , pipeline upgrades 'espase mia solina sto ergostasio' , z std fix try , kafka windows v1.0 golden s.p , osquery with kafka on windows initial commit. builds , added submodule , kafka windows test 'xronia polla spk' , include system , cmake added kafka producer source in windows 'psaxnontas ton mpetoven' , relative path handling , testing cmake pipeline , z std compression fix
@theopolis theopolis merged commit d9faba2 into osquery:master Mar 6, 2020
@flappy-sh
Copy link
Contributor Author

@theopolis @Smjert @alessandrogario @muffins Thank you for the merge ! If you need anything else just ping me.

@skydmh
Copy link

skydmh commented Apr 21, 2020

@flappy-sh
Hello
Nice to meet you
Could you tell me when kafka_prodecer on windows will be released?
thank you very much

@flappy-sh
Copy link
Contributor Author

@flappy-sh
Hello
Nice to meet you
Could you tell me when kafka_prodecer on windows will be released?
thank you very much

Hello @skydmh , this changes were merged to master , you can build the branch and have it available, otherwise you can wait for an official release containing the changes.

@Smjert
Copy link
Member

Smjert commented Apr 22, 2020

@flappy-sh, @skydmh unfortunately the kafka producer is not actually yet available.
The rdkafka library is indeed built but it's not linked/used with the producer, especially since the kafka producer CMake target is just a fake library on Windows.

@flappy-sh: You can see this here

if(DEFINED PLATFORM_LINUX OR DEFINED PLATFORM_MACOS)
add_osquery_library(plugins_logger_kafkaproducer EXCLUDE_FROM_ALL
kafka_producer.cpp
)
enableLinkWholeArchive(plugins_logger_kafkaproducer)
target_link_libraries(plugins_logger_kafkaproducer PUBLIC
osquery_cxx_settings
plugins_logger_commondeps
osquery_dispatcher
osquery_utils_config
thirdparty_librdkafka
)
set(public_header_files
kafka_producer.h
)
generateIncludeNamespace(plugins_logger_kafkaproducer "plugins/logger" "FILE_ONLY" ${public_header_files})
add_test(NAME plugins_logger_tests_kafkaproducerloggertests-test COMMAND plugins_logger_tests_kafkaproducerloggertests-test)
else()
add_osquery_library(plugins_logger_kafkaproducer INTERFACE)
endif()

The real target is only created if it's Linux or macOS. Yesterday I quickly tried removing that if, but there are link errors with missing symbols.

The relative issue is still opened here #5678

@skydmh
Copy link

skydmh commented Apr 23, 2020

@flappy-sh
hello
any update for Smjert's comment?
thanks a lot

@flappy-sh
Copy link
Contributor Author

Hi @skydmh , as as mentioned before please take a look at the code otherwise you can wait for an official release containing the changes.

@flappy-sh flappy-sh deleted the kafka_windows branch April 23, 2020 09:52
@skydmh
Copy link

skydmh commented Apr 23, 2020

@flappy-sh
Thank you very much for your kind reply.

Could you let me know the estimated time of the official release containing the changes

@Smjert
Copy link
Member

Smjert commented Apr 23, 2020

@flappy-sh I'm sorry if I wasn't clear, this PR is present in the latest osquery release, 4.3.0, but it doesn't implement the kafka producer for Windows.
As I was saying here #6095 (comment), the librdkafka library is not actually used/linked on a Windows platform and the kafka producer itself, as it can be seen in the CMake code, is not even compiled on Windows.

@flappy-sh
Copy link
Contributor Author

@Smjert About that , my mindmap of dependency's to enable it is a little hazy , but when i pushed that branch at that point of time it talked and shipped data (windows server 2016 cpu query's) to a kafka cluster (running on linux farm) so from my point of view the branch was ready (especially after the linker collision patch), for the fact why now it doesn't compile i really cant say . I only coded it ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants