Skip to content

upgrade to use the latest librdkafka #9

@leiwang008

Description

@leiwang008

Hi shasha,
I know this project is not maintained, but you are the founder of this project and have many knowledge and experiences :-) . I would like to know if you have any idea about the problem I met, I appreciate any help.

I would like to use the "oauthbearer/oidc" feature provided by the librdkafka2.4.0 in our Unreal Project on platform Windows x86_64.
I cloned your project and then I upgraded EasyKafka to use the https://github.com/morganstanley/modern-cpp-kafka/releases/tag/v2024.07.03 and I could get it built successfully.
Then I tried to upgrade the librdkafka to use the version 2.4.0, the following is what I did

  1. I got the librdkafka2.4.0 source code from https://github.com/confluentinc/librdkafka/releases/tag/v2.4.0
  2. Go to the win32 folder and open the librdkafka.sln with the Visual Studio 2022
  3. Then try to build it by "Build->Build Solution", this will download a lot of dependencies
  4. There will be some build errors "The build tools for v143 (Platform Toolset = 'v143') cannot be found. To build using the v143 build tools, please install v143 build tools." for some projects (the examples, tests projects etc.), the main c-project librdkafka got built successfully and that is what we need, so I just ignore those build errors.
  5. By default, the build will be for "win32", we need "X64 build", go to "Build->Config Manager ...", change the "Active solution platform" to "x64" and change the "Active solution configuration" to "Release"
  6. By default, the build will be "Dynamic Library" (.dll), we porbably need a "Static Libary" (everything in one .lib file), right-click the "librdkafak" and select "Properties", and go to "General -> Configuration Type" and change it to "Static library (.lib)".
  7. Then right-click the project "librdkafka" and select "ReBuild", and we will get the release build "librdkafka.lib" in folder like "win32\outdir\v143\x64\Release", copy this "librdkafka.lib" to "UE-EasyKafka\Source\ThirdParty\KafkaLib\lib\Win64" and modify "KafkaLib.Build.cs" to use this library instead of the old one.
  8. Then we do the same thing for project 'librdkafkacpp' to build and get static library librdkafkacpp.lib, and replace the one in EasyKafka plugin.
  9. When I build the SASConnector plugin code, I got the following errors
    Severity Code Description Project File Line Suppression State Details
    Error LNK2001 unresolved external symbol __imp_crc32 LyraStarterGame C:\repository\lyra-demo-kafka\LyraStarterGame\Intermediate\ProjectFiles\librdkafka.lib(rdkafka_admin.obj) 1
    So I checked the "librdkafka" solution, I found that it depends some installed libraries which have been put in C:\sdk\librdkafka-2.4.0\vcpkg_installed\x64-windows\x64-windows\lib (libcurl.lib, libcrypto.lib, libssl.lib, zlib.lib,zstd.lib etc.) and copied them to the "UE-EasyKafka\Source\ThirdParty\KafkaLib\lib\Win64" and modified the KafkaLib.Build.cs to include them
  10. After all these modifications, I successfully built the whole project
  11. But when I try to launch the project, it says that the module "EasyKafka" cannot be loaded, "Plugin 'EasyKafka' failed to load because module 'EasyKafka' could not be loaded. There may be an operating system error or the module may not be properly set up."
  12. I noticed that there are some .dll files (libcrypto-3-x64.dll, libssl-3-x64.dll, zlib1.dll, libcurl.dll, zstd.dll) in the folder C:\repository\github\librdkafka\vcpkg_installed\x64-windows\x64-windows\bin, I copied them to the folder "UE-EasyKafka\Source\ThirdParty\KafkaLib\bin\Win64" and then include them as below
            string binPath = Path.Combine(ModuleDirectory, "bin/Win64");
            RuntimeDependencies.Add(Path.Combine(binPath, "libcrypto-3-x64.dll"));
            RuntimeDependencies.Add(Path.Combine(binPath, "libssl-3-x64.dll"));
            RuntimeDependencies.Add(Path.Combine(binPath, "zlib1.dll"));
            RuntimeDependencies.Add(Path.Combine(binPath, "libcurl.dll"));
            RuntimeDependencies.Add(Path.Combine(binPath, "zstd.dll"));

but this no luck, cannot load the EasyKafka plugin.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions