libnl3安装及使用

来源:互联网 发布:遗传算法优化svm参数 编辑:程序博客网 时间:2024/06/10 12:46

使用root用户安装

 

# yum install libnl3Loaded plugins: langpacks, presto, refresh-packagekitRepository updates is listed more than once in the configurationRepository updates-debuginfo is listed more than once in the configurationRepository updates-source is listed more than once in the configurationRepository fedora is listed more than once in the configurationRepository fedora-debuginfo is listed more than once in the configurationRepository fedora-source is listed more than once in the configurationResolving 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 ResolutionDependencies Resolved============================================================================================================================================= Package                         Arch                          Version                                Repository                        Size=============================================================================================================================================Updating: libnl3                          i686                          3.2.21-1.fc17                          updates                          186 kTransaction Summary=============================================================================================================================================Upgrade  1 PackageTotal download size: 186 kIs this ok [y/N]: yDownloading Packages:Setting up and reading Presto delta metadatalibnl3-3.2.21-1.fc17.i686.rpm                                                                                         | 186 kB     00:00     Running Transaction CheckRunning Transaction TestTransaction Test SucceededRunning 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-develLoaded plugins: langpacks, presto, refresh-packagekitRepository updates is listed more than once in the configurationRepository updates-debuginfo is listed more than once in the configurationRepository updates-source is listed more than once in the configurationRepository fedora is listed more than once in the configurationRepository fedora-debuginfo is listed more than once in the configurationRepository fedora-source is listed more than once in the configurationResolving 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 ResolutionDependencies Resolved============================================================================================================================================= Package                             Arch                        Version                                Repository                      Size=============================================================================================================================================Installing: libnl3-devel                        i686                        3.2.21-1.fc17                          updates                         54 kInstalling for dependencies: libnl3-cli                          i686                        3.2.21-1.fc17                          updates                         58 kTransaction Summary=============================================================================================================================================Install  1 Package (+1 Dependent package)Total download size: 112 kInstalled size: 430 kIs this ok [y/N]: yDownloading 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 CheckRunning Transaction TestTransaction Test SucceededRunning 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.hattr.h       cli      fib_lookup  hash.h       msg.h      netlink.h         object.h      types.hcache-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)


 

原创粉丝点击