boa 移植笔记
BOA移植过程
在Linux(pc端)上进行移植
1.下载boa源码
http://www.boa.org/
2.解压文件,并进入./boa-0.94.13/src目录
tar -xvf boa-0.94.13.tar.gz
cd ./boa-0.94.13/src/
3. 执行./configure配置编译环境
执行环境变量配置:
root@linux:src# source /opt/fsl-imx-wayland/5.4-zeus/environment-setup-aarch64-poky-linux
root@linux:src# ./configure --host=aarch64-poky-linux-gcc
4. make编译源码
root@linux:src# make
出现错误:
compat.h:120:30: note: in definition of macro ‘TIMEZONE_OFFSET’
#define TIMEZONE_OFFSET(foo) foo##->tm_gmtoff
^
make: *** [util.o] Error 1
解决方案:
root@linux:src# vim compat.h +120
#define TIMEZONE_OFFSET(foo) (foo)->tm_gmtoff //修改成这个
//#define TIMEZONE_OFFSET(foo) foo##->tm_gmtoff //注释掉
root@linux:src# vim boa.c +225
225 #if 0 //注释掉
226 if (setuid(0) != -1) {undefined
227 DIE("icky Linux kernel bug!");
228 }
229 #endif
root@linux:src# make clean
root@linux:src# make
5.创建boa安装目录 /boa
root@linux:src# mkdir -p /boa /boa/www /boa/cgi-bin /boa/log
6.修改defines.h文件中的SERVER_ROOT,使其指向改动后的配置文件路径
root@linux:src# cp boa /boa/
root@linux:boa-0.94.13# vim src/defines.h +30
30 #define SERVER_ROOT "/boa"
31 //#define SERVER_ROOT "/etc/boa"
7.复制必要的文件到安装目录
root@linux:boa-0.94.13# cp boa.conf /boa/
root@linux:src# cd ./src
root@linux:src# cp boa /boa/
root@linux:src# cp boa_indexer /boa/
root@linux:src# cp /etc/mime.types /boa/
8.修改boa配置文件
root@linux:src# cd /boa
root@linux:boa# ls
boa boa.conf boa_indexer cgi-bin log mime.types www
root@linux:boa# cp boa.conf boa.conf.back
root@linux:boa# cat boa.conf.back | grep -v "#" | grep -v "^$" > boa.conf
root@linux:boa# vim boa.conf
修改成:
Port 80
User 0
Group 0
#Listen 192.68.0.5
ErrorLog /boa/log/error_log
AccessLog /boa/log/access_log
DocumentRoot /boa/www
UserDir public_html
DirectoryIndex index.html
DirectoryMaker /boa/boa_indexer
KeepAliveMax 1000
KeepAliveTimeout 10
MimeTypes /boa/mime.types
DefaultType text/plain
CGIPath /bin:/usr/bin:/usr/local/bin
Alias /doc /usr/doc
ScriptAlias /cgi-bin/ /boa/cgi-bin/
问题解决:
1:
在arm板上面运行提示
-bash: ./boa: cannot execute binary file: Exec format error
解决办法:
在Makefile中修改原来的
CC = gcc
修改如下:
CC = aarch64-poky-linux-gcc -mcpu=cortex-a53+crc+crypto -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/opt/fsl-imx-wayland/5.4-zeus/sysroots/aarch64-poky-linux
CPP = aarch64-poky-linux-gcc -E -mcpu=cortex-a53+crc+crypto -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/opt/fsl-imx-wayland/5.4-zeus/sysroots/aarch64-poky-linux
再执行make
2:执行./boa 出错
Could not chdir to "/etc/boa": aborting
解决办法:
修改defines.h中的
#ifndef SERVER_ROOT
//#define SERVER_ROOT "/etc/boa"
#define SERVER_ROOT "/boa"
#endif
参考:
https://blog.csdn.net/feit2417/article/details/84777523
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)