算法库之三:libcprops的交叉编译

    开发平台:Ubuntu11.04

    编 译 器:arm-gcc-4.1.1.tar.bz2(可从http://download.csdn.net/detail/npy_lp/3821111上下载);gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4)

    libcprops源码包:libcprops-0.1.12.tar.bz2 (可从官网http://cprops.sourceforge.net/上下载)

 

    libcprops库实现了很多常见数据结构的算法,并遵守GNU GPL协议。

     

    1、在X86上的编译和安装

    编译适用于X86平台的libcprops库: 

$ tar jvxf libcprops-0.1.12.tar.bz2
$ cd libcprops-0.1.12/
$ ./configure --prefix=/usr --bindir=$PWD/_install/bin --mandir=$PWD/_install/man
$ make
$ sudo make install

    把库和头文件分别安装到Ubuntu的/usr/lib和/usr/include目录下,其它安装在当前目录的_install目录下。

    查看帮助文件: 

$ cd _install/man/man3/
$ man ./libcprops.3

    执行测试程序: 

$ cd example/
$ make
$ ./test_hashtable

    2、交叉编译适用于ARM平台的libcprops库 

$ tar jvxf libcprops-0.1.12.tar.bz2
$ cd libcprops-0.1.12/
$ ./configure CC=arm-linux-gnu-gcc --build=i686-pc-linux-gnu --host=arm-linux --prefix=$HOME/4.1.1/arm-linux-gnu --bindir=$PWD/_install/bin --mandir=$PWD/_install/man
$ make
$ make install

    把库和头文件分别安装到交叉编译器(这里的交叉编译器存放在$HOME目录下)的4.1.1/arm-linux-gnu/lib和4.1.1/arm-linux-gnu/include目录下。

    取消对PTHREAD_MUTEX_RECURSIVE和PTHREAD_MUTEX_RECURSIVE_NP两个选项的检查,否则配置过程中会产生以下错误: 

checking whether PTHREAD_MUTEX_RECURSIVE is supported... configure: error: in `/.../libcprops-0.1.12':
configure: error: cannot run test program while cross compiling
See `config.log' for more details

$ vi configure

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether PTHREAD_MUTEX_RECURSIVE is supported" >&5
$as_echo_n "checking whether PTHREAD_MUTEX_RECURSIVE is supported... " >&6; }
if test "$cross_compiling" = yes; then :  //把yes改成no
  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run test program while cross compiling
See \`config.log' for more details" "$LINENO" 5; }
checking whether PTHREAD_MUTEX_RECURSIVE_NP is supported... configure: error: in `/home/richard/algorithm/libcprops-0.1.12':
configure: error: cannot run test program while cross compiling
See `config.log' for more details

$ vi configure

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether PTHREAD_MUTEX_RECURSIVE_NP is supported" >&5
$as_echo_n "checking whether PTHREAD_MUTEX_RECURSIVE_NP is supported... " >&6; }
if test "$cross_compiling" = yes; then :  //把yes改成no
  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run test program while cross compiling
See \`config.log' for more details" "$LINENO" 5; }


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

tanglinux

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值