FirebirdSQL / php-firebird

Firebird PHP driver
Other
64 stars 17 forks source link

How to compile against OSX Catalina? #6

Open safjanowski opened 4 years ago

safjanowski commented 4 years ago

After long journey with trying to find way how to build interbase.so extension for PHP 7.4.9 I finished with:

CPPFLAGS=-I/Library/Frameworks/Firebird.framework/Versions/Current/Headers LDFLAGS=-L/Library/Frameworks/Firebird.framework/Versions/Current/Libraries ./configure
MartinKoeditz commented 4 years ago

Hi,

it would be great if you can create a short description of how to build the driver with OSX. In that case we can add it to our readme.

Regards Martin

safjanowski commented 4 years ago

It will be little hard to start from clean state, as I tried few options how to solve it and I’ve installed bunch of libraries to solve it.

Generally speaking - standalone Firebird is required to compile extension.

If someone is going to compile it, please shout - I’ll try to help

bonovski commented 3 years ago

I would really appreciate it if anybody who was successful in installing on macos (big sur) could share their steps here. My system is macos 11.2.3 with php 7.4.16 So far I did this:

  1. Installed https://github.com/FirebirdSQL/firebird/releases/download/R2_5_9/FirebirdCS-2.5.9-27139-x86_64.pkg
  2. Cloned this repo to php-firebird
  3. cd php-firebird
  4. phpize
  5. CPPFLAGS=-I/Library/Frameworks/Firebird.framework/Versions/Current/Headers LDFLAGS=-L/Library/Frameworks/Firebird.framework/Versions/Current/Libraries ./configure
  6. make

... and that's where the errors begin:

/Users/bonovski/Sandbox/php-firebird/ibase_query.c:159:24: warning: equality comparison result unused [-Wunused-comparison]
                        ib_result->stmt_res == NULL;
                        ~~~~~~~~~~~~~~~~~~~~^~~~~~~
/Users/bonovski/Sandbox/php-firebird/ibase_query.c:159:24: note: use '=' to turn this equality comparison into an assignment
                        ib_result->stmt_res == NULL;
                                            ^~
                                            =
/Users/bonovski/Sandbox/php-firebird/ibase_query.c:178:22: warning: equality comparison result unused [-Wunused-comparison]
                ib_query->stmt_res == NULL;
                ~~~~~~~~~~~~~~~~~~~^~~~~~~
/Users/bonovski/Sandbox/php-firebird/ibase_query.c:178:22: note: use '=' to turn this equality comparison into an assignment
                ib_query->stmt_res == NULL;
                                   ^~
                                   =
/Users/bonovski/Sandbox/php-firebird/ibase_query.c:253:22: error: use of undeclared identifier 'blr_bool'
                case blr_bool:
                     ^
/Users/bonovskiSandbox/php-firebird/ibase_query.c:254:34: error: use of undeclared identifier 'SQL_BOOLEAN'
                    a->el_type = SQL_BOOLEAN;
                                 ^
/Users/bonovski/Sandbox/php-firebird/ibase_query.c:598:22: error: use of undeclared identifier 'SQL_BOOLEAN'
                case SQL_BOOLEAN:
                     ^
/Users/bonovski/Sandbox/php-firebird/ibase_query.c:724:25: warning: incompatible pointer types passing 'zend_long *' (aka 'long long *') to parameter of type 'const time_t *' (aka 'const long *')
      [-Wincompatible-pointer-types]
                                        res = php_gmtime_r(&Z_LVAL_P(b_var), &t);
                                                           ^~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/time.h:127:46: note: passing argument to parameter here
struct tm *gmtime_r(const time_t * __restrict, struct tm * __restrict);
                                             ^
/Users/bonovski/Sandbox/php-firebird/ibase_query.c:790:18: error: use of undeclared identifier 'SQL_BOOLEAN'
            case SQL_BOOLEAN:
                 ^
/Users/bonovski/Sandbox/php-firebird/ibase_query.c:795:32: error: use of undeclared identifier 'SQL_BOOLEAN'
                var->sqltype = SQL_BOOLEAN;
                               ^
/Users/bonovski/Sandbox/php-firebird/ibase_query.c:883:18: error: use of undeclared identifier 'SQL_BOOLEAN'
            case SQL_BOOLEAN:
                 ^
/Users/bonovski/Sandbox/php-firebird/ibase_query.c:1386:14: error: use of undeclared identifier 'SQL_BOOLEAN'
        case SQL_BOOLEAN:
             ^
/Users/bonovski/Sandbox/php-firebird/ibase_query.c:1985:18: error: use of undeclared identifier 'SQL_BOOLEAN'
            case SQL_BOOLEAN:
                 ^
/Users/bonovski/Sandbox/php-firebird/ibase_query.c:2012:18: error: use of undeclared identifier 'SQL_BOOLEAN'
            case SQL_BOOLEAN:
                 ^
3 warnings and 9 errors generated.
make: *** [ibase_query.lo] Error 1
mrotteveel commented 3 years ago

@bonovski Not an expert on the Firebird-PHP code, but the _"error: use of undeclared identifier 'SQLBOOLEAN'" and _"error: use of undeclared identifier 'blrbool'" is due to using the Firebird 2.5 headers to compile instead of the Firebird 3 headers (ibase.h).

bonovski commented 3 years ago

Thank you for the suggestion, I tried to compile with firebird v3 but get similar errors.

bonovski commented 3 years ago

With a little help from @mrotteveel and stackoverflow I managed to compile the driver on BigSur. The above steps are correct but firebird3.x has to be used and make sure that if firebird2.x was installed that it is completely removed before the installation of firebird3.x by using a script like this. https://gist.github.com/billsinc/1157544

the-Arioch commented 2 years ago

For reference, it was https://stackoverflow.com/questions/67614393/