PHP extension not compiling under FreeBSD
-----------------------------------------

                 Key: THRIFT-954
                 URL: https://issues.apache.org/jira/browse/THRIFT-954
             Project: Thrift
          Issue Type: Bug
          Components: PHP - Library
    Affects Versions: 0.5, 0.4
         Environment: FreeBSD 7.2-RELEASE amd64
            Reporter: Mike Nadeau
            Priority: Minor
             Fix For: 0.6, 0.7, 0.5


When trying to compile the Thrift 0.4 / 0.5 PHP extension under FreeBSD 
7.2-RELEASE amd64, I faced these errors when running 'make' : 

php_thrift_protocol.cpp:27:20: error: endian.h: No such file or directory
php_thrift_protocol.cpp:28:22: error: byteswap.h: No such file or directory
php_thrift_protocol.cpp:466: error: 'bswap_64' was not declared in this scope
php_thrift_protocol.cpp:474: error: 'bswap_64' was not declared in this scope

Here's the changes that allowed me to successfully compile it :

php_thrift_protocol.cpp:

#include <sys/types.h>
#include <netinet/in.h>
#include <unistd.h>
#include <sys/endian.h> // <-- was endian.h
// #include <byteswap.h> // <-- doesn't exist under FreeBSD
#include <stdexcept>

#if __BYTE_ORDER == __LITTLE_ENDIAN
#define htonll(x) bswap64(x) // <-- was bswap_64
#define ntohll(x) bswap64(x) // <-- was bswap_64
#else
#define htonll(x) x
#define ntohll(x) x
#endif

The lines that changed are the ones marked with "<--".

Please let me know if there's a better way to achieve this.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to