栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

基于Ubuntu16.04的docker准备ZMQ的C++开发环境

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

基于Ubuntu16.04的docker准备ZMQ的C++开发环境

制作docker

在当前目前准备 sources.list,用于更新源 ,内容如下

vim /etc/apt/sources.list (本次使用的是阿里源)

deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse

准备Dockerfile,内容如下:

FROM ubuntu:16.04

#定义构建的名称
#ARG buildversion


COPY ./sources.list /etc/apt/sources.list

RUN echo 'Asia/Shanghai' >/etc/timezone 
  && apt-get update -y 
  && apt-get install vim  tree zip unzip net-tools git doxygen man -y

开始获取镜像,执行如下命令

docker build -t ubuntu:16.04 .

启动容器

docker run -dit --privileged=true --network host --restart=on-failure --name=ubt16 -v $PWD:/test  ubuntu:16.04 sh -c 'sleep 36000000000 '

进入容器
 

docker exec -it ubt16 bash

安装zmq的基础依赖

默认安装头文件都在usr/local/include ,库文件都在:usr/local/lib

apt-get install libtool pkg-config build-essential autoconf automake -y
编译依赖加密库libsodium

可以到https://github.com上下载,本次使用的是的libsodium-1.0.18版本(百度徍盘链接:https://pan.baidu.com/s/15jj8KRsEztHTK2g4iq8lwA 提取码:8888)

unzip libsodium-1.0.18.zip
cd libsodium
mkdir develop
./autogen.sh
./configure  --prefix=`pwd`/develop && make -j16 check
make install 
ldconfig 

配置全局可用,如果编译libsodium时有配置--prefix选项,则需要设置环境变量,编辑/etc/profile文件,在末尾添加如下内容后执行source /etc/profile; ldconfig ;

export LIBSODIUM_ROOT=/test/libsodium-1.0.18/develop/
export LD_LIBRARY_PATH=$LIBSODIUM_ROOT/lib:$LD_LIBRARY_PATH
export CPATH=$LIBSODIUM_ROOT/include:$CPATH
export LIBRARY_PATH=$LIBSODIUM_ROOT/lib:$LIBRARY_PATH
export PKG_CONFIG_PATH=$LIBSODIUM_ROOT/lib/pkgconfig:$PKG_CONFIG_PATH

编译zmq

可以到https://github.com上下载,本次使用的是的libsodium-1.0.18版本(百度徍盘链接:链接:https://pan.baidu.com/s/1ydx-n8ZdjNcJaFChZQ0HpQ 提取码:8888)

unzip zeromq4-x-4.0.10.zip
cd zeromq4-x-4.0.10
mkdir develop
./autogen.sh
./configure  --prefix=`pwd`/develop && make -j16 check
make install 
make installcheck

配置全局可用,如果编译libsodium时有配置--prefix选项,则需要设置环境变量,编辑/etc/profile文件,在末尾添加如下内容后执行source /etc/profile; ldconfig ;

export ZMQPP_ROOT=/test/zeromq4-x-4.0.10/develop
export LD_LIBRARY_PATH=$ZMQPP_ROOT/lib:$LD_LIBRARY_PATH
export CPATH=$ZMQPP_ROOT/include:$CPATH
export LIBRARY_PATH=$ZMQPP_ROOT/lib:$LIBRARY_PATH
export PKG_CONFIG_PATH=$ZMQPP_ROOT/lib/pkgconfig:$PKG_CONFIG_PATH

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/1034200.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号