Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install & Compile ZeroMQ/ZMQ/0MQ on Ubuntu 12.04 32bit

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

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:

#### 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++ 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?

Please help. I really want to use 0MQ!

like image 986
Steven Leimberg Avatar asked Oct 15 '12 18:10

Steven Leimberg


People also ask

Is it instal or install?

Both 'instal' and 'install' are correct in the UK. 'Install' is usually used in the US.

Do you mean by install?

Definition of install transitive verb. 1 : to set up for use or service had an exhaust fan installed in the kitchen install software. 2a : to induct into an office, rank, or order installed the new president. b : to place in an office or dignity by seating in a stall or official seat.

What does it mean to instill something?

Definition of instill transitive verb. 1 : to impart gradually instilling a love of learning in children. 2 : to cause to enter drop by drop instill medication into the infected eye.


1 Answers

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.

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
like image 161
Tony Cesaro Avatar answered Nov 28 '22 04:11

Tony Cesaro