libnl3安装及使用

使用root用户安装

 

# yum install libnl3
Loaded plugins: langpacks, presto, refresh-packagekit
Repository updates is listed more than once in the configuration
Repository updates-debuginfo is listed more than once in the configuration
Repository updates-source is listed more than once in the configuration
Repository fedora is listed more than once in the configuration
Repository fedora-debuginfo is listed more than once in the configuration
Repository fedora-source is listed more than once in the configuration
Resolving Dependencies
--> Running transaction check
---> Package libnl3.i686 0:3.2.7-1.fc17 will be updated
---> Package libnl3.i686 0:3.2.21-1.fc17 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================
 Package                         Arch                          Version                                Repository                        Size
=============================================================================================================================================
Updating:
 libnl3                          i686                          3.2.21-1.fc17                          updates                          186 k

Transaction Summary
=============================================================================================================================================
Upgrade  1 Package

Total download size: 186 k
Is this ok [y/N]: y
Downloading Packages:
Setting up and reading Presto delta metadata
libnl3-3.2.21-1.fc17.i686.rpm                                                                                         | 186 kB     00:00     
Running Transaction Check
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating   : libnl3-3.2.21-1.fc17.i686                                                                                                 1/2 
  Cleanup    : libnl3-3.2.7-1.fc17.i686                                                                                                  2/2 
  Verifying  : libnl3-3.2.21-1.fc17.i686                                                                                                 1/2 
  Verifying  : libnl3-3.2.7-1.fc17.i686                                                                                                  2/2 

Updated:
  libnl3.i686 0:3.2.21-1.fc17                                                                                                                

Complete!


 

# yum install libnl3-devel
Loaded plugins: langpacks, presto, refresh-packagekit
Repository updates is listed more than once in the configuration
Repository updates-debuginfo is listed more than once in the configuration
Repository updates-source is listed more than once in the configuration
Repository fedora is listed more than once in the configuration
Repository fedora-debuginfo is listed more than once in the configuration
Repository fedora-source is listed more than once in the configuration
Resolving Dependencies
--> Running transaction check
---> Package libnl3-devel.i686 0:3.2.21-1.fc17 will be installed
--> Processing Dependency: libnl3-cli = 3.2.21-1.fc17 for package: libnl3-devel-3.2.21-1.fc17.i686
--> Processing Dependency: libnl-cli-3.so.200 for package: libnl3-devel-3.2.21-1.fc17.i686
--> Running transaction check
---> Package libnl3-cli.i686 0:3.2.21-1.fc17 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================
 Package                             Arch                        Version                                Repository                      Size
=============================================================================================================================================
Installing:
 libnl3-devel                        i686                        3.2.21-1.fc17                          updates                         54 k
Installing for dependencies:
 libnl3-cli                          i686                        3.2.21-1.fc17                          updates                         58 k

Transaction Summary
=============================================================================================================================================
Install  1 Package (+1 Dependent package)

Total download size: 112 k
Installed size: 430 k
Is this ok [y/N]: y
Downloading Packages:
(1/2): libnl3-cli-3.2.21-1.fc17.i686.rpm                                                                              |  58 kB     00:00     
(2/2): libnl3-devel-3.2.21-1.fc17.i686.rpm                                                                            |  54 kB     00:00     
---------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                         12 kB/s | 112 kB     00:09     
Running Transaction Check
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : libnl3-cli-3.2.21-1.fc17.i686                                                                                             1/2 
  Installing : libnl3-devel-3.2.21-1.fc17.i686                                                                                           2/2 
  Verifying  : libnl3-devel-3.2.21-1.fc17.i686                                                                                           1/2 
  Verifying  : libnl3-cli-3.2.21-1.fc17.i686                                                                                             2/2 

Installed:
  libnl3-devel.i686 0:3.2.21-1.fc17                                                                                                          

Dependency Installed:
  libnl3-cli.i686 0:3.2.21-1.fc17                                                                                                            

Complete!

 

安装完成后出现以下文件

$ ls /usr/lib/libnl*
/usr/lib/libnl-3.so           /usr/lib/libnl-cli-3.so.200.16.1   /usr/lib/libnl-nf-3.so.200          /usr/lib/libnl.so
/usr/lib/libnl-3.so.200       /usr/lib/libnl-genl-3.so           /usr/lib/libnl-nf-3.so.200.16.1     /usr/lib/libnl.so.1
/usr/lib/libnl-3.so.200.16.1  /usr/lib/libnl-genl-3.so.200       /usr/lib/libnl-route-3.so           /usr/lib/libnl.so.1.1
/usr/lib/libnl-cli-3.so       /usr/lib/libnl-genl-3.so.200.16.1  /usr/lib/libnl-route-3.so.200
/usr/lib/libnl-cli-3.so.200   /usr/lib/libnl-nf-3.so             /usr/lib/libnl-route-3.so.200.16.1

/usr/lib/libnl:
cli


 

$ ls /usr/include/libnl3/netlink/
addr.h       cache.h  errno.h     handlers.h   list.h     netlink-compat.h  object-api.h  socket.h  version.h
attr.h       cli      fib_lookup  hash.h       msg.h      netlink.h         object.h      types.h
cache-api.h  data.h   genl        hashtable.h  netfilter  netlink-kernel.h  route         utils.h


 

$ ls /usr/lib/pkgconfig/libnl-*
/usr/lib/pkgconfig/libnl-1.pc    /usr/lib/pkgconfig/libnl-cli-3.0.pc   /usr/lib/pkgconfig/libnl-nf-3.0.pc
/usr/lib/pkgconfig/libnl-3.0.pc  /usr/lib/pkgconfig/libnl-genl-3.0.pc  /usr/lib/pkgconfig/libnl-route-3.0.pc

 


*.pc文件由pkg-config程序使用

$ pkg-config --cflags --libs libnl-3.0
-I/usr/include/libnl3  -lnl-3  


编译程序的使用pkg-config为gcc传递参数

指定头文件搜索路径和链接库名称

$ gcc myprogram.c -o myprogram $(pkg-config --cflags --libs libnl-3.0)


 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值