Uploaded image for project: 'PHP Driver: Extension'
  1. PHP Driver: Extension
  2. PHPC-238

Windows + PHP 5.4 build failure (inet_pton & inet_inet_ntop)

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 0.3.1
    • Component/s: None
    • Labels:
      None

      "cl.exe" /Iext\mongodb /Iext\mongodb/src/libmongoc/src/mongoc /Iext\mongodb/src/libbson/src/bson/ /Iext\mongodb/src/libbson/src  /D HAVE_MONGODB_SASL=1 /D BSON_COMPILATION=1 /D MONGOC_COMPILATION=1 /D MONGOC_TRACE=1 /D MONGOC_NO_AUTOMATIC_GLOBALS=1 /D BSON_EXTRA_ALIGN=0 /D COMPILE_DL_MONGODB /D MONGODB_EXPORTS=1 /nologo /FD /I . /I main /I Zend /I TSRM /I ext /D _WINDOWS /D ZEND_WIN32=1 /D PHP_WIN32=1 /D WIN32 /D _MBCS /W3   /wd4996 /D_USE_32BIT_TIME_T=1   /MP  /Zi /LD /MD /W3 /Ox /D NDebug /D NDEBUG /D ZEND_WIN32_FORCE_INLINE /GF /D ZEND_DEBUG=0 /I "C:\php-sdk\php54\vc9\x86\deps\include"  /D FD_SETSIZE=256 /FoC:\obj\5.4-nts-windows-vc9-x86\Release\ext\mongodb\ /FdC:\obj\5.4-nts-windows-vc9-x86\Release\ext\mongodb\ /FpC:\obj\5.4-nts-windows-vc9-x86\Release\ext\mongodb\ /FRC:\obj\5.4-nts-windows-vc9-x86\Release\ext\mongodb\ /c ext\mongodb\php_phongo.c
      php_phongo.c
      C:\php-sdk\php54\vc9\x86\php-5.4.37-src\win32/inet.h(7) : error C2373: 'inet_pton' : redefinition; different type modifiers
              C:\Program Files\Microsoft SDKs\Windows\v6.1\include\ws2tcpip.h(579) : see declaration of 'inet_pton'
      C:\php-sdk\php54\vc9\x86\php-5.4.37-src\win32/inet.h(8) : error C2373: 'inet_ntop' : redefinition; different type modifiers
              C:\Program Files\Microsoft SDKs\Windows\v6.1\include\ws2tcpip.h(595) : see declaration of 'inet_ntop'
      ext\mongodb\php_phongo.c(1414) : warning C4244: '=' : conversion from 'int64_t' to 'double', possible loss of data
      NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe"' : return code '0x2'
      

      PHP provides its own compatibility function for these in PHP5.3 and PHP5.4:

      (included from main/php_network.h):
      <win32/inet.h>

      #if _MSC_VER >= 1500
      # include <In6addr.h>
      #endif
      #include <Ws2tcpip.h>
      
      #if (_WIN32_WINNT < 0x0600)
      PHPAPI int inet_pton(int af, const char* src, void* dst);
      PHPAPI const char* inet_ntop(int af, const void* src, char* dst, size_t size);
      PHPAPI int inet_aton(const char *cp, struct in_addr *inp);
      #endif
      

      Which conflicts with ws2tcpip.h:
      mongoc/mongoc-socket.h:

      #ifdef _WIN32
      # include <winsock2.h>
      # include <ws2tcpip.h>
      #else
      ...
      #endif
      

            Assignee:
            jmikola@mongodb.com Jeremy Mikola
            Reporter:
            bjori Hannes Magnusson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: