Android NDK error in strings.h, possibly due to error in size_t

本文记录了在使用Android NDK编译X11时遇到的问题及解决方案,特别是strings.h文件中的错误和AuDispose.c中memset函数调用的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

http://stackoverflow.com/questions/8564050/android-ndk-error-in-strings-h-possibly-due-to-error-in-size-t/9555542#9555542

I manageed to finish the make by commenting the lines in strings.h that showed error. Also I used memset in AuDispose.c instead of bzero.

here's the problem:

I'm having problems with building X11 for Android using the NDK. I'm using the latest NDK with droid-wrapper. I've updateddroid-wrapperto work with most of the things I'm building, but it really just adds a bunch of compiler options. I have it print out what options it's using below. I've gotten pretty far, but I am running into this problem building some of the libraries:

CC   AuDispose.lo
droid-debug(compile): /opt/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc -DHAVE_CONFIG_H -I. -I./include -I/home/rmason/androix/usr/include -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -fno-strict-aliasing -Wbad-function-cast -Wformat=2 -Wold-style-definition -Wdeclaration-after-statement -I/home/rmason/androix/usr/include -MT AuDispose.lo -MD -MP -MF .deps/AuDispose.Tpo -c AuDispose.c -fPIC -DPIC -o .libs/AuDispose.o -I/opt/android-ndk-r7/platforms/android-8/arch-arm/usr/include -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -DANDROID -DSK_RELEASE -DNDEBUG -UDEBUG -march=armv5te -mtune=xscale -msoft-float -mthumb-interwork -fpic -fno-exceptions -ffunction-sections -funwind-tables -fstack-protector -fmessage-length=0
In file included from /opt/android-ndk-r7/platforms/android-8/arch-arm/usr/include/stdlib.h:42,
      from AuDispose.c:34:
/opt/android-ndk-r7/platforms/android-8/arch-arm/usr/include/strings.h:47: error: expected declaration specifiers or '...' before numeric constant
/opt/android-ndk-r7/platforms/android-8/arch-arm/usr/include/strings.h:47: error:   conflicting types for 'memset'
AuDispose.c: In function 'XauDisposeAuth':
AuDispose.c:44: error: too many arguments to function 'memset'
make[1]: *** [AuDispose.lo] Error 1
make[1]: Leaving directory `/home/rmason/androix/lib/libXau'
make: *** [install] Error 2

I look at strings.h and line 47 is this:

void   bzero(void *, size_t);

I've seen other people having trouble with this type of line because size_t is the wrong value. Some have fixed it by replacing size_t with the kernel's definition. My guess is that the order in which I'm including things is clobbering some definition that I really need.

Here's a little background if people like the whole story:

I'm trying to buildAndroixusing a slightly modified droid-wrapper]. I made a script (in my github repo as androix-buildscript) to build the whole shebang. It checks everything out and builds everything. Right now I'm having the following results:

  • Success: util/macros
  • Success: proto/xproto
  • Success: lib/libxtrans
  • Success: xcb/proto
  • Success: xcb/pthread-stubs
  • Failure: lib/libXau # strings.h error
  • Failure: xcb/libxcb # missing Xau
  • Success: proto/xextproto
  • Success: proto/kbproto
  • Success: proto/inputproto
  • Failure: lib/libX11 # missing libxcb
  • Failure: lib/libxkbfile # missing X11
  • Failure: app/xkbcomp # ./xkbparse.c... configure: error: cannot check for file existence when cross compiling make:*No rule to make target `install'. Stop.
  • Success: xkeyboard-config
  • Success: mesa/drm
  • Success: proto/fixesproto
  • Success: proto/damageproto
  • Success: proto/xcmiscproto
  • Success: proto/bigreqsproto
  • Success: proto/compositeproto
  • Success: proto/recordproto
  • Success: proto/scrnsaverproto
  • Success: proto/resourceproto
  • Failure: freetype # still working on figuring out what the best way of building this would be, TODO
  • Success: lib/libfontenc
  • Failure: lib/libXfont # missing fontsproto, TODO
  • Failure: lib/libXdmcp # similar problem to strings.h libXau problem
  • Failure: pixman # different looking problem with 'Elf32_auxv_t', but may be the same as the strings.h problem with size_t. They are both DEFINE oriented problems.

Thanks for taking the time to check this out. I'm really stumped.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值