码迷,mamicode.com
首页 > 其他好文 > 详细

ushare编译之 ‘struct sockaddr_storage’ has no member named ‘s_addr’

时间:2014-10-31 01:13:10      阅读:419      评论:0      收藏:0      [点我收藏+]

标签:sockaddr_storage   ushare   libupnp1.6.19   

编译ushare的时候出现‘struct sockaddr_storage’ has no member named ‘s_addr’

这是使用libupnp1.6.19出现版本不兼容的错误。

解决方法:libupnp换成1.4.2版本


配置:

----------------------------------------------------------------------------------------------------

$ ./configure

Checking forcompiler available...

Checking for locales...

Checking for ifaddrs...

Checking forlanginfo ...

Checking for iconv...

Checking for libixml...

Checking forlibthreadutil ...

Checkingfor libupnp >= 1.4.2 ...

 

uShare: configure isOK

  version            1.1a

  using libupnp      1.6.19

configuration:

  install prefix     /usr/local

  configuration dir  ${PREFIX}/etc

  locales dir        ${PREFIX}/share/locale

  NLS support        yes

  DLNA support       no

  C compiler         gcc

  STRIP              strip

  make               make

  CPU                x86 ()

  debug symbols      no

  strip symbols      yes

  optimize           yes

 

 CFLAGS              -I.. -W -Wall -D_LARGEFILE_SOURCE-D_FILE_OFFSET_BITS=64 -D_REENTRANT -D_GNU_SOURCE -O3 -DHAVE_LOCALE_H-DHAVE_SETLOCALE -DHAVE_IFADDRS_H -DHAVE_LANGINFO_H -DHAVE_LANGINFO_CODESET-DHAVE_ICONV -pthread -I/usr/local/include/upnp

  LDFLAGS

  extralibs           -lixml -lthreadutil -lpthread -lupnp-pthread -L/usr/local/lib

 

Creating config.mak...

Creating config.h...

-------------------------------------------------------------------------------------------------


 需要开启DLNA支持的话,使用:

$./configure --enablle-dlna

 

编译:

$make

----------------------------------------------------------------------------

ushare.c: Infunction ‘handle_action_request’:

ushare.c:191:29:error: ‘struct sockaddr_storage’ has no member named ‘s_addr

make[1]: ***[ushare.o] Error 1

make[1]: Leavingdirectory `/home/won/Downloads/ushare-1.1a/src‘

make: *** [all]Error 2

---------------------------------------------------------------------------

 

查看ushare.c文件对应内容:

…/src/ushare.c

-----------------------------------------------------------------------------------------------------------------------

191   ip = request->CtrlPtIPAddr.s_addr;

192   ip = ntohl (ip);

193   sprintf (val, "%d.%d.%d.%d",

194            (ip >> 24) & 0xFF, (ip>> 16) & 0xFF, (ip >> 8) & 0xFF, ip & 0xFF);

-----------------------------------------------------------------------------------------------------------------------

 


看看struct sockaddr_storage的定义在哪个头文件

-------------------------------------------------------------------------

$ grep -rn"struct sockaddr_storage" /usr/local/include/

/usr/local/include/upnp/upnp.h:632:  struct sockaddr_storage CtrlPtIPAddr;

/usr/local/include/upnp/upnp.h:679:  struct sockaddr_storage CtrlPtIPAddr;

/usr/local/include/upnp/upnp.h:759:     struct sockaddr_storage DestAddr;

-------------------------------------------------------------------------

这里看到的都不是它的定义

 

找了很久还是没有发现它的定义,翻墙google一下:

 

http://askubuntu.com/questions/224154/help-with-error-struct-sockaddr-storage-has-no-member-named-s-addr

 bubuko.com,布布扣

 bubuko.com,布布扣

 

还有这个:

http://ubuntu.aspcode.net/view/635400140124705175347694/help-with-error-struct-sockaddrstorage-has-no-member-named-saddr

bubuko.com,布布扣

 还是乖乖把libupnp换成1.4.2版本吧。。。

 

ushare编译之 ‘struct sockaddr_storage’ has no member named ‘s_addr’

标签:sockaddr_storage   ushare   libupnp1.6.19   

原文地址:http://blog.csdn.net/wonxxx/article/details/40637911

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!