Libnl 安装笔记

1.  Download Libnl

http://www.infradead.org/~tgr/libnl/

libnl DOC: http://www.infradead.org/~tgr/libnl/doc/core.html

Some userful doc :http://www.gridmpi.org/pspacer-2.1/libnl-1.0-pre6/group__link.html

https://blogs.oracle.com/linuxnstuff/entry/adventures_in_netlink

2. Run "Linux_network.c"

gcc Linux_network.c -lnl -I/usr/local/include

3. Check reference of the new-installed library

#  pkg-config --cflags --libs libnl-route-3.0

-I/usr/local/include/libnl3  -L/usr/local/lib -lnl-route-3 -lnl-3

Then I should run the following command to execute "netlink.c"

# gcc netlink.c $(pkg-config --cflags --libs libnl-route-3.0)
Or

# gcc netlink.c -I /usr/local/include/libnl3 -L /usr/local/lib -lnl-route-3 -lnl-3

4. In eclipse include header files in "GCC complier includes", and add "nl-3" and "nl-route-3", then it will run.


--------------------------------------------

 nm /usr/local/lib/libnl.so > j

 grep alloc j

原文地址:https://www.cnblogs.com/kungfupanda/p/2855215.html