jabberd编译安装

来源:互联网 发布:淘宝评价超过15天 编辑:程序博客网 时间:2024/05/16 12:30

一、准备需要安装的软件包(libidn,udns,gsasl),分别从以下地址下载:

      wget ftp://ftp.gnu.org/gnu/gsasl/libgsasl-1.6.1.tar.gz
      wget http://www.corpit.ru/mjt/udns/udns-0.2.tar.gz
     wget http://ftp.gnu.org/gnu/libidn/libidn-1.9.tar.gz    

1, 操作系统为RedHat Enterprise Linux 5, 选择了最小化安装。我们的目的是不使用系统里现有的库,全部使用我们自己编译的,这样做的目的是搭建出一个不依赖系统jabberd。
2, 准备了使用的安装包:
    cyrus-sasl-2.1.23.tar.gz
    jabberd-2.2.11.tar.bz2
    libidn-1.19.tar.gz

   openssl-1.0.0a.tar.gz

    expat-2.0.1.tar.gz

    libgcrypt-1.4.6.tar.bz2
    mysql-5.0.91-linux-i686-glibc23.tar.gz
    udns_0.0.9.tar.gz
    zlib-1.2.5.tar.gz
    libgsasl-1.4.4.tar.gz

3, 创建目录:
    mkdir -p /usr/local/easyjabberd/app

4, 先安装MySQL:
   我们下载了mysql的是已经编译好的二进制包,直接解压缩就可以使用
   (1), tar zxvf mysql-5.0.91-linux-i686-glibc23.tar.gz
   (2), cp -R mysql-5.0.91-linux-i686-glibc23 /usr/local/easyjabberd/app/mysql

5, 安装expat,用作XML解析
   (1), tar zxvf expat-2.0.1.tar.gz
   (2), ./configure --prefix=/usr/local/easyjabberd/app/expat
   (3), make
   (4), make install

6, 安装libidn
   (1), tar zxvf libidn-1.19.tar.gz
   (2), ./configure --prefix=/usr/local/easyjabberd/app/libidn
   (3), make
   (4), make install

7, 安装udns
   udns的configure没有提供--prefix,所以我们编译后,手动拷贝所需要的文件到/usr/local/easyjabberd/app/udns目录下
   (1), mkdir -p /usr/local/easyjabberd/app/udns/include
   (2), mkdir -p /usr/local/easyjabberd/app/udns/lib
   (3), ./configure
   (4), make
   (5), cp udns.h /usr/local/easyjabberd/app/udns/include/
   (6), cp libudns.a /usr/local/easyjabberd/app/udns/lib/

8, 安装openssl
   (1), tar zxvf openssl-1.0.0a.tar.gz
   (2), cd openssl-1.0.0a
   (3), ./config --prefix=/usr/local/easyjabberd/app/
   (4), make
   (4), make install

9, 安装Cyrus sasl
   (1), tar zxvf cyrus-sasl-2.1.23.tar.gz
   (2), cd cyrus-sasl-2.1.23
   (3), ./configure --prefix=/usr/local/easyjabberd/app/ --with-openssl=/usr/local/easyjabberd/app/ CPPFLAGS="-I/usr/local/easyjabberd/app/include/ -I/usr/local/easyjabberd
/app/include/openssl" LDFLAGS="-L/usr/local/easyjabberd/app/lib"
   (4), make
   (5), make install

10, 安装zlib
    (1), tar zxvf zlib-1.2.5.tar.gz
    (2), cd zlib-1.2.5
    (3), ./configure --prefix=/usr/local/easyjabberd/app/
    (4), make
    (5), make install

11,  安装Jabberd2
   (1), tar jxvf jabberd-2.2.11.tar.bz2
   (2), cd jabberd-2.2.11
   (3), ./configure --prefix=/usr/local/easyjabberd/jabberd2 --enable-mysql=/usr/local/easyjabberd/mysql/ CFLAGS="-I/usr/local/easyjabberd/app/include -I/usr/local/easyjabberd/app/include/openssl" LDFLAGS="-L/usr/local/easyjabberd/app/lib -Wl,-R/usr/local/easyjabberd/app/lib" --with-extra-include-path=/usr/local/easyjabberd/app/include --with-extra-library-path=/usr/local/easyjabberd/app/lib  --with-sasl=cyrus --enable-mio=epoll
   (4), make
   (5), 调试报错,sx/sasl_cyrus.c 23行注释掉

   (6), make
   (7), make install

好了,如果一切顺利,到这里Jabberd2服务器已经编译、安装完成。

     ================以上内容完全转载自fytzzh的博客:http://blog.chinaunix.net/uid-345900-id-2131348.html


二、编译过程中遇到的问题: 

    1) udns包找不到

            udns的configure没有提供--prefix,所以我们编译后,手动拷贝所需要的文件到/usr/local/easyjabberd/app/udns目录下
   (1), mkdir -p /usr/local/easyjabberd/app/udns/include
   (2), mkdir -p /usr/local/easyjabberd/app/udns/lib
   (3), ./configure
   (4), make

   (5), cp udns.h /usr/local/easyjabberd/app/udns/include/

   (6), cp libudns.a /usr/local/easyjabberd/app/udns/lib/

          按照这个步骤操作之后,编译jabberd时仍然会提示udslib找不到的错误,将udns.h和libudns.a分别拷贝到app/include, app/lib目录下就好了

       2) 编译cyrus-sasl-2.1.23提示如下错误:
          #elif with no expression
      编译器版本为4.0,不识别#elif XXX, 修复方法在#elif后面加上defined :
          #elif defined HAVE_ALLOCA
          #include <stdlib.h>

        3) 编译cyrus-sasl-2.1.23提示如下错误:

digestmd5.c: In function 'digestmd5_client_mech_step':
digestmd5.c:4000: warning: pointer targets in assignment differ in signedness
make[2]: *** [digestmd5.lo] Error 1
make[2]: Leaving directory `/home/eugene/cyrus-sasl2_2.1.23.dfsg1/plugins'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/eugene/cyrus-sasl2_2.1.23.dfsg1'
make: *** [all] Error 2

         发现已经安装过,将原有的卸载掉:

[push@pushtest cyrus-sasl-2.1.23]$ rpm -qa |grep cyrus-sasl
cyrus-sasl-plain-2.1.23-13.el6.x86_64
cyrus-sasl-lib-2.1.23-13.el6.x86_64
cyrus-sasl-2.1.23-13.el6.x86_64
cyrus-sasl-devel-2.1.23-13.el6.x86_64


# rpm -e --allmatches --nodeps cyrus-sasl-plain
# rpm -e --allmatches --nodeps cyrus-sasl-lib 
# rpm -e --allmatches --nodeps cyrus-sasl-plain 
# rpm -e --allmatches --nodeps cyrus-sasl-devel 


        4)  编译jabberd的时候提示错误:

/bin/sh ../libtool --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..   -I/home/push/wuliang/program/jabberd2/app/include   -I/home/push/wuliang/program/jabberd2/app/include -I/home/push/wuliang/program/jabberd2/app/include/openssl -funsigned-char -MT sasl_cyrus.lo -MD -MP -MF .deps/sasl_cyrus.Tpo -c -o sasl_cyrus.lo sasl_cyrus.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I/home/push/wuliang/program/jabberd2/app/include -I/home/push/wuliang/program/jabberd2/app/include -I/home/push/wuliang/program/jabberd2/app/include/openssl -funsigned-char -MT sasl_cyrus.lo -MD -MP -MF .deps/sasl_cyrus.Tpo -c sasl_cyrus.c  -fPIC -DPIC -o .libs/sasl_cyrus.o
sasl_cyrus.c:23:2: error: #error Cyrus SASL implementation is not supported! It is included here only for the brave ones, that do know what they are doing. You need to remove this line to compile it.
sasl_cyrus.c: In function ‘_sx_sasl_decode’:
sasl_cyrus.c:723: warning: passing argument 3 of ‘sasl_decode64’ from incompatible pointer type
/home/push/wuliang/program/jabberd2/app/include/sasl/saslutil.h:27: note: expected ‘char *’ but argument is of type ‘char **’
sasl_cyrus.c: In function ‘_sx_sasl_encode’:
sasl_cyrus.c:729: warning: passing argument 3 of ‘sasl_encode64’ from incompatible pointer type
/home/push/wuliang/program/jabberd2/app/include/sasl/saslutil.h:40: note: expected ‘char *’ but argument is of type ‘char **’
make: *** [sasl_cyrus.lo] Error 1
[push@pushtest sx]$ 

         将sasl_cyrus.c:23的这个编译宏删掉:

#error Cyrus SASL implementation is not supported! It is included here only for the brave ones, that do know what they are doing. You need to remove this line to compile it.