c - 在 macos 上为 PHP-7.4 编译 firebird 驱动程序的问题
问题描述
我一直在尝试在 macos 上安装/编译 php7.4 的 php-firebird 驱动程序,但到目前为止还没有成功。
驱动程序仓库中存在一个问题,但在帮助方面没有太多进展。 https://github.com/FirebirdSQL/php-firebird/issues/6
到目前为止,我这样做了:
- 已安装
https://github.com/FirebirdSQL/firebird/releases/download/R2_5_9/FirebirdCS-2.5.9-27139-x86_64.pkg
(也尝试使用 firebird 3.x) - 将此回购克隆到
php-firebird
- 光盘
php-firebird
phpize
CPPFLAGS=-I/Library/Frameworks/Firebird.framework/Versions/Current/Headers LDFLAGS=-L/Library/Frameworks/Firebird.framework/Versions/Current/Libraries ./configure
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.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 源(ln -s
在 Linux 上,在您的 BSD 命令行工具上猜测相同)
快速检查可能会ibase.h
在该位置打开并检查 API 版本声明:现在在我的 Windows 框中,第三个非注释行如下:#define FB_API_VER 21
在安装了 Firebird 2.1.7 的文件夹中的该文件中。
或者调整CPPFLAGS
和LDFLAGS
可能的其他变量以指向特定的 3.x 版本源,而不是一些模糊的“默认”或“当前”。
当然,此标志调整仅在您需要将 FB 2.5 源安装为“当前”源以用于沿 FB 3 源的某些其他目的的情况下才有意义。我不知道类 UNIX,但至少在 Windows 上,安装/运行不同甚至相同版本的多个 Firebird 服务器是微不足道的,有时也很方便。对于一些未来的读者来说,情况可能也是如此。
推荐阅读
- javascript - Firestore:如何通过存在于其他集合中来过滤文档?
- javascript - Tizen TAU 更改页面 - 页面更改后,Javascript 和其他选项(如 onload)不起作用(可穿戴 V5.5)
- excel - 我不想在电源查询中看到隐藏 excel 列
- amazon-web-services - 如何使用 aws cli 获取默认安全组 ID?
- bash - 在 bash (snmpget) 中使用阈值设置颜色
- c# - SQL 大容量复制 C#
- java - 从类加载器获取返回值
- etl - 在 Talen Studio 中使用三元运算符时出现空指针异常
- javascript - 将模块导入到threejs javascript场景中
- python - 如何在 Mac OS 中设置和运行 python-lambda-local