开发平台: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; }