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

How to use CMQ message queue in Linux environment

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Editor to share with you how to use CMQ message queue in the Linux environment, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's learn about it!

Environment configuration:

Operating system Ubuntu has 8GB of memory

Choose your own language version of SDK (download address), here I choose C++ version of SDK.

1. Environmental dependence

Install curl:

Ubuntu installs curl with the following command:

Sudo apt-get install curl

Or download the Linux version of the curl installation package (download address, pay attention to select the Linux version).

Typical installation methods are as follows:

. / configure make make install

If the request is in https mode, you need to turn on ssl support during installation.

After the installation is completed, you can randomly find a url to try the command:

The following html code appears in curl www.qq.com to indicate that the installation is successful:

If you cannot use it after installation, you may not have installed libcurl4-openssl-dev at this time

Enter the command:

Sudo apt-get install libcurl4-openssl-dev

Then follow the prompts to select the appropriate version for installation.

two。 Generate CMQ SDK library files

First of all, after installing curl, find the curl folder (usually the curl-x.xx.x archive downloaded from the Internet)

After the package is unzipped, under the include folder), here is the header file that the generation library needs to depend on. Copy the curl file to your item.

Purpose under the src directory: (note: CMQ is a test project, see attachment for details)

Next, find the library file for libcurl.so, link it to the project's src directory, and then generate the CMQ SDK library

File:

Cut the directory to the src of the project:

Execute the make command to generate libcmq.so and libcmq.a library files

At this point, the generation of the library file has been completed, and the next step is to configure the environment for trial.

3. CMQ trial

You need to match the path of the library before using it:

The sample directory is sdk sample code, and executing make can be compiled

Before executing the sample program, if it is a linked libcmq.so, you need to add its directory to the environment variable LD_LIBRARY_PATH by:

Directory where export LD_LIBRARY_PATH=/libcmq.so is located: $LD_LIBRARY_PATH

After joining, it looks like this:

Once the library file path is added, you are ready to compile:

Cut to the CMQ/sample directory:

Execute make to compile:

An executable file is generated after the Make is completed.

This error may occur in the process of this step:

This error is caused by a 32-bit 64-bit problem, so check the makefile file

CC=CXX=

These two items, because I installed 32-bit ubuntus, so use the 32-bit compilation method. According to the number of bits of the operating system

adjustment.

These are all the contents of the article "how to use CMQ message queuing in Linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, 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: 0

*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

Servers

Wechat

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

12
Report