程序员人生 网站导航

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

栏目:互联网时间:2014-11-10 08:46:00

编译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⑴.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;

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

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

 

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

 

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

 

 

 

还有这个:

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


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

 

------分隔线----------------------------
------分隔线----------------------------

最新技术推荐