Skip to content

Instantly share code, notes, and snippets.

@katopz
Forked from cdjhlee/zeromq_install.sh
Last active August 10, 2021 21:47
Show Gist options
  • Save katopz/8b766a5cb0ca96c816658e9407e83d00 to your computer and use it in GitHub Desktop.
Save katopz/8b766a5cb0ca96c816658e9407e83d00 to your computer and use it in GitHub Desktop.
Setup zeromq in Ubuntu 16.04
#!/usr/bin/bash
# Download zeromq
# Ref http://zeromq.org/intro:get-the-software
wget https://github.com/zeromq/libzmq/releases/download/v4.2.2/zeromq-4.2.2.tar.gz
# Unpack tarball package
tar xvzf zeromq-4.2.2.tar.gz
# Install dependency
sudo apt-get update && \
sudo apt-get install -y libtool pkg-config build-essential autoconf automake uuid-dev
# Create make file
cd zeromq-4.2.2
./configure
# Build and install(root permission only)
sudo make install
# Install zeromq driver on linux
sudo ldconfig
# Check installed
ldconfig -p | grep zmq
# Expected
############################################################
# libzmq.so.5 (libc6,x86-64) => /usr/local/lib/libzmq.so.5
# libzmq.so (libc6,x86-64) => /usr/local/lib/libzmq.so
############################################################
@katopz
Copy link
Author

katopz commented Sep 4, 2019

Should add the stepts to install libsodium, which is a dependency. Installed it following this gist

Ref : https://gist.github.com/cdjhlee/b8e3c927a01b0948b42d#gistcomment-2560156

@mhusme
Copy link

mhusme commented Jul 10, 2020

If you are into binaries only then you can try as follows

echo "deb http://download.opensuse.org/repositories/network:/messaging:/zeromq:/release-stable/Debian_9.0/ ./" >> /etc/apt/sources.list
wget https://download.opensuse.org/repositories/network:/messaging:/zeromq:/release-stable/Debian_9.0/Release.key -O- | sudo apt-key add
apt-get install libzmq3-dev

If you get a permission error then you can try as follows (you need to have superuser access)

sudo -i
echo "deb http://download.opensuse.org/repositories/network:/messaging:/zeromq:/release-stable/Debian_9.0/ ./" >> /etc/apt/sources.list
wget https://download.opensuse.org/repositories/network:/messaging:/zeromq:/release-stable/Debian_9.0/Release.key -O- | sudo apt-key add
exit
sudo apt-get install libzmq3-dev

ref: http://wiki.zeromq.org/intro:get-the-softwarehttp://wiki.zeromq.org/intro:get-the-software

@menghuiwu
Copy link

menghuiwu commented Sep 23, 2020

Suggest to update the zeromq version to 4.2.5 to prevent the compile error as follows:
g++ (Debian 8.3.0-6) 8.3.0 on Debian 10.3
make[1]: Entering directory '/home/menghui_wu/dev/edgex/zeromq-4.2.2'
CXX src/src_libzmq_la-msg.lo
In member function 'int zmq::msg_t::set_group(const char*, size_t)',
inlined from 'int zmq::msg_t::set_group(const char*)' at src/msg.cpp:549:22:
src/msg.cpp:560:13: error: 'char* strncpy(char*, const char*, size_t)' output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation]
strncpy (u.base.group, group_, length_);
~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/msg.cpp: In member function 'int zmq::msg_t::set_group(const char*)':
src/msg.cpp:549:22: note: length computed here
return set_group (group_, strlen (group_));
~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment