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

时间:2021-09-28 15:28:05

http://*.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 updated droid-wrapper to 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 build Androix using 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.