Chinaunix首页 | 论坛 | 博客
  • 博客访问: 322957
  • 博文数量: 41
  • 博客积分: 2540
  • 博客等级: 少校
  • 技术积分: 570
  • 用 户 组: 普通用户
  • 注册时间: 2008-12-18 11:29
文章分类

全部博文(41)

文章存档

2011年(4)

2010年(32)

2009年(3)

2008年(2)

我的朋友

分类: LINUX

2008-12-18 12:44:34

os:ubuntu 8.10
kernel: 2.6.24.22
arm-linux-gcc 3.3.2
arm kernel: 2.6.13
squid-3.0.STABLE5
因为在开发板上用到squid3代理服务器
,所以开始移植,把遇到的问题贴出来,方便大家遇到类似的情况时,有个参考。

大概看了看configure文件,没什么特殊的需要,直接使用默认配置
./configure --host=arm-linux --prefix=/home/risco/3.3.2/squid3

遇到了第一个问题:


checking if epoll works... configure: error: cannot run test program while cross


这个是生成Makefile文件时,比较常见的错误,因为需要交叉编译不能在主机上进行测试。
解决方法:


risco@E4500: echo ac_cv_have_abstract_sockets=yes > arm-linux.cache

risco@E4500: ./configure --host=arm-linux --prefix=/home/risco/3.3.2/squid3 --cache-file=arm-linux.cache


configure在此顺利通过。
第二个问题:


checking if strnstr is well implemeented... configure: error: cannot run test program while cross


在configure文件中查找 strnstr is well,找到变量ac_cv_func_strnstr。使用和上个问题相同的方法:
risco@E4500 echo ac_cv_func_strnstr=yes >> arm-linux.cache
configure能够顺利通过。但是,在make时就会遇到问题。src目录下client_side.cc文件,提示2917行strnstr没有声明,第一次使用。查看该文件有只有一个squid_strnstr函数,其他地方没有strnstr关键字,是这里有问题。想了半天也搞懂为啥提示strnstr错误而不是squid_strnstr。向后一看找到了问题的原因:


 { echo "$as_me:$LINENO: checking if strnstr is well implemented" >&5
echo $ECHO_N "checking if strnstr is well implemented... $ECHO_C" >&6; }
if test "${ac_cv_func_strnstr+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6

-----

else
  if test "$cross_compiling" = yes; then
  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
See \`config.log' for more details."
>&5
echo "$as_me: error: cannot run test program while cross compiling
See \`config.log' for more details."
>&2;}
   { (exit 1); exit 1; }; }
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
    // we expect this to succeed, or crash on over-run.

    // if it passes otherwise we may need a better check.

int main(int argc, char **argv)
{
    int size = 20;
    char *str = malloc(size);
    memset(str, 'x', size);
    strnstr(str, "fubar", size);
    return 0;
}
_ACEOF

...


如果在arm-linux.cache中加入变量ac_cv_func_strnstr。---后面的部分都不被执行。如果不cached掉,因为是交叉编译,后面的也不执行,所以直接修改Makefile文件。
if test "$cross_compiling" = yes; then
改为:
if test "$cross_compiling" = no; then
保存,接着configure,顺利通过。
这个是一个很暴力的方法,没有研究这个test program的作用为何会应想到以后的编译。工作中要用,偷个懒了...


接着会有几处和这个一样的提示,我也都是这么改的,没有一个个去cache掉。
到此,configure应该顺利通过了。

开始运行make,进行交叉编译。会提示如下错误:



./cf_gen cf.data ./cf.data.depend

./cf_gen: ./cf_gen: cannot execute binary file


因为使用交叉编译,生成的cf_gen文件不能执行。在解压一份原码包,使用主机的gcc编译,在src目录下得到,cf_gen文件放到交叉编译的src目录下。
接着make,搞定!~


放到了开发板上,调试了一天未果,报出现致命错误。大概看了看应给是和权限的设置有关系。suqid3不能使用root帐户运行。默认的会使用nobody帐户,但是他的权限在开发板上运行时,处处受阻。没有办法。
最好改使用了tinyproxy一个轻量级的代理服务器。虽然没有suqid3那么强大,但是对我已经足够使用...呵呵 在网上也没有看到在arm上运行squid有成功的例子,如果大家要在开发板上使用代理,强烈推荐tinyproxy....

阅读(2730) | 评论(0) | 转发(0) |
0

上一篇:没有了

下一篇:移植BlueZ到ARM开发板

给主人留下些什么吧!~~