在Ubuntu 12.04 32bit上安装和编译ZeroMQ/ZMQ/0MQ

时间:2022-07-16 09:44:34

I really want to use 0MQ for a personal project, but I am having a very tough time getting things to compile after installation

我确实想在个人项目中使用0MQ,但是在安装之后,我很难编译东西

Here is what I do:

我是这样做的:

#### Install prerequisites without errors: ####
$ sudo apt-get install libtool autoconf automake uuid-dev build-essential

#### Get 0MQ: ####
$ cd ~/Downloads
$ wget http://download.zeromq.org/zeromq-3.2.1-rc2.tar.gz
$ tar -xvzf zeromq-3.2.1-rc2.tar.gz

#### Install 0MQ without errors: ####
$ cd zeromq-3.2.1
$ ./configure
$ make
$ sudo make install
$ sudo ldconfig

#### Get the imatix zguide: ####
$ cd ~/Downloads
$ wget https://github.com/imatix/zguide/tarball/master
$ tar -xvzf master

This is where I need help. Running "./build all" in the imatix "examples/C" and "examples/C++" folders just results in loads of errors. I have also tried compiling using the "./c" and "./c -p" commands in the "/examples/C/" & "/examples/C++/" directories respectively. I don't get errors, but they generate ".o" and ".opp" files. Are these executables? After compiling I have tried "chmod +x" and "chown 777" to no avail. Here is what I do:

这就是我需要帮助的地方。运行”。/在imatix“example /C”和“example / c++”文件夹中构建“all”只会导致大量错误。我也尝试过使用“”进行编译。/ c”和“。/c -p“/examples/ c /" & "/examples/ c++ /"目录中的命令。我不会出错,但它们会产生。o“和”。opp”文件。这些可执行文件吗?编译后,我尝试了“chmod +x”和“chown 777”,但都没有效果。我是这样做的:

#### Generates hwclient.o ####
$ cd imatix-zguide-a690f10/
$ cd examples/C/
$ ./c hwclient.c
Compiling hwclient...
$ ./hwclient.o
bash: ./hwclient.o: Permission denied

#### Generates hwclient.opp ###
$ cd ../C++/
$ ./c -p hwclient.cpp
Compiling hwclient...
$ ./hwclient.opp
bash: ./hwclient.opp: Permission denied

I have also tried compiling with g++ which just results in similar errors to running "./build all":

我也尝试过使用g++编译,这只会导致与运行类似的错误”。/构建所有”:

$ g++ hwclient.cpp -o hwclient.exe
/tmp/ccWFyLHw.o: In function `main':
hwclient.c:(.text+0x16): undefined reference to `zmq_ctx_new'
hwclient.c:(.text+0x3a): undefined reference to `zmq_socket'
hwclient.c:(.text+0x52): undefined reference to `zmq_connect'
hwclient.c:(.text+0x73): undefined reference to `zmq_msg_init_size'
hwclient.c:(.text+0x7f): undefined reference to `zmq_msg_data'
hwclient.c:(.text+0xb9): undefined reference to `zmq_msg_send'
hwclient.c:(.text+0xc5): undefined reference to `zmq_msg_close'
hwclient.c:(.text+0xd1): undefined reference to `zmq_msg_init'
hwclient.c:(.text+0xed): undefined reference to `zmq_msg_recv'
hwclient.c:(.text+0x10d): undefined reference to `zmq_msg_close'
hwclient.c:(.text+0x12e): undefined reference to `zmq_close'
hwclient.c:(.text+0x13a): undefined reference to `zmq_ctx_destroy'
collect2: ld returned 1 exit status

What is the next step/what am I missing? I have looked all over the 0MQ site & wiki but nobody else seems to have an issue. Am I making a noob mistake? Am I executing the ".o" or ".opp" files incorrectly? Are they even executables?

下一步是什么?我错过了什么?我查看了所有的0MQ站点和wiki,但是似乎没有其他人有问题。我犯错误了吗?我在执行"。o”或“。opp”文件不正确吗?他们甚至可执行文件吗?

Please help. I really want to use 0MQ!

请帮助。我真的想用0MQ!

2 个解决方案

#1


8  

I found that I had to upgrade to ZeroMQ 3.2.x to get the examples to compile properly. The current version in the CentOS/EPEL repositories is 2.1.9, which doesn't work with the examples in the zguide. My example here was done on a CentOS 6.3 server.

我发现我必须升级到0。3.2。使示例得到适当的编译。CentOS/EPEL存储库中的当前版本是2.1.9,这与zguide中的示例不兼容。这里的示例是在CentOS 6.3服务器上完成的。

yum remove zeromq zeromq-devel
wget http://download.zeromq.org/zeromq-3.2.2.tar.gz
tar zxvf zeromq-3.2.2.tar.gz && cd zeromq-3.2.2
./configure
make && make install
cd ~/zguide/examples/C
gcc -o hwclient hwclient.c -lzmq

#2


6  

After talking on a few IRC channels I have figured it out.

在谈了几个IRC频道后,我发现了。

#### Build a single file with: ####
./c -p filename.cpp
g++ -o filename filename.opp -lzmq

#### Build all in folder ####
CCLIBS='-lzmq' ./build all

#1


8  

I found that I had to upgrade to ZeroMQ 3.2.x to get the examples to compile properly. The current version in the CentOS/EPEL repositories is 2.1.9, which doesn't work with the examples in the zguide. My example here was done on a CentOS 6.3 server.

我发现我必须升级到0。3.2。使示例得到适当的编译。CentOS/EPEL存储库中的当前版本是2.1.9,这与zguide中的示例不兼容。这里的示例是在CentOS 6.3服务器上完成的。

yum remove zeromq zeromq-devel
wget http://download.zeromq.org/zeromq-3.2.2.tar.gz
tar zxvf zeromq-3.2.2.tar.gz && cd zeromq-3.2.2
./configure
make && make install
cd ~/zguide/examples/C
gcc -o hwclient hwclient.c -lzmq

#2


6  

After talking on a few IRC channels I have figured it out.

在谈了几个IRC频道后,我发现了。

#### Build a single file with: ####
./c -p filename.cpp
g++ -o filename filename.opp -lzmq

#### Build all in folder ####
CCLIBS='-lzmq' ./build all