一、有一个软件编译的时候提示为:“libnl3: no”,解决方法是安装 libnl。这里选择编译安装最新版 libnl-3.2.25.tar.gz,编译过程如下:
wget http://www.infradead.org/~tgr/libnl/files/libnl-3.2.25.tar.gz tar zxvf libnl-3.2.25.tar.gz cd libnl-3.2.25 ./configure --prefix=/usr/ make && make install
二、执行 ./configure 后有如下提示:
------------------------------------------------------------------------------- NOTE There have been some changes starting with 3.2 regarding where and how libnl is being installed on the system in order to allow multiple libnl versions to be installed in parallel: - Headers will be installed in ${prefix}/include/libnl3, therefore you will need to add "-I/usr/include/libnl3" to CFLAGS - The library basename was renamed to libnl-3, i.e. the SO names become libnl-3.so., libnl-route-3.so, etc. - libtool versioning was assumed, to ease detection of compatible library versions. If you are using pkg-config for detecting and linking against the library things will continue magically as if nothing every happened. If you are linking manually you need to adapt your Makefiles or switch to using pkg-config files. -------------------------------------------------------------------------------
三、再次编译那个软件的时候需要先执行如下命令,让编译能找到对应的lib
export LIBGNUTLS_LIBS="-L/usr/lib/ -lgnutls" export LIBGNUTLS_CFLAGS="-I/usr/include/" export LIBNL3_CFLAGS="-I/usr/include/libnl3" export LIBNL3_LIBS="-L/usr/lib/ -lnl-3 -lnl-route-3"
四、检查是否安装成功
# pkg-config --cflags --libs libnl-xfrm-3.0 -I/usr/local/include/libnl3 -L/usr/local/lib -lnl-xfrm-3 -lnl-3 # pkg-config --cflags --libs libnl-nf-3.0 -I/usr/local/include/libnl3 -L/usr/local/lib -lnl-nf-3 -lnl-route-3 -lnl-3 # pkg-config --cflags --libs libnl-route-3.0 -I/usr/local/include/libnl3 -L/usr/local/lib -lnl-route-3 -lnl-3 # pkg-config --cflags --libs libnl-genl-3.0 -I/usr/local/include/libnl3 -L/usr/local/lib -lnl-genl-3 -lnl-3
五、libnl3 是什么?
核心库(core library)提供了使用 netlink 套接字进行通信的基础功能。它处理套接字的连接建立和断开、发送和接收数据、构造和解析消息、提供可配置的接收状态机。除此之外它还提供了一套抽象数据类型的框架,这套框架使得基于对象的 netlink 协议实现起来更加的简单,在这种协议中,对象可以通过基于 netlink 的协议来添加、删除、或者修改。
具体请阅读如下链接: http://blog.guorongfei.com/netlink/2015/01/20/libnl-translation-part1.html
文章评论