当海思自带的uclibc库无法满足要求时,可以通过uclibc源码编译出满足要求的libc版本。如海思自带的uclibc库不支持LD_PRELOAD选项时,可以通过编译uclibc源码使其支持LD_PRELOAD选项。 编译的uclibc版本最好和当前系统的libc版本匹配,这样移植后续应用程序也比较方便,可以通过如下命令查看当前板子上的uclibc版本,我的板子上uclibc版本是0.9.33.2。 从如下地址下载对应版本的uclibc: 首先解压下载的uclibc源码压缩包: 其次设置对应的交叉编译器与编译选项: make选项设置完毕,使用如下命令编译,并查看生成的so文件: uclibc编译成功后,需要将生成的so文件拷贝到交叉编译器对应的目录,并重新编译你的应用程序。使用如下命令确认需要拷贝的目录: 将so拷贝到对应的目录后,需要重新链接应用程序,如果应用程序使用了c++,建议使用静态链接c++库,即在编译时添加选项: 将编译的所有so文件拷贝到开发板对应的目录,使用如下命令执行应用程序:
uclibc编译
查看现有版本
/nfs/h18e3 # ls /lib/ld* /lib/ld-uClibc-0.9.33.2.so /lib/ld-uClibc.so.0
下载源码
https://uclibc.org/downloads/
编译选项
tar xf uClibc-0.9.33.2.tar.bz2 cd uClibc-0.9.33.2/ make menuconfig
[cxm@cxm-desktop uClibc-0.9.33.2]$ make -j [cxm@cxm-desktop uClibc-0.9.33.2]$ ls ./lib/*so* ./lib/ld-uClibc-0.9.33.2.so ./lib/libcrypt.so.0 ./lib/libm-0.9.33.2.so ./lib/libpthread-0.9.33.2.so ./lib/libresolv.so.0 ./lib/libutil.so ./lib/ld-uClibc.so ./lib/libc.so ./lib/libm.so ./lib/libpthread.so ./lib/librt-0.9.33.2.so ./lib/libutil.so.0 ./lib/ld-uClibc.so.0 ./lib/libc.so.0 ./lib/libm.so.0 ./lib/libpthread.so.0 ./lib/librt.so ./lib/ld-uClibc.so.lds ./lib/libdl-0.9.33.2.so ./lib/libnsl-0.9.33.2.so ./lib/libresolv-0.9.33.2.so ./lib/librt.so.0 ./lib/libcrypt-0.9.33.2.so ./lib/libdl.so ./lib/libnsl.so ./lib/libresolv.a ./lib/libuClibc-0.9.33.2.so ./lib/libcrypt.so ./lib/libdl.so.0 ./lib/libnsl.so.0 ./lib/libresolv.so ./lib/libutil-0.9.33.2.so
编译应用程序
[cxm@cxm-desktop uClibc-0.9.33.2]$ arm-himix100-linux-gcc -print-file-name=libdl.so /opt/hisi-linux/x86-arm/arm-himix100-linux/host_bin/../target/usr/lib/libdl.so [cxm@cxm-desktop uClibc-0.9.33.2]$ file /opt/hisi-linux/x86-arm/arm-himix100-linux/host_bin/../target/usr/lib/libdl.so /opt/hisi-linux/x86-arm/arm-himix100-linux/host_bin/../target/usr/lib/libdl.so: symbolic link to ../../lib/libdl.so.0 [cxm@cxm-desktop uClibc-0.9.33.2]$ ls /opt/hisi-linux/x86-arm/arm-himix100-linux/host_bin/../target/usr/lib/../../lib/*9.33.2*so /opt/hisi-linux/x86-arm/arm-himix100-linux/host_bin/../target/usr/lib/../../lib/ld-uClibc-0.9.33.2.so /opt/hisi-linux/x86-arm/arm-himix100-linux/host_bin/../target/usr/lib/../../lib/libcrypt-0.9.33.2.so /opt/hisi-linux/x86-arm/arm-himix100-linux/host_bin/../target/usr/lib/../../lib/libdl-0.9.33.2.so /opt/hisi-linux/x86-arm/arm-himix100-linux/host_bin/../target/usr/lib/../../lib/libm-0.9.33.2.so /opt/hisi-linux/x86-arm/arm-himix100-linux/host_bin/../target/usr/lib/../../lib/libnsl-0.9.33.2.so /opt/hisi-linux/x86-arm/arm-himix100-linux/host_bin/../target/usr/lib/../../lib/libpthread-0.9.33.2.so /opt/hisi-linux/x86-arm/arm-himix100-linux/host_bin/../target/usr/lib/../../lib/libresolv-0.9.33.2.so /opt/hisi-linux/x86-arm/arm-himix100-linux/host_bin/../target/usr/lib/../../lib/librt-0.9.33.2.so /opt/hisi-linux/x86-arm/arm-himix100-linux/host_bin/../target/usr/lib/../../lib/libuClibc-0.9.33.2.so /opt/hisi-linux/x86-arm/arm-himix100-linux/host_bin/../target/usr/lib/../../lib/libutil-0.9.33.2.so [cxm@cxm-desktop uClibc-0.9.33.2]$ sudo mkdir -p /opt/hisi-linux/x86-arm/arm-himix100-linux/host_bin/../target/usr/lib/../../lib/bak [cxm@cxm-desktop uClibc-0.9.33.2]$ sudo cp /opt/hisi-linux/x86-arm/arm-himix100-linux/host_bin/../target/usr/lib/../../lib/*9.33.2*so /opt/hisi-linux/x86-arm/arm-himix100-linux/host_bin/../target/usr/lib/../../lib/bak [cxm@cxm-desktop uClibc-0.9.33.2]$ sudo cp ./lib/*9.33.2*so /opt/hisi-linux/x86-arm/arm-himix100-linux/host_bin/../target/usr/lib/../../lib/
arm-himix100-linux-g++ -static-libstdc++ ...
运行
/nfs/h18e3 # ls *9.33.2*so ld-uClibc-0.9.33.2.so libdl-0.9.33.2.so libnsl-0.9.33.2.so libresolv-0.9.33.2.so libuClibc-0.9.33.2.so libcrypt-0.9.33.2.so libm-0.9.33.2.so libpthread-0.9.33.2.so librt-0.9.33.2.so libutil-0.9.33.2.so /nfs/h18e3 # LD_PRELOAD=hook.so ./ld-uClibc-0.9.33.2.so --library-path ./ ./yourapp yourargs 2>&1 | tee log
本网页所有视频内容由 imoviebox边看边下-网页视频下载, iurlBox网页地址收藏管理器 下载并得到。
ImovieBox网页视频下载器 下载地址: ImovieBox网页视频下载器-最新版本下载
本文章由: imapbox邮箱云存储,邮箱网盘,ImageBox 图片批量下载器,网页图片批量下载专家,网页图片批量下载器,获取到文章图片,imoviebox网页视频批量下载器,下载视频内容,为您提供.
阅读和此文章类似的: 全球云计算