doujiang5211 2018-10-23 16:24
浏览 143

php 5 pdo_odbc在macOS High Sierra上构建错误

I need the pdo_odbc.so extension for php 5.6.24, running on macOS High Sierra. The webserver with php is running perfect. But without the PDO_ODBC extension yet. So I had to build the .so file....

I installed brew (version 1.8.0), autoconf (version 2.69), unixodbc (version 2.3.7) and downloaded the php-5.6.24 ressources. After extracting the php sources, I changed to php-5.6.24/ext/pdo_odbc directory and executed:

phpize
./configure --with-pdo-odbc=unixODBC

Configure finished with the "config.status: creating config.h" message. Fine!

Next step:

make

Make brings a lot of warnings and errors I don't understand:

admins-Mac-mini:pdo_odbc admin$ make
/bin/sh /Users/admin/Downloads/php-5.6.24/ext/pdo_odbc/libtool --mode=compile cc -I/usr/include/php/ext  -I/usr/local/include -DPDO_ODBC_TYPE=\"unixODBC\" -I. -I/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc -DPHP_ATOM_INC -I/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc/include -I/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc/main -I/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /Users/admin/Downloads/php-5.6.24/ext/pdo_odbc/pdo_odbc.c -o pdo_odbc.lo 
mkdir .libs
 cc -I/usr/include/php/ext -I/usr/local/include -DPDO_ODBC_TYPE=\"unixODBC\" -I. -I/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc -DPHP_ATOM_INC -I/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc/include -I/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc/main -I/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /Users/admin/Downloads/php-5.6.24/ext/pdo_odbc/pdo_odbc.c  -fno-common -DPIC -o .libs/pdo_odbc.o
/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc/pdo_odbc.c:135:63: warning: cast to 'void *' from smaller integer type 'SQLUINTEGER' (aka 'unsigned int')
      [-Wint-to-void-pointer-cast]
                SQLSetEnvAttr(SQL_NULL_HANDLE, SQL_ATTR_CONNECTION_POOLING, (void*)pdo_odbc_pool_on, 0);
                                                                            ^
1 warning generated.
/bin/sh /Users/admin/Downloads/php-5.6.24/ext/pdo_odbc/libtool --mode=compile cc -I/usr/include/php/ext  -I/usr/local/include -DPDO_ODBC_TYPE=\"unixODBC\" -I. -I/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc -DPHP_ATOM_INC -I/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc/include -I/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc/main -I/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /Users/admin/Downloads/php-5.6.24/ext/pdo_odbc/odbc_driver.c -o odbc_driver.lo 
 cc -I/usr/include/php/ext -I/usr/local/include -DPDO_ODBC_TYPE=\"unixODBC\" -I. -I/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc -DPHP_ATOM_INC -I/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc/include -I/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc/main -I/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /Users/admin/Downloads/php-5.6.24/ext/pdo_odbc/odbc_driver.c  -fno-common -DPIC -o .libs/odbc_driver.o
/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc/odbc_driver.c:52:39: error: too many arguments to function call, expected 2, have 3
        add_next_index_string(info, message, 0);
        ~~~~~~~~~~~~~~~~~~~~~                ^
/usr/include/php/Zend/zend_API.h:437:1: note: 'add_next_index_string' declared here
ZEND_API int add_next_index_string(zval *arg, const char *str);
^
/usr/include/php/main/php_config.h:6:19: note: expanded from macro 'ZEND_API'
# define ZEND_API __attribute__ ((visibility("default")))
                  ^
/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc/odbc_driver.c:53:49: error: too many arguments to function call, expected 2, have 3
        add_next_index_string(info, einfo->last_state, 1);
        ~~~~~~~~~~~~~~~~~~~~~                          ^
/usr/include/php/Zend/zend_API.h:437:1: note: 'add_next_index_string' declared here
ZEND_API int add_next_index_string(zval *arg, const char *str);
^
/usr/include/php/main/php_config.h:6:19: note: expanded from macro 'ZEND_API'
# define ZEND_API __attribute__ ((visibility("default")))
                  ^
/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc/odbc_driver.c:92:41: warning: passing 'char [6]' to parameter of type 'SQLCHAR *' (aka 'unsigned char *') converts between
      pointers to integer types with different sign [-Wpointer-sign]
        rc = SQLGetDiagRec(htype, eh, recno++, einfo->last_state, &einfo->last_error,
                                               ^~~~~~~~~~~~~~~~~
/usr/local/include/sql.h:727:70: note: passing argument to parameter 'Sqlstate' here
                                     SQLSMALLINT RecNumber, SQLCHAR *Sqlstate,
                                                                     ^
/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc/odbc_driver.c:93:4: warning: passing 'char [512]' to parameter of type 'SQLCHAR *' (aka 'unsigned char *') converts between
      pointers to integer types with different sign [-Wpointer-sign]
                        einfo->last_err_msg, sizeof(einfo->last_err_msg)-1, &errmsgsize);
                        ^~~~~~~~~~~~~~~~~~~
/usr/local/include/sql.h:728:72: note: passing argument to parameter 'MessageText' here
                                     SQLINTEGER *NativeError, SQLCHAR *MessageText,
                                                                       ^
/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc/odbc_driver.c:120:42: warning: passing 'char [6]' to parameter of type 'SQLCHAR *' (aka 'unsigned char *') converts between
      pointers to integer types with different sign [-Wpointer-sign]
                rc = SQLGetDiagRec(htype, eh, recno++, discard_state, &code,
                                                       ^~~~~~~~~~~~~
/usr/local/include/sql.h:727:70: note: passing argument to parameter 'Sqlstate' here
                                     SQLSMALLINT RecNumber, SQLCHAR *Sqlstate,
                                                                     ^
/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc/odbc_driver.c:121:5: warning: passing 'char [1024]' to parameter of type 'SQLCHAR *' (aka 'unsigned char *') converts between
      pointers to integer types with different sign [-Wpointer-sign]
                                discard_buf, sizeof(discard_buf)-1, &errmsgsize);
                                ^~~~~~~~~~~
/usr/local/include/sql.h:728:72: note: passing argument to parameter 'MessageText' here
                                     SQLINTEGER *NativeError, SQLCHAR *MessageText,
                                                                       ^
/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc/odbc_driver.c:161:59: warning: incompatible pointer types passing 'int *' to parameter of type 'size_t *'
      (aka 'unsigned long *') [-Wincompatible-pointer-types]
        ret = pdo_parse_params(stmt, (char*)sql, sql_len, &nsql, &nsql_len TSRMLS_CC);
                                                                 ^~~~~~~~~
/usr/include/php/ext/pdo/php_pdo_driver.h:679:27: note: passing argument to parameter 'outquery_len' here
        char **outquery, size_t *outquery_len);
                                 ^
/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc/odbc_driver.c:197:27: warning: passing 'char *' to parameter of type 'SQLCHAR *' (aka 'unsigned char *') converts between
      pointers to integer types with different sign [-Wpointer-sign]
        rc = SQLPrepare(S->stmt, (char*)sql, SQL_NTS);
                                 ^~~~~~~~~~
/usr/local/include/sql.h:762:44: note: passing argument to parameter 'StatementText' here
                                  SQLCHAR *StatementText, SQLINTEGER TextLength);
                                           ^
/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc/odbc_driver.c:236:27: warning: passing 'char *' to parameter of type 'SQLCHAR *' (aka 'unsigned char *') converts between
      pointers to integer types with different sign [-Wpointer-sign]
        rc = SQLExecDirect(stmt, (char *)sql, sql_len);
                                 ^~~~~~~~~~~
/usr/local/include/sql.h:668:47: note: passing argument to parameter 'StatementText' here
                                     SQLCHAR *StatementText, SQLINTEGER TextLength);
                                              ^
/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc/odbc_driver.c:359:44: error: too many arguments provided to function-like macro invocation
                        ZVAL_STRING(val, "ODBC-" PDO_ODBC_TYPE, 1);
                                                                ^
/usr/include/php/Zend/zend_API.h:583:9: note: macro 'ZVAL_STRING' defined here
#define ZVAL_STRING(z, s) do {                                  \
        ^
/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc/odbc_driver.c:359:4: error: use of undeclared identifier 'ZVAL_STRING'
                        ZVAL_STRING(val, "ODBC-" PDO_ODBC_TYPE, 1);
                        ^
/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc/odbc_driver.c:378:2: warning: incompatible pointer types initializing 'pdo_dbh_prepare_func' (aka 'int (*)(struct _pdo_dbh_t *,
      const char *, unsigned long, struct _pdo_stmt_t *, struct _zval_struct *)') with an expression of type 'int (pdo_dbh_t *, const char *, long, pdo_stmt_t *, zval *)'
      (aka 'int (struct _pdo_dbh_t *, const char *, long, struct _pdo_stmt_t *, struct _zval_struct *)') [-Wincompatible-pointer-types]
        odbc_handle_preparer,
        ^~~~~~~~~~~~~~~~~~~~
/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc/odbc_driver.c:379:2: warning: incompatible pointer types initializing 'pdo_dbh_do_func' (aka 'long long (*)(struct _pdo_dbh_t
      *, const char *, unsigned long)') with an expression of type 'long (pdo_dbh_t *, const char *, long)' (aka 'long (struct _pdo_dbh_t *, const char *, long)')
      [-Wincompatible-pointer-types]
        odbc_handle_doer,
        ^~~~~~~~~~~~~~~~
/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc/odbc_driver.c:380:2: warning: incompatible pointer types initializing 'pdo_dbh_quote_func' (aka 'int (*)(struct _pdo_dbh_t *,
      const char *, unsigned long, char **, unsigned long *, enum pdo_param_type)') with an expression of type 'int (pdo_dbh_t *, const char *, int, char **, int *, enum
      pdo_param_type)' (aka 'int (struct _pdo_dbh_t *, const char *, int, char **, int *, enum pdo_param_type)') [-Wincompatible-pointer-types]
        odbc_handle_quoter,
        ^~~~~~~~~~~~~~~~~~
/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc/odbc_driver.c:384:2: warning: incompatible pointer types initializing 'pdo_dbh_set_attr_func' (aka 'int (*)(struct _pdo_dbh_t
      *, long long, struct _zval_struct *)') with an expression of type 'int (pdo_dbh_t *, long, zval *)' (aka 'int (struct _pdo_dbh_t *, long, struct _zval_struct *)')
      [-Wincompatible-pointer-types]
        odbc_handle_set_attr,
        ^~~~~~~~~~~~~~~~~~~~
/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc/odbc_driver.c:387:2: warning: incompatible pointer types initializing 'pdo_dbh_get_attr_func' (aka 'int (*)(struct _pdo_dbh_t
      *, long long, struct _zval_struct *)') with an expression of type 'int (pdo_dbh_t *, long, zval *)' (aka 'int (struct _pdo_dbh_t *, long, struct _zval_struct *)')
      [-Wincompatible-pointer-types]
        odbc_handle_get_attr,   /* get attr */
        ^~~~~~~~~~~~~~~~~~~~
/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc/odbc_driver.c:412:49: warning: cast to 'void *' from smaller integer type 'SQLUINTEGER' (aka 'unsigned int')
      [-Wint-to-void-pointer-cast]
                rc = SQLSetEnvAttr(H->env, SQL_ATTR_CP_MATCH, (void*)pdo_odbc_pool_mode, 0);
                                                              ^
/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc/odbc_driver.c:435:51: warning: cast to 'void *' from smaller integer type 'SQLUINTEGER' (aka 'unsigned int')
      [-Wint-to-void-pointer-cast]
        rc = SQLSetConnectAttr(H->dbc, SQL_ODBC_CURSORS, (void*)cursor_lib, SQL_IS_INTEGER);
                                                         ^
/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc/odbc_driver.c:456:39: warning: passing 'char *' to parameter of type 'SQLCHAR *' (aka 'unsigned char *') converts between
      pointers to integer types with different sign [-Wpointer-sign]
                rc = SQLDriverConnect(H->dbc, NULL, (char*)dbh->data_source, strlen(dbh->data_source),
                                                    ^~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/sqlext.h:1793:18: note: passing argument to parameter 'szConnStrIn' here
    SQLCHAR               *szConnStrIn,
                           ^
/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc/odbc_driver.c:457:5: warning: passing 'char [1024]' to parameter of type 'SQLCHAR *' (aka 'unsigned char *') converts between
      pointers to integer types with different sign [-Wpointer-sign]
                                dsnbuf, sizeof(dsnbuf)-1, &dsnbuflen, SQL_DRIVER_NOPROMPT);
                                ^~~~~~
/usr/local/include/sqlext.h:1795:24: note: passing argument to parameter 'szConnStrOut' here
    SQLCHAR           *szConnStrOut,
                       ^
/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc/odbc_driver.c:460:27: warning: passing 'char *' to parameter of type 'SQLCHAR *' (aka 'unsigned char *') converts between
      pointers to integer types with different sign [-Wpointer-sign]
                rc = SQLConnect(H->dbc, (char*)dbh->data_source, SQL_NTS, dbh->username, SQL_NTS, dbh->password, SQL_NTS);
                                        ^~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/sql.h:633:44: note: passing argument to parameter 'ServerName' here
                                  SQLCHAR *ServerName, SQLSMALLINT NameLength1,
                                           ^
/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc/odbc_driver.c:460:61: warning: passing 'char *' to parameter of type 'SQLCHAR *' (aka 'unsigned char *') converts between
      pointers to integer types with different sign [-Wpointer-sign]
                rc = SQLConnect(H->dbc, (char*)dbh->data_source, SQL_NTS, dbh->username, SQL_NTS, dbh->password, SQL_NTS);
                                                                          ^~~~~~~~~~~~~
/usr/local/include/sql.h:634:44: note: passing argument to parameter 'UserName' here
                                  SQLCHAR *UserName, SQLSMALLINT NameLength2,
                                           ^
/Users/admin/Downloads/php-5.6.24/ext/pdo_odbc/odbc_driver.c:460:85: warning: passing 'char *' to parameter of type 'SQLCHAR *' (aka 'unsigned char *') converts between
      pointers to integer types with different sign [-Wpointer-sign]
                rc = SQLConnect(H->dbc, (char*)dbh->data_source, SQL_NTS, dbh->username, SQL_NTS, dbh->password, SQL_NTS);
                                                                                                  ^~~~~~~~~~~~~
/usr/local/include/sql.h:635:44: note: passing argument to parameter 'Authentication' here
                                  SQLCHAR *Authentication, SQLSMALLINT NameLength3);
                                           ^
19 warnings and 4 errors generated.
make: *** [odbc_driver.lo] Error 1

I tried different php Version (including PHP 7..). I also tried a different phpize Version (PHP Api Version 20131106).

What did I miss?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 用PLC设计纸袋糊底机送料系统
    • ¥15 simulink仿真中dtc控制永磁同步电机如何控制开关频率
    • ¥15 用C语言输入方程怎么
    • ¥15 网站显示不安全连接问题
    • ¥15 github训练的模型参数无法下载
    • ¥15 51单片机显示器问题
    • ¥20 关于#qt#的问题:Qt代码的移植问题
    • ¥50 求图像处理的matlab方案
    • ¥50 winform中使用edge的Kiosk模式
    • ¥15 关于#python#的问题:功能监听网页