编译jffs2报struct addrinfo storage size isn't known错误

make[2]: Entering directory `/hisdk/Hi3536_SDK_V2.0.6.0/osdrv/tools/pc/jffs2_tool/tmp/mtd-utils-1.5.0'
  CHK     include/version.h
  CC      serve_image.o
serve_image.c: In function ‘main’:
serve_image.c:32:18: error: storage size of ‘hints’ isn’t known
  struct addrinfo hints;
                  ^
serve_image.c:94:19: error: ‘AI_ADDRCONFIG’ undeclared (first use in this function)
  hints.ai_flags = AI_ADDRCONFIG;
                   ^
serve_image.c:94:19: note: each undeclared identifier is reported only once for each function it appears in
serve_image.c:97:8: warning: implicit declaration of function ‘getaddrinfo’ [-Wimplicit-function-declaration]
  ret = getaddrinfo(argv[1], argv[2], &hints, &ai);
        ^
serve_image.c:99:40: warning: implicit declaration of function ‘gai_strerror’ [-Wimplicit-function-declaration]
   fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(ret));
                                        ^
serve_image.c:103:35: error: dereferencing pointer to incomplete type ‘struct addrinfo’
  for (runp = ai; runp; runp = runp->ai_next) {
                                   ^
make[2]: *** [/hisdk/Hi3536_SDK_V2.0.6.0/osdrv/tools/pc/jffs2_tool/tmp/mtd-utils-1.5.0/serve_image.o] Error 1
make[2]: Leaving directory `/hisdk/Hi3536_SDK_V2.0.6.0/osdrv/tools/pc/jffs2_tool/tmp/mtd-utils-1.5.0'
make[1]: *** [/hisdk/Hi3536_SDK_V2.0.6.0/osdrv/tools/pc/jffs2_tool/tmp/sbin/mkfs.jffs2] Error 2
make[1]: Leaving directory `/hisdk/Hi3536_SDK_V2.0.6.0/osdrv/tools/pc/jffs2_tool'

新版本系统头文件哟更新:

/* Extension from POSIX.1:2001.  */
#ifdef __USE_XOPEN2K
/* Structure to contain information about address of a service provider.  */
struct addrinfo
{
  int ai_flags;			/* Input flags.  */
  int ai_family;		/* Protocol family for socket.  */
  int ai_socktype;		/* Socket type.  */
  int ai_protocol;		/* Protocol for socket.  */
  socklen_t ai_addrlen;		/* Length of socket address.  */
  struct sockaddr *ai_addr;	/* Socket address for socket.  */
  char *ai_canonname;		/* Canonical name for service location.  */
  struct addrinfo *ai_next;	/* Pointer to next in list.  */
};
添加了__USE_XOPEN2K,去掉该宏限制即可。
阅读更多
个人分类: linux,嵌入式
上一篇查看arm linux是硬浮点还是软浮点的方法
下一篇libxfce4ui编译过程
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭