2011年3月24日 星期四

uClibc 0.9.31 testsuite - error: dereferencing pointer to incomplete type

While building uClibc 0.9.31 testsuite with buildroot-2010.05, enabling BR2_UCLIBC_INSTALL_TEST_SUITE, I encountered following error:

locale/tst-xlocale2.c

static int
do_test (locale_t l)
{
int result = 0;
size_t n;

#define DO_TEST(TEST, RES) \
for (n = 0; n < sizeof (str) - 1; ++n) \
if ('0' + (TEST (str[n], l) != 0) != RES[n]) \
{ \
printf ("%s(%c) failed\n", #TEST, str[n]); \
result = 1; \
}

DO_TEST (isdigit_l, exd);
DO_TEST (isalpha_l, exa);
DO_TEST (isxdigit_l, exx);

return result;
}


Will result in:
error: dereferencing pointer to incomplete type


change TEST (str[n], l) to TEST (str[n], &l) result in:
error: request for member '__ctype_b' in something not a structure or union



usr/include/ctype.h
# define __isctype_l(c, type, locale) ((locale)->__ctype_b[(int) (c)] & (__ctype_mask_t) type)
# define __isalnum_l(c,l) __isctype_l((c), _ISalnum, (l))
# define __isalpha_l(c,l) __isctype_l((c), _ISalpha, (l))
# define __iscntrl_l(c,l) __isctype_l((c), _IScntrl, (l))
# define __isdigit_l(c,l) __isctype_l((c), _ISdigit, (l))
# define __islower_l(c,l) __isctype_l((c), _ISlower, (l))
# define __isgraph_l(c,l) __isctype_l((c), _ISgraph, (l))
# define __isprint_l(c,l) __isctype_l((c), _ISprint, (l))
# define __ispunct_l(c,l) __isctype_l((c), _ISpunct, (l))
# define __isspace_l(c,l) __isctype_l((c), _ISspace, (l))
# define __isupper_l(c,l) __isctype_l((c), _ISupper, (l))
# define __isxdigit_l(c,l) __isctype_l((c), _ISxdigit, (l))
# define __isblank_l(c,l) __isctype_l((c), _ISblank, (l))

# if (defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN) \
&& defined __UCLIBC_SUSV4_LEGACY__
# define __isascii_l(c,l) ((l), __isascii (c))
# define __toascii_l(c,l) ((l), __toascii (c))
# endif

# define isalnum_l(c,l) __isalnum_l ((c), (l))
# define isalpha_l(c,l) __isalpha_l ((c), (l))
# define iscntrl_l(c,l) __iscntrl_l ((c), (l))
# define isdigit_l(c,l) __isdigit_l ((c), (l))
# define islower_l(c,l) __islower_l ((c), (l))
# define isgraph_l(c,l) __isgraph_l ((c), (l))
# define isprint_l(c,l) __isprint_l ((c), (l))
# define ispunct_l(c,l) __ispunct_l ((c), (l))
# define isspace_l(c,l) __isspace_l ((c), (l))
# define isupper_l(c,l) __isupper_l ((c), (l))
# define isxdigit_l(c,l) __isxdigit_l ((c), (l))
# define isblank_l(c,l) __isblank_l ((c), (l))



Original error message:
/usr/bin/make -j9 -C /buildroot-2010.05/buildroot-2010.05/output/toolchain/uClibc-0.9.31/test \
ARCH_CFLAGS=-I/arm-linux-le-uclibc-gcc-4.3.3-2010.05/usr/include \
UCLIBC_ONLY=1 TEST_INSTALLED_UCLIBC=1 compile -j1

(.....)

make[2]: Entering directory `/buildroot-2010.05/buildroot-2010.05/output/toolchain/uClibc-0.9.31/test/locale'
/arm-linux-le-uclibc-gcc-4.3.3-2010.05/usr/bin/arm-unknown-linux-uclibcgnueabi-gcc -nostdinc -I../../install_dir/usr/include -I../../test -D_GNU_SOURCE -I/buildroot-2010.05/buildroot-2010.05/output/toolchain/linux/include/ -isystem /arm-linux-le-uclibc-gcc-4.3.3-2010.05/usr/lib/gcc/arm-unknown-linux-uclibcgnueabi/4.3.3/include-fixed -isystem /arm-linux-le-uclibc-gcc-4.3.3-2010.05/usr/lib/gcc/arm-unknown-linux-uclibcgnueabi/4.3.3/include -Os -funit-at-a-time -fmerge-all-constants -fno-tree-loop-optimize -fno-tree-dominator-opts -fno-strength-reduce -fstrict-aliasing -funsigned-char -fno-builtin -fno-asm -std=gnu99 -mlittle-endian -mtune=arm1136jf-s -march=armv6 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wstrict-prototypes -D__USE_GNU -fno-builtin -c tst-xlocale2.c -o tst-xlocale2.o
tst-xlocale2.c: In function 'do_test':
tst-xlocale2.c:59: error: dereferencing pointer to incomplete type
tst-xlocale2.c:60: error: dereferencing pointer to incomplete type
tst-xlocale2.c:61: error: dereferencing pointer to incomplete type
make[2]: *** [tst-xlocale2] Error 1
make[2]: Leaving directory `/buildroot-2010.05/buildroot-2010.05/output/toolchain/uClibc-0.9.31/test/locale'
make[1]: *** [_dircompile_locale] Error 2
make[1]: Leaving directory `/buildroot-2010.05/buildroot-2010.05/output/toolchain/uClibc-0.9.31/test'
make: *** [/buildroot-2010.05/buildroot-2010.05/output/toolchain/uClibc-0.9.31/test/unistd/errno] Error 2

1 則留言:

Doha 提到...

I'm facing the same error , did you find a solution?