新闻中心

EEPW首页 > 嵌入式系统 > 交叉编译场景分析(arm-linux)(二)

交叉编译场景分析(arm-linux)(二)

——
作者:时间:2007-04-17来源:http://blog.csdn.net/absurd收藏
1.基本信息:

.         过程分析

因为是cvs版本,所以先要生成configure脚本,tslib提供了一个autogen.sh文件,自然是用autogen.sh去产生了。运行:

[root@linux tslib]# ./autogen.sh

 

出现了如下错误:

: bad interpreter: No such file or directory

 

打开autogen.sh文件,发现了没有任何错误,猜想可能是一些不可见的非法字符引起的,用二进制方式打开该文件,发现它是dos格式的。需要转换成unix格式的。

 

索性用dos2unix把整个目录都转一遍。另外发现没有NEWS README AUTHORS 三个文件,为了避免出错,产生三个空文件:

[root@linux tslib]# touch NEWS README AUTHORS。

 

重新运行:

[root@linux tslib]# ./autogen.sh

 

一切OK!

 

现在来做真正的配置:

[root@linux tslib]# ./configure --host=$ARCH-linux --prefix=$ROOTFS_DIR/usr

 

配置成功,但make时,出现下列错误:

ts_test.o(.text+0x218): In function `main':

: undefined reference to `rpl_malloc'

 

在当前目录查找了rpl_malloc,发现configure里有#define malloc rpl_malloc一行。分析configure 脚本相关的代码,原来是ac_cv_func_malloc_0_nonnull引起的,OK我们不让它检查了,产生一个cache文件arm-linux.cache,欺骗configure:

[root@linux tslib]# echo "ac_cv_func_malloc_0_nonnull=yes" >$ ARCH -linux.cache

[root@linux tslib]# ./configure --prefix=$(ROOTFS_DIR)/usr --host=$ ARCH -linux --cache-file=$ ARCH -linux.cache

 

配置成功后,重新编译一下,OK!

 

3.         构建处方

l         tslib.mk

TSLIB_DIR="tslib"

 

all: clean config build

 

config:

    @cd $(TSLIB_DIR) && find * -exec dos2unix {} ; && 

    touch NEWS README AUTHORS && 

    ./autogen.sh && 

    echo "ac_cv_func_malloc_0_nonnull=yes" >$$ARCH-linux.cache && 

    ./configure --prefix=$$ROOTFS_DIR/usr --host=$$ARCH-linux --cache-file=$$ARCH-linux.cache && 

    echo "config done"

 

build:

    @cd $(TSLIB_DIR) && 

    make && make install && 

    echo "build done"

clean:

    @cd $(TSLIB_DIR) && 

    if [ -e Makefile ]; then make distclean; fi && 

echo "clean done"



评论


相关推荐

技术专区

关闭