交叉编译parted工具

准备

  1. 在编译过程中发现,parted工具依赖于库libuuid。因此第一步是下载libuuid源码,并交叉编译获得目标主机下的libuuid。
    下载地址:libuuid.
  2. 下载parted源码包。
    下载地址:parted.

交叉编译libuuid

笔者libuuid源码包:libuuid-1.0.3.tar.gz
执行下述步骤:

tar -xf libuuid-1.0.3.tar.gz
cd libuuid-1.0.3
./configure --prefix=/prj/xpc/tools/parted/libuuid-1.0.3/libuuid-1.0.3-arm-21dv100/ --host=arm-hisiv500-linux
make
make install

交叉编译parted

parted-3.3版本

笔者下载的源码包:parted-3.3.tar.xz
执行下述步骤:

xz -d parted-3.3.tar.xz
tar -xf parted-3.3.tar
cd parted-3.3
./configure --host=arm-hisiv500-linux --prefix=/prj/xpc/tools/parted/parted-3.3/parted-3.3-arm-21dv100 --disable-device-mapper --without-readline LDFLAGS=-L/prj/xpc/tools/parted/libuuid-1.0.3/libuuid-1.0.3-arm-21dv100/lib/ CFLAGS=-I/prj/xpc/tools/parted/libuuid-1.0.3/libuuid-1.0.3-arm-21dv100/include/
make
make install

出现如下错误:

../libparted/.libs/libparted.so: warning: This version of __fpending returns bytes remaining in buffer for both narrow and wide streams.  glibc's version returns wide chars in buffer for the wide stream case.
../libparted/.libs/libparted.so: undefined reference to `isalnum_l'
../libparted/.libs/libparted.so: undefined reference to `newlocale'
../libparted/.libs/libparted.so: undefined reference to `freelocale'
collect2: error: ld returned 1 exit status
Makefile:1532: recipe for target 'parted' failed
make[4]: *** [parted] Error 1
make[4]: Leaving directory '/prj/xpc/tools/parted/parted-3.3/parted'
Makefile:1678: recipe for target 'install' failed
make[3]: *** [install] Error 2
make[3]: Leaving directory '/prj/xpc/tools/parted/parted-3.3/parted'
Makefile:1568: recipe for target 'install-recursive' failed
make[2]: *** [install-recursive] Error 1
make[2]: Leaving directory '/prj/xpc/tools/parted/parted-3.3'
Makefile:1871: recipe for target 'install' failed
make[1]: *** [install] Error 2
make[1]: Leaving directory '/prj/xpc/tools/parted/parted-3.3'

经过网上查找资料
这是因为uClibc的编译器不支持locale导致。
笔者暂时没有找到更好的解决的办法,只能尝试编译老版本的parted,期待老版本的parted编译时不会使用到locale。

parted-3.1版本

最终试到3.1版本时,发现没有特别的报错。
基本步骤与上述3.3版本一致。
笔者下载的源码包:parted-3.1.tar.xz

xz -kd parted-3.1.tar.xz
tar -xf parted-3.1.tar
cd parted-3.1
./configure --host=arm-hisiv500-linux --prefix=/prj/xpc/tools/parted/parted-3.1/parted-3.1-arm-21dv100 --disable-device-mapper --without-readline LDFLAGS=-L/prj/xpc/tools/parted/libuuid-1.0.3/libuuid-1.0.3-arm-21dv100/lib/ CFLAGS=-I/prj/xpc/tools/parted/libuuid-1.0.3/libuuid-1.0.3-arm-21dv100/include/
make
make install
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值