gpt4 book ai didi

c - 在为 android 交叉编译 util-linux 库时出现错误

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:18:37 26 4
gpt4 key购买 nike

我正在使用 arm-linux-androideabi 为 android 交叉编译 util-linux 库。

我创建了工具链并执行配置语句 ./configure --prefix=/opt/android --build=${BUILD} --host=arm-linux-androideabi --disable-rpath --without-util --without-ncursesw --without-ncurses --没有信息

在做 make 之后我得到以下错误。

/u/CC/android-ndk-toolchain/sysroot/usr/include/fcntl.h:49:13: warning: redundant redeclaration of 'fcntl' [-Wredundant-decls]
In file included from libblkid/src/topology/sysfs.c:17:0:
/u/CC/android-ndk-toolchain/sysroot/usr/include/unistd.h:143:12: note: previous declaration of 'fcntl' was here
In file included from ./include/blkdev.h:11:0,
from ./libblkid/src/blkidP.h:34,
from libblkid/src/topology/topology.h:4,
from libblkid/src/topology/sysfs.c:21:
/u/CC/android-ndk-toolchain/sysroot/usr/include/sys/ioctl.h:39:12: warning: redundant redeclaration of 'ioctl' [-Wredundant-decls]
In file included from libblkid/src/topology/sysfs.c:17:0:
/u/CC/android-ndk-toolchain/sysroot/usr/include/unistd.h:144:12: note: previous declaration of 'ioctl' was here
CCLD libblkid.la
/usr/lib/gcc/arm-linux-androideabi/4.7.4/../../../../arm-linux-androideabi/bin/ld: error: libblkid/src/.libs/libblkid_la-config.o: multiple definition of 'l'
/usr/lib/gcc/arm-linux-androideabi/4.7.4/../../../../arm-linux-androideabi/bin/ld: libblkid/src/.libs/libblkid_la-cache.o: previous definition here
/usr/lib/gcc/arm-linux-androideabi/4.7.4/../../../../arm-linux-androideabi/bin/ld: error: libblkid/src/.libs/libblkid_la-evaluate.o: multiple definition of 'l'
/usr/lib/gcc/arm-linux-androideabi/4.7.4/../../../../arm-linux-androideabi/bin/ld: libblkid/src/.libs/libblkid_la-cache.o: previous definition here
/usr/lib/gcc/arm-linux-androideabi/4.7.4/../../../../arm-linux-androideabi/bin/ld: error: libblkid/src/.libs/libblkid_la-save.o: multiple definition of 'l'
/usr/lib/gcc/arm-linux-androideabi/4.7.4/../../../../arm-linux-androideabi/bin/ld: libblkid/src/.libs/libblkid_la-cache.o: previous definition here
/usr/lib/gcc/arm-linux-androideabi/4.7.4/../../../../arm-linux-androideabi/bin/ld: error: ./.libs/libcommon.a(libcommon_la-blkdev.o): multiple definition of 'l'
/usr/lib/gcc/arm-linux-androideabi/4.7.4/../../../../arm-linux-androideabi/bin/ld: libblkid/src/.libs/libblkid_la-cache.o: previous definition here
/usr/lib/gcc/arm-linux-androideabi/4.7.4/../../../../arm-linux-androideabi/bin/ld: error: ./.libs/libcommon.a(libcommon_la-env.o): multiple definition of 'l'
/usr/lib/gcc/arm-linux-androideabi/4.7.4/../../../../arm-linux-androideabi/bin/ld: libblkid/src/.libs/libblkid_la-cache.o: previous definition here
/usr/lib/gcc/arm-linux-androideabi/4.7.4/../../../../arm-linux-androideabi/bin/ld: error: ./.libs/libcommon.a(libcommon_la-pager.o): multiple definition of 'l'
/usr/lib/gcc/arm-linux-androideabi/4.7.4/../../../../arm-linux-androideabi/bin/ld: libblkid/src/.libs/libblkid_la-cache.o: previous definition here
/usr/lib/gcc/arm-linux-androideabi/4.7.4/../../../../arm-linux-androideabi/bin/ld: error: ./.libs/libcommon.a(libcommon_la-parse-date.o): multiple definition of 'l'
/usr/lib/gcc/arm-linux-androideabi/4.7.4/../../../../arm-linux-androideabi/bin/ld: libblkid/src/.libs/libblkid_la-cache.o: previous definition here
/usr/lib/gcc/arm-linux-androideabi/4.7.4/../../../../arm-linux-androideabi/bin/ld: error: ./.libs/libcommon.a(libcommon_la-path.o): multiple definition of 'l'
/usr/lib/gcc/arm-linux-androideabi/4.7.4/../../../../arm-linux-androideabi/bin/ld: libblkid/src/.libs/libblkid_la-cache.o: previous definition here
/usr/lib/gcc/arm-linux-androideabi/4.7.4/../../../../arm-linux-androideabi/bin/ld: error: ./.libs/libcommon.a(libcommon_la-randutils.o): multiple definition of 'l'
/usr/lib/gcc/arm-linux-androideabi/4.7.4/../../../../arm-linux-androideabi/bin/ld: libblkid/src/.libs/libblkid_la-cache.o: previous definition here
/usr/lib/gcc/arm-linux-androideabi/4.7.4/../../../../arm-linux-androideabi/bin/ld: error: ./.libs/libcommon.a(libcommon_la-strutils.o): multiple definition of 'l'
/usr/lib/gcc/arm-linux-androideabi/4.7.4/../../../../arm-linux-androideabi/bin/ld: libblkid/src/.libs/libblkid_la-cache.o: previous definition here
/usr/lib/gcc/arm-linux-androideabi/4.7.4/../../../../arm-linux-androideabi/bin/ld: error: ./.libs/libcommon.a(libcommon_la-timeutils.o): multiple definition of 'l'
/usr/lib/gcc/arm-linux-androideabi/4.7.4/../../../../arm-linux-androideabi/bin/ld: libblkid/src/.libs/libblkid_la-cache.o: previous definition here
/usr/lib/gcc/arm-linux-androideabi/4.7.4/../../../../arm-linux-androideabi/bin/ld: error: ./.libs/libcommon.a(libcommon_la-ttyutils.o): multiple definition of '_POSIX_VDISABLE'
/usr/lib/gcc/arm-linux-androideabi/4.7.4/../../../../arm-linux-androideabi/bin/ld: ./.libs/libcommon.a(libcommon_la-pager.o): previous definition here
/usr/lib/gcc/arm-linux-androideabi/4.7.4/../../../../arm-linux-androideabi/bin/ld: error: ./.libs/libcommon.a(libcommon_la-exec_shell.o): multiple definition of 'l'
/usr/lib/gcc/arm-linux-androideabi/4.7.4/../../../../arm-linux-androideabi/bin/ld: libblkid/src/.libs/libblkid_la-cache.o: previous definition here
/usr/lib/gcc/arm-linux-androideabi/4.7.4/../../../../arm-linux-androideabi/bin/ld: error: ./.libs/libcommon.a(libcommon_la-plymouth-ctrl.o): multiple definition of 'l'
/usr/lib/gcc/arm-linux-androideabi/4.7.4/../../../../arm-linux-androideabi/bin/ld: libblkid/src/.libs/libblkid_la-cache.o: previous definition here
/usr/lib/gcc/arm-linux-androideabi/4.7.4/../../../../arm-linux-androideabi/bin/ld: error: ./.libs/libcommon.a(libcommon_la-langinfo.o): multiple definition of 'l'
/usr/lib/gcc/arm-linux-androideabi/4.7.4/../../../../arm-linux-androideabi/bin/ld: libblkid/src/.libs/libblkid_la-cache.o: previous definition here
collect2: error: ld returned 1 exit status
Makefile:5414: recipe for target 'libblkid.la' failed
make[2]: *** [libblkid.la] Error 1
make[2]: Leaving directory '/u/CC/util-linux-2.31'
Makefile:11990: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/u/CC/util-linux-2.31'
Makefile:5002: recipe for target 'all' failed
make: *** [all] Error 2

请帮我解决这个问题。提前致谢。

最佳答案

关于重新声明的第一个警告是由于损坏的 NDK header 。在“统一 header ”之前,他们盲目地声明 fcntl() , ioctl() (也许还有更多)直接来自 <fcntl.h><unistd.h>没有检查它们是否已经声明。统一 header 以正确的方式执行此操作,并且自 NDK r14 起可用,请参阅 here .

关于第二个问题 - 你可能有一个叫做 l 的东西和 _POSIX_VDISABLE意外定义为全局变量或函数。看起来像构建脚本中的一些问题。很高兴看到实际的编译器/链接器命令。

关于c - 在为 android 交叉编译 util-linux 库时出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47217049/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com