libuv之下载编译(ubuntu16.04)

前端之家收集整理的这篇文章主要介绍了libuv之下载编译(ubuntu16.04)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

可以直接从官网download

http://docs.libuv.org/en/v1.x/ (http://dist.libuv.org/dist/)

也可以从官网的github下载最新但不是稳定版本的

https://github.com/libuv/libuv


下面以ubuntu16.04环境编译,如果是第一种方式下载的,下载下来的是一个压缩文件,需要先解压,

如果是github clone的就不需要,直接进入目录准备编译即可。(git不会使用可以参考:点击打开链接


1. $ cd libuv

$ sh autogen.sh // autogen.sh是libuv目录下的一个脚本,主要用途是生成makefile,所以与automake相关
autogen.sh: 1: autogen.sh: automake: not found
autogen.sh: 33: test: Illegal number:
autogen.sh: 34: test: Illegal number:
+ libtoolize --copy
autogen.sh: 43: autogen.sh: libtoolize: not found // 既然是要automake,相关的工具应该要事先安装好吧,这里提示没有安装

2. $ sudo apt-get install automake libtool autoconf

3. $ ./configure (后面可以跟上--prefix=/home/jxes/install,指定一个安装目录,这里是我当前指定的目录,注意,不要指到系统目录下,因为ubuntu当前用户是不好直接写系统目录的,比如指/bin或/usr/bin等,这样后面安装会提示权限不够,当然在ubuntu下可使用sudo命令强制将其安装到系统目录下,我默认安装就是用的sudo)

4.$ make

大概等10几分钟就可以make好,具体视个人电脑性能,编译后可能会遇到下面这个警告,这个可以不用理会。

ar: `u' modifier ignored since `D' is the default (see `U')

5.$ make install

就会将libuv.a,libuv.so.o,include头文件等安装到指定目录,如果configure时没有指定目录,目录是安装到系统/usr/local下的,而且还需要sudo命令,具体如下:

$ sudo make install make[1]: Entering directory '/home/jack/jack/libuv' /bin/mkdir -p '/usr/local/lib' /bin/bash ./libtool --mode=install /usr/bin/install -c libuv.la '/usr/local/lib' libtool: install: /usr/bin/install -c .libs/libuv.so.1.0.0 /usr/local/lib/libuv.so.1.0.0 libtool: install: (cd /usr/local/lib && { ln -s -f libuv.so.1.0.0 libuv.so.1 || { rm -f libuv.so.1 && ln -s libuv.so.1.0.0 libuv.so.1; }; }) libtool: install: (cd /usr/local/lib && { ln -s -f libuv.so.1.0.0 libuv.so || { rm -f libuv.so && ln -s libuv.so.1.0.0 libuv.so; }; }) libtool: install: /usr/bin/install -c .libs/libuv.lai /usr/local/lib/libuv.la libtool: install: /usr/bin/install -c .libs/libuv.a /usr/local/lib/libuv.a libtool: install: chmod 644 /usr/local/lib/libuv.a libtool: install: ranlib /usr/local/lib/libuv.a libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/sbin" ldconfig -n /usr/local/lib ---------------------------------------------------------------------- Libraries have been installed in: /usr/local/lib If you ever happen to want to link against installed libraries in a given directory,LIBDIR,you must either use libtool,and specify the full pathname of the library,or use the '-LLIBDIR' flag during linking and do at least one of the following: - add LIBDIR to the 'LD_LIBRARY_PATH' environment variable during execution - add LIBDIR to the 'LD_RUN_PATH' environment variable during linking - use the '-Wl,-rpath -Wl,LIBDIR' linker flag - have your system administrator add LIBDIR to '/etc/ld.so.conf' See any operating system documentation about shared libraries for more information,such as the ld(1) and ld.so(8) manual pages. ---------------------------------------------------------------------- /bin/mkdir -p '/usr/local/include' /usr/bin/install -c -m 644 include/uv.h include/uv-errno.h include/uv-threadpool.h include/uv-version.h include/uv-unix.h include/uv-linux.h '/usr/local/include' /bin/mkdir -p '/usr/local/lib/pkgconfig' /usr/bin/install -c -m 644 libuv.pc '/usr/local/lib/pkgconfig' make[1]: Leaving directory '/home/jack/jack/libuv'

原文链接:https://www.f2er.com/ubuntu/352973.html

猜你在找的Ubuntu相关文章