准备
- 在编译过程中发现,parted工具依赖于库libuuid。因此第一步是下载libuuid源码,并交叉编译获得目标主机下的libuuid。
下载地址:libuuid. - 下载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