Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the process of compiling the C++ dependency library librdkafka

2025-03-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

In this article Xiaobian introduces in detail "C++ dependent library librdkafka compilation process is what", the details are detailed, the steps are clear, the details are handled properly, I hope this "C++ dependent library librdkafka compilation process is what" article can help you solve doubts, the following follow the editor's ideas slowly in-depth, together to learn new knowledge bar.

1) download openssl

Address: openssl/openssl

2) compilation process, with VS2015 environment

Install perl

Install nasm

Find it yourself.

Add the executable paths of nasm and perl to the environment variable path

3) enter the VC installation path

Mine is here: d:\ software\ vs2015\ VC\ bin

Execution, mine is a 64-bit system, now most of them are like this, 32 for the system to check it out.

Vcvarsall.bat x86_amd644) enter the openssl source code path

Start compilation

A) perl Configure VC-WIN64Ab) nmakenmake testnmake install1) download the librdkafka source code

Address: edenhill/librdkafka/

Open the project with vs2015

2) add the compiled link library and header file to the attributes of librdkafka

Header file location: mine is in the source code directory: d:\ openssl\ include

Lib library file location: my build is directly under D:\ openssl

There are two libraries to add to the properties: libssl.lib libcrypto.lib. Note that libeay32MT.lib and ssleay32MT.lib are not said on the Internet to remove MT. Now they are all new versions.

3) use the installed kafka environment to produce messages

Note: installing the kafka environment is not here.

4) compile consumer programs

Rdkafka_complex_consumer_example_cpp

Two dll files of openssl need to be copied to the debug folder

5) look at the implementation result

Take advantage of kafka production messages (see kafka installed in point 3)

C:\ * *\ kafka_2.12-2.7.0\ bin\ windows > kafka-console-producer.bat-- broker-list localhost:9092-- topic test > hello > nihao' > rrr

Use the compiled kafka client to receive messages:

D:\ work\ code\ libs\ librdkafka-master\ win32\ outdir\ V140\ x64\ Debug > rdkafka_complex_consumer_example_cpp.exe-g 4-b 127.0.0.1 test 9092 test% Created consumer rdkafka#consumer-1RebalanceCb: Local: Assign partitions: test [0] testtesthellonihao'rrr, the article "what is the process of compiling librdkafka from the dependency Library of C++" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it yourself. If you want to know more about related articles, welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 239

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report