【问题标题】:Issues compiling firebird driver for PHP-7.4 on macos在 macos 上为 PHP-7.4 编译 firebird 驱动程序的问题
【发布时间】:2021-08-09 08:30:12
【问题描述】:

我一直在尝试在 macos 上安装/编译 php7.4 的 php-firebird 驱动程序,但到目前为止还没有成功。

驱动程序存储库中存在一个问题,但在帮助方面没有太多进展。 https://github.com/FirebirdSQL/php-firebird/issues/6

到目前为止,我是这样做的:

  1. 已安装 https://github.com/FirebirdSQL/firebird/releases/download/R2_5_9/FirebirdCS-2.5.9-27139-x86_64.pkg(也尝试使用 firebird 3.x)
  2. 将此仓库克隆到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 ... 这就是错误开始的地方
/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

【问题讨论】:

  • 正如我之前在该问题上所说的,您需要使用 Firebird 3 或更高版本的头文件进行编译。 Firebird 2.5 的标头没有定义 blr_boolSQL_BOOLEAN。请尝试使用 Firebird 3,并在使用该版本进行编译时显示结果。
  • 当我在我的电脑上打开“c:\Program Files (x86)\Firebird\Firebird_2_1\include\ibase.h”文件时,它的第三个非注释行如下:@987654331 @ - 所以你说/Library/Frameworks/Firebird.framework/Versions/Current/Headers - 以及ibase.h 引用的版本是什么???我认为在您安装 FB 2.5 之后,Versions/Current 被创建为 2.5 源的符号链接。如果您确实安装了 3.0 源代码 - 然后检查 Versions/Current 符号链接指向的位置,如果需要,将其更改为 3.0 源代码(Linux 上的 ln -s,在您的 BSD 命令行工具上猜测相同)
  • @Arioch'The 这就是诀窍,似乎我在安装 v3 之前还没有完全删除 v2.5。之后编译成功。感谢两者。

标签: c macos firebird php-7.4


【解决方案1】:

关于布尔数据类型的错误 - 在 Firebird 3.0 中引入 - 清楚地表明您的 PHP 库需要 Firebird 3+,但您为其提供了 FB 2.5 或更早版本的源代码。

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

我认为在您安装 FB 2.5 之后,您提到的 Versions/Current 被创建为 2.5 源的符号链接。如果您确实安装了 3.0 源 - 然后检查 Versions/Current 符号链接指向的位置,如果需要将其更改为 3.0 源(在 Linux 上为 ln -s,在您的 BSD 命令行工具上猜测相同)

快速检查可能会在该位置打开 ibase.h 并检查 API 版本声明:现在在我的 Windows 框中,第三个非注释行如下:#define FB_API_VER 21 在带有 Firebird 2.1 的文件夹中的该文件中。已安装 7 个。

或者调整 CPPFLAGSLDFLAGS 以及其他变量以指向特定的 3.x 版本源,而不是一些模糊的“默认”或“当前”。

这种标志调整当然只有在您需要将 FB 2.5 源安装为“当前”源以用于 FB 3 源中的某些其他目的的情况下才有意义。我不知道类似 UNIX 的东西,但至少在 Windows 上,安装/运行不同甚至相同版本的多个 Firebird 服务器是微不足道的,有时也很方便。未来的一些读者可能也会遇到这种情况。

【讨论】:

    猜你喜欢
    • 2021-01-26
    • 1970-01-01
    • 2021-11-21
    • 2022-06-15
    • 1970-01-01
    • 1970-01-01
    • 2016-03-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多