安装libevent
官网:http://libevent.org/
书籍:http://www.wangafu.net/~nickm/libevent-book/
Libevent参考手册翻译:http://blog.csdn.net/laoyi19861011/article/category/831215
Libevent参考手册翻译增加:http://blog.sina.com.cn/s/articlelist_1457448730_3_1.html
源码分析:http://www.cnblogs.com/hustcat/archive/2010/08/31/1814022.html
libevent源码分析
# wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
# tar xzfv libevent-2.0.21-stable.tar.gz
# cd libevent-2.0.21-stable
# ./configure -prefix=/usr/local/libevent
# make && make install
如果其他调用event的程序安装报错:
error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory
解决办法:
先得到libevent位置
# whereis libevent
[root@localhost test]# whereis libevent
libevent: /usr/local/libevent
On a 32 bit system:
# ln -s /usr/local/libevent/lib/libevent-2.0.so.5 /usr/lib/libevent-2.0.so.5
On a 64 bit system:
# ln -s /usr/local/libevent/lib/libevent-2.0.so.5 /usr/lib64/libevent-2.0.so.5
如果提示“创建符号链接 "/usr/lib64/libevent-2.0.so.5": 文件已存在”那么就是之前安装过,所以只要删除之前的即可
# rm -f libevent-2.0.so.5
重新链接即可
其他解决方法:
那就表示系统不知道xxx.so 放在哪个目录下。
这个时候就要在/etc/ld.so.conf中加入xxx.so所在的目录。
一般而言,有很多so档会在/usr/local/lib这个目录下,所以在/etc/ld.so.conf中加入/usr/local/lib这一行,可以解决此问题。
将 /etc/ld.so.conf存档后,还要执行「/sbin/ldconfig –v」来更新一下才会生效。
如果libevent安装是自定义-prefix=/usr/local/libevent
# gcc socket.c -o socket -Wl,-rpath,/usr/local/libevent/lib/ -L/usr/local/libevent/lib/ -levent -I/usr/local/libevent/include/
如果libevent安装是无-prefix
# gcc socket.c -o socket -levent
可以使用ldd查看动态链接库调用:
参考:GCC设定include和库路径
参考实例:
https://github.com/mike-zhang/testCodes
https://github.com/jasonish/libevent-examples
http://ishbits.googlecode.com/svn-history/r5/trunk/libevent_echosrv/
http://blog.linuxphp.org/archives/1482/
=============================================
libdatrie
http://linux.thai.net/~thep/datrie/datrie.html
#wget ftp://linux.thai.net/pub/ThaiLinux/software/libthai/libdatrie-0.2.4.tar.gz
# tar zxvf libdatrie-0.2.4.tar.gz