Ubuntu 安装FastFDS 例子,步骤

Ubuntu 安装FastFDS 例子,步骤,Ubuntu 安装FastFDS 例子,步骤

1:安装gcc

    方法一:

    sudo apt-get build-dep gcc

    方法二:

    sudo apt-get install build-essential

2:安装libevent

   1.先用:ls -al /usr/lib | grep libevent  查看是否已安装

   2.下载libevent安装包

   3.切换到解压后的 libevent 主目录

   4:执行:

  ./configure –prefix=/usr (或 ./configure --program-prefix=/usr)

   make

   make install

或者可以直接按  http://coffeelover.iteye.com/blog/721675 步骤来安装libevent

3:安装、配置FastFDS具体安装方法:

    http://soartju.iteye.com/blog/803477

安装过程中错误整理:

1:sudo ./make.sh 出现:commend not fond 

解决办法:使用root账号修改make.sh 的权限 chmoed 777 make.sh

2:make: Nothing to be done for `all'.

     解决办法:这句提示是说明你已经编译好了,而且没有对代码进行任何改动。此时在当前目录下你应该看到一个Image                    文件。它就是内核编译后得到的bootimage文件。

           若想重新编译,可以先删除以前编译产生的目标文件:

           make clean

           然后再

           make

                   或者不用管继续下一步。

3:出现错误类似:

/home/FastDFS/FastDFS/tracker/../common/sched_thread.c:493: undefined reference to `pthread_create' ../common/pthread_func.o:   

In function `init_pthread_lock': /home/FastDFS/FastDFS/tracker/../common/pthread_func.c:32: undefined reference to `pthread_mutexattr_init'   

/home/FastDFS/FastDFS/tracker/../common/pthread_func.c:40: undefined reference to `pthread_mutexattr_settype'   

/home/FastDFS/FastDFS/tracker/../common/pthread_func.c:57: undefined reference to `pthread_mutexattr_destroy' ../common/pthread_func.o:  

 In function `init_pthread_attr': /home/FastDFS/FastDFS/tracker/../common/pthread_func.c:84: undefined reference to `pthread_attr_getstacksize'   

/home/FastDFS/FastDFS/tracker/../common/pthread_func.c:115: undefined reference to `pthread_attr_setstacksize' ../common/pthread_func.o:   

In function `create_work_threads': /home/FastDFS/FastDFS/tracker/../common/pthread_func.c:156: undefined reference to `pthread_create'   

../common/pthread_func.o:   

In function `kill_work_threads': /home/FastDFS/FastDFS/tracker/../common/pthread_func.c:182: undefined reference to `pthread_kill'   

  解决办法:

  其实是不同的系统中pthread位置不一样,做法就是找到你的系统中所需要的libpthread.so文件位置,直接find就可以找到了;

  root@ www.linuxidc.com:~# find / -name 'libpthread.a'  

  /usr/lib/i386-linux-gnu/xen/libpthread.a  

  /usr/lib/i386-linux-gnu/libpthread.a  

  root@ www.linuxidc.com:~# find / -name 'libpthread.so'  

   /usr/lib/i386-linux-gnu/libpthread.so  

   找到:libpthread.a  和 libpthread.so 的路径

   修改make.sh文件:

   把if [ -f /usr/lib/libpthread.so ] || [ -f /usr/local/lib/libpthread.so ] || [ -f /usr/lib64/libpthread.so ] || [ -f /usr/lib/libpthread.a ] || [ -f /usr/local/lib/libpthread.a ] || [ -f /usr/lib64/libpthread.a ]; then   LIBS="$LIBS -lpthread"   

   里面的路径换成刚才查找到的路径

4:进入系统乱码

  解决办法:

  进入系统后

$sudo vim /etc/environment 

LANG="zh_CN.UTF-8"

LANGUAGE="zh_CN:zh"

修改为

LANG="en_GB.UTF-8"

LANGUAGE="en_US:en"

$sudo vim /etc/default/init/locale

修改同上

reboot

来源于:http://www.liusuping.com/ubuntu-linux/ubuntu-linuxe-server-luanma-jiejuebanfa.html

5:1)如果无法执行,则需要先安装gcc,Ubuntu系统可通过:sudo apt-get install gcc 安装。

2)Ubuntu系统上安装时需要将 make.sh 最后一段if去掉(从 if [ "$uname" = "Linux" ]; then 开始到倒数第2行),否则 ./make.sh install 时会报错。

3)执行./make.sh install时可能需要 root 权限

猜你喜欢

转载自tompig.iteye.com/blog/1659268
今日推荐