分类: LINUX
2011-02-16 17:00:23
1,下载appweb源代码:
2,解压:
#tar -xvzf appwe-src-2.4.0-0.tar.gz
3,修改环境变量:
#export CC=/usr/local/arm/3.4.1/bin/arm-linux-gcc
#export AR=/usr/local/arm/3.4.1/bin/arm-linux-ar
#export LD=/usr/local/arm/3.4.1/bin/arm-linux-ld
#export RANLIB=/usr/local/arm/3.4.1/bin/arm-linux-ranlib
#export STRIP=/usr/local/arm/3.4.1/bin/arm-linux-strip
#export CC_FOR_BUILD=gcc
4,下载matrixssl源代码:
5,解压到/root/wangyi/下:
#tar-xvzf matrixssl-1-8-3-open.tar.gz
6,进入/root/wangyi/src/matrixssl-1-8-3-open/src下修改Makefile:
修改CC,STRIP,AR,RANLIB为我们的交叉编译器,如:
CC = /opt/crosstool/gcc-3.4.1-glibc-2.3.3/arm-softfloat-linux-gnu/bin/arm-softfloat-linux-gnu-gcc
7,make
此时会在当前目录下生成动态链接库libmatrixssl.so和静态链接库libmatrixsslstatic.a这在下面一步配置和编译Appweb时将会用到.
8,对appweb进行./configure:
./configure --host=arm-s3c2410-linux
--build=i686-pc-linux --port=80 --type=RELEASE --disable-log
--enable-multi-thread --disable-shared --disable-samples
--disable-shared-libc --enable-static --disable-test
--disable-access-log --enable-ejs --disable-modules --with-cgi=builtin
--with-copy=builtin --with-auth=builtin --with-esp=builtin
--with-upload=builtin --with-c-api=builtin --without-php5
--with-ssl=builtin --with-matrixssl=builtin
--with-matrixssl-dir=/root/wangyi/matrixssl-1-8-6-open/src
--with-matrixssl-libpath=/root/wangyi/matrixssl-1-8-6-open/src
--with-matrixssl-iflags="-I /root/wangyi/matrixssl-1-8-6-open/src -I
/root/wangyi/matrixssl-1-8-6-open/"
--with-matrixssl-libs=libmatrixsslstatic
可以通过./configure–-help查看相关说明.关于—with-matrixssl-libs需要说明:这个选项是告诉链接器,在生成appweb可执行文件时链接哪matrixssl一个lib库.如果想动态编译的话,那么我们就选择libmatrixssl.so这个库,此时我们应该指定withmatrixssllibs=libmatrixssl; 如果想静态编译的话,我们就应该选择libmatrixsslstatic.a这个静态库文件.此时应该指定
--with-matrixssl-libs=libmatrixsslstatic.
9 make
在此过程中会出现matrixssl源代码下的src/os/linux.c中的3个函数未定义错误,此时我们将相关部分注释掉就OK了.
line 123: pthread_mutexattr_init()
line 125 pthread_mutexattr_settype();
line 135 pthread_mutexattr_destroy()
make成功后,将在当appweb目录下生成appweb和appweb.conf文件.另外,里面还有一些matrixssl运行需要的一些Key.这些文件有:appweb(bin) ,appweb.conf(配置文件) ,mime.types ,目录web(DocumentRoot),server.key.pem,server.crt,server.key
10 运行appweb,开启web服务
./appweb -f appweb.conf
在浏览器中输入可是不能访问cgi,但可以访问html。。。。
提示是:[root@GlobalTime appweb]$./appweb -f appweb.conf
Unknown conditional OPENSSL_MODULE
Can't make temp file /tmp/MPR_920_127.tmp, errno 30
Can't create stdio files
Can't open CGI output files
502 "Bad Gateway" for "/cgi-bin/Login.cgi", file "/mnt/bin/appweb/www/cgi-bin/Lo
gin.cgi": Cant write to CGI program
原来他是要在/tmp下写一个super,而我的那个目录是只读的。在源代码中修改:
you can edit mpr/embedded.cpp and change mprMakeTempFileName and change /tmp to whatever you need.这是代码开发者给我的建议。。我把/tmp换成了/mnt。
好了这样就ok了