0

I've been trying to install/compile the php-firebird driver for php7.4 on macos but so far wasn't successful.

There is an issue open in the driver repo, but not much going on in terms of help. https://github.com/FirebirdSQL/php-firebird/issues/6

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 (also tried with firebird 3.x)
  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
Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Bonovski
  • 35
  • 1
  • 7
  • 2
    As I remarked earlier on that issue, you need to compile using the Firebird 3 or later headers. The headers of Firebird 2.5 don't have `blr_bool` and `SQL_BOOLEAN` defined. Please try with Firebird 3, and show the result when you're compiling with that version. – Mark Rotteveel May 20 '21 at 09:45
  • 1
    when i open on my computer the "c:\Program Files (x86)\Firebird\Firebird_2_1\include\ibase.h" file it says as its 3rd non-comment line the following: `#define FB_API_VER 21` - so you say `/Library/Frameworks/Firebird.framework/Versions/Current/Headers` - and what the version does `ibase.h` quote there ??? i think after you installed FB 2.5 the `Versions/Current` was created as symlink to 2.5 sources. If you did install 3.0 sources - then check where the `Versions/Current` symlink points to and if needed change it to 3.0 sources (`ln -s` on Linux, guess the same on your BSD command line utils) – Arioch 'The May 20 '21 at 10:24
  • @Arioch'The That was the trick, seems that I haven't removed v2.5 completely before installing v3. After that the compile was successful. Thanks to both. – Bonovski May 20 '21 at 15:22

1 Answers1

3

Errors about Boolean datatype - introduced in Firebird 3.0 - clearly show that your PHP library expects Firebird 3+, but you give it sources of FB 2.5 or earlier.

CPPFLAGS=-I/Library/Frameworks/Firebird.framework/Versions/Current/Headers 
LDFLAGS=-L/Library/Frameworks/Firebird.framework/Versions/Current/Libraries 

I think after you installed FB 2.5 the Versions/Current that you mention was created as symlink to 2.5 sources. If you did install 3.0 sources - then check where the Versions/Current symlink points to and if needed change it to 3.0 sources (ln -s on Linux, guess the same on your BSD command line utils)

Quick check probably would be opening ibase.h in that location and checking API version declaration: on my Windows box right now the 3rd non-comment line is the following: #define FB_API_VER 21 within that file in a folder with Firebird 2.1.7 installed.

Alternatively adjust CPPFLAGS and LDFLAGS and maybe other variables to point at the specific 3.x version sources, rather than some vague "default" or "current".

This flags tweaking of course only makes sense in the case that you need FB 2.5 sources installed as "current" one for some other purposes along the FB 3 sources. I dunno about UNIX-likes, but at least on Windows it is trivial and sometimes handy to have several Firebird servers installed/running of different or even of the same version. It might happen to be the case for some future readers as well.

Arioch 'The
  • 15,799
  • 35
  • 62