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


    编译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

     

     

     

    还有这个:

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


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

     

  • 相关阅读:
    List of all Oracle Server Parameters
    dbcc Trace
    站在巨人的肩膀上 书籍推荐 (zz)
    浅谈JS包装对象
    与 JavaScript 模块相关的所有知识点
    你真的懂Promise吗
    vue动态绑定class与style总结
    vue使用axios实现excel文件下载的实现
    CSRF 与 XSS
    推荐10个很棒的 JS 库
  • 原文地址:https://www.cnblogs.com/yjbjingcha/p/6849570.html
Copyright © 2020-2023  润新知