sip测试工具sipsak交叉编译及使用

这又是一个autoconf发布的包,有上次移植pjsip的经验,这次就轻松很多了。虽然还是小有点问题

用下面一句进行configure,产生Makefile:

CC=armv5l-linux-gcc ./configure --host=armv5l-linux --target=armv5l-linux --build=i386-redhat-linux

OK!make。。。

sipsak.o: In function `main':
/home/voip_prj/sipsak/sipsak/sipsak.c:542: undefined reference to `rpl_malloc'
collect2: ld returned 1 exit status
make[1]: *** [sipsak] 错误1
make[1]: Leaving directory `/home/voip_prj/sipsak/sipsak'
make: *** [all] 错误 2

额,放狗去找错误undefined reference to `rpl_malloc'。

结果:1、configure的时候加上--with-gnu-ld这个参数 2、或者在config.h里加上#undef rpl_malloc

在configure的时候假如参数--with-gnu-ld,没有成功;在config.h里加入#undef rpl_malloc也没成功。。。不过看到一句

#define malloc rpl_malloc 为什么一定要把malloc给用rpl_malloc替换?so,立马注释掉!

make,成功!file sipsak:

sipsak: ELF 32-bit LSB executable, ARM, version 1 (ARM), for GNU/Linux 2.2.5, dynamically linked (uses shared libs), for GNU/Linux 2.2.5, not stripped
下载到板子运行正常。

 又搜了下,发现一哥们是这么解决的:

当前目录查找了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

据说也可以,没有尝试。

——————
无论在哪里做什么,只要坚持服务、创新、创造价值,其他的东西自然都会来的。
原文地址:https://www.cnblogs.com/pied/p/1675706.html