欢迎来到天天文库
浏览记录
ID:8893273
大小:11.67 KB
页数:2页
时间:2018-04-10
《libevent在linux下编译链接问题》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、libevent 在linux下编译链接问题 (2011-04-2511:43:20)转载▼标签: 杂谈分类: 知识收集按照网上例子搞了个httpd的小demo(linvo_httpd.c),遇到一连串问题,努力google了半天,终于得解,记录之~环境:Linux2.6.18-164.el5libevent-1.4.13首先用gcc编译时候报了类似下面信息的一堆错/tmp/ccsKVcym.o:Infunction`main':linvo_httpd.c:(.text+0xdf):undefinedreferenceto`event_init'linvo_httpd.c:(.text+0x
2、f3):undefinedreferenceto`evhttp_start'应该是找不到编译后的libevent库文件所导致,可能是路径问题这次在编译时加上了-levent参数后(让其到系统库中找event库),顺利编译通过gcc-Walllinvo_httpd.c-olinvo_httpd-levent./linvo_httpd 运行之~我擦,又来。。。。./linvo_httpd:errorwhileloadingsharedlibraries:libevent-1.4.so.2:cannotopensharedobjectfile:Nosuchfileordirectory依然是路径问
3、题找不到文件whereislibevent 看下我的libevent默认装到哪里了libevent:/usr/local/lib/libevent.la/usr/local/lib/libevent.so /usr/local/lib/libevent.a哦~在/usr/local/lib/目录下LD_DEBUG=libs ./linvo_httpd -v 看下demo程序究竟是到哪里去找的该文件 32372: findlibrary=libevent-1.4.so.2[0];searching 32372: searchcache=/etc/ld.so.c
4、ache 32372: searchpath=/lib/tls/i686/sse2:/lib/tls/i686:/lib/tls/sse2:/lib/tls:/lib/i686/sse2:/lib/i686:/lib/sse2:/lib:/usr/lib/tls/i686/sse2:/usr/lib/tls/i686:/usr/lib/tls/sse2:/usr/lib/tls:/usr/lib/i686/sse2:/usr/lib/i686:/usr/lib/sse2:/usr/lib (systemsearchpath) 32372:
5、tryingfile=/lib/tls/i686/sse2/libevent-1.4.so.2 32372: tryingfile=/lib/tls/i686/libevent-1.4.so.2 32372: tryingfile=/lib/tls/sse2/libevent-1.4.so.2 32372: tryingfile=/lib/tls/libevent-1.4.so.2 32372: tryingfile=/lib/i686/sse2/libevent-1.4.so.2 32372:
6、 tryingfile=/lib/i686/libevent-1.4.so.2 32372: tryingfile=/lib/sse2/libevent-1.4.so.2 32372: tryingfile=/lib/libevent-1.4.so.2 32372: tryingfile=/usr/lib/tls/i686/sse2/libevent-1.4.so.2 32372: tryingfile=/usr/lib/tls/i686/libevent-1.4.so.2 32372: t
7、ryingfile=/usr/lib/tls/sse2/libevent-1.4.so.2 32372: tryingfile=/usr/lib/tls/libevent-1.4.so.2 32372: tryingfile=/usr/lib/i686/sse2/libevent-1.4.so.2 32372: tryingfile=/usr/lib
此文档下载收益归作者所有