Linux Ubuntu 安装应用程序------以 libevent 的安装为例

刚接触Linux操作系统,在安装程序上踩了无数的坑。为了给后来人撑一把伞,就写了这篇博客:

--注意要预先安装git 、gcc \ g++ 、make 、cmake

创建最外层文件夹,方便管理。

:~$ sudo mkdir /usr/lib/libevent      //创建libevent文件夹

使用git clone 导入 libevent 相关文件。将自动放在 /usr/lib/libevent 路径下名为 libevent 的文件夹中。

:~$ cd /usr/lib/libevent
:/usr/lib/libevent$ sudo git clone https://githubfast.com/libevent/libevent.git

 创建 libevent-build 文件夹存放编译文件

:/usr/lib/libevent$ sudo mkdir libevent-build
:/usr/lib/libevent$ cd libevent-build

 编译 git 导入的文件夹

:/usr/lib/libevent/libevent-build$ cmake ../libevent

编译  CMakeLists.txt  文件。注意文件路径。

:/usr/lib/libevent/libevent$ sudo cmake  CMakeLists.txt
:/usr/lib/libevent/libevent$ sudo make
:/usr/lib/libevent/libevent$ sudo make install   //不要忘了这一步




Consolidate compiler generated dependencies of target test-ratelim
[100%] Built target test-ratelim
Install the project...
-- Install configuration: "Release"                 //等待安装
-- Installing: /usr/local/lib/libevent_core.a
-- Installing: /usr/local/lib/libevent_core-2.2.so.1.0.0

.
.
.

 

参考自:

【1】系统报错与帮助

######################################################
# jsoncpp should not be configured & built in the jsoncpp source directory
# You must run cmake in a build directory.
# For example:
# mkdir jsoncpp-Sandbox ; cd jsoncpp-sandbox
# git clone https://github.com/open-source-parsers/jsoncpp.git # or download & unpack the source tarball
# mkdir jsoncpp-build
# this will create the following directory structure
#
# jsoncpp-Sandbox
#  +--jsoncpp
#  +--jsoncpp-build
#
# Then you can proceed to configure and build
# by using the following commands
#
# cd jsoncpp-build
# cmake ../jsoncpp # or ccmake, or cmake-gui
# make                                  
#
# NOTE: Given that you already tried to make an in-source build
#       CMake have already created several files & directories
#       in your source tree. run 'git status' to find them and
#       remove them by doing:
#
#       cd jsoncpp-Sandbox/jsoncpp
#       git clean -n -d
#       git clean -f -d
#       git checkout --
#
######################################################

【2】

CMake的变量与缓存(大坑点) - 知乎 (zhihu.com)

刚接触Linux两天的小白,其中难免有各种错误 。希望能有一点帮助。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值