Chinaunix首页 | 论坛 | 博客
  • 博客访问: 293000
  • 博文数量: 77
  • 博客积分: 1422
  • 博客等级: 上尉
  • 技术积分: 932
  • 用 户 组: 普通用户
  • 注册时间: 2007-08-21 12:39
文章分类
文章存档

2011年(1)

2009年(3)

2008年(73)

我的朋友

分类:

2008-06-20 23:37:55

1.按照
  编写第一个基于net-snmp API 的应用程序
  编译链接通过,但是运行的时候 提示错误
  relocation error: /usr/lib/libnetsnmp.so.15: undefined symbol: RAND_bytes

2.google 发现是openssl 没有安装
  于是在下载openssl  
  #   tar   xvfz   openssl-0.9.6b.tar.gz  
  #   cd   openssl-0.9.6b 
  #   ./config 
  #   make 
  #   make   test 
  #   make   install  

3.重现编译链接程序 运行仍旧提示上面的错误

  configure + make + make install 一次要花半个小时以上呢 :(
  还好是在虚拟机上跑的,还可以做点别的事情 :)

4.继续google寻找答案
  在 中写到:

Before last night I had been experiencing problems getting NetSNMP's mib2c software to launch.  I searched the web and newsgroups with google, and even though the question has been posted many times, I didn't  find a good solution to the problem at first.
Since I did eventually figure it out however, I thought I'd post to this mailing list to help out others who may experience  this problem in the future!
The Problem: When running mib2c, you get the following error:
   /usr/lib/libnetsnmp.so.5: undefined symbol: RAND_bytes

Before the solution, let us discuss what this error means!
The error is basically the dynamic linker telling you that the shared object libnetsnmp.so is referencing a function named RAND_bytes, that cannot be found.  RAND_bytes belongs to the OpenSSL package.  So first off, make sure you have the OpenSSL package.  There is a 99% chance you already have the package, but NetSNMP just can't find it.

So the solution is to:

1) Make sure you have OpenSSL
2) Tell NetSNMP the location of OpenSSL through NetSNMPs configuration script.
3) Also, Tell NetSNMP to include perl modules.  Mib2c won't run without them.

Assuming OpenSSL is installed on your system, you can do the above with the following in the NetSNMP Distribution source directory.

   ./configure --with-openssl=/usr/lib --with-perl-modules

Replace /usr/lib/ with whatever folder contains the libssl.so shared object library files.  Then run make, make install, and all should be right in the world again!   You may also want to run "make test" to make sure everythign else is alright, in case you have other problems that I did not.

I hope this helps others in the future.  Cheers!




5.按照上面的提示
  在/usr/lib 目录下确实看到了libssl.so 文件
  于是重新编译net-snmp
  ./configure --with-openssl=/usr/lib --with-perl-modules
  make
  make install

6.重新编译程序,上面的错误依然存在,快崩溃了,5555555555555

7.原来每次重新configure make makeinstall后生成的netsnmp的so文件都放在/usr/local/lib下了
  而运行的时候会去找/usr/lib下的
  不幸的是我/usr/lib下有旧的netsnmp的so文件
  (这个还是这样发现的  我重新 configure make 之前将 /usr/lib 目录下的所有关于netsnmp的so  都删除了  然后make install 以后发现居然/usr/lib 下没有产生新的 so 文件)

8.cp /usr/local/lib/*netsnmp* /usr/lib 这样行不通哟
  因为/usr/local/lib/libnetsnmp.so.15  实际上是个链接文件,链接文件拷贝还是有点小问题的

  索性在/usr/lib下建立一个到/usr/local/lib/ibnetsnmp.so.15的链接吧
  ln -s /usr/local/lib/libnetsnmp.so.15 /usr/lib/libnetsnmp.so.15

9.重新编译链接源程序 运行
  总算大功告成了 :)
阅读(4944) | 评论(0) | 转发(0) |
0

上一篇:net-snmp安装日志

下一篇:vi的项目功能键

给主人留下些什么吧!~~