Closed kunkanon closed 2 years ago
We're going to cut a release with 8.1 support; does the latest revision from Git work for you?
I haven't built any extensions with MSVC before, but I do seem some places where it might be stricter than GCC with structures.
Thanks for your reply.
I tried with the latest revision of GIT, but I got the same message:
c:\php-sdk\phpdev\vs16\x64\php-8.1.2\ext\pdo_ibm\php_pdo_ibm.h(55): error C2016: C requires that a struct or union have at least one member (compiling source file ext\pdo_ibm\ibm_driver.c) ext\pdo_ibm\ibm_driver.c(1029): warning C4133: 'initializing': incompatible types - from 'long (cdecl )(pdo_dbh_t ,const zend_string *)' to 'pdo_dbh_do_func' ext\pdo_ibm\ibm_driver.c(1029): warning C4133: 'initializing': incompatible types - from 'int (cdecl )(pdo_dbh_t )' to 'pdo_dbh_check_liveness_func' c:\php-sdk\phpdev\vs16\x64\php-8.1.2\ext\pdo_ibm\php_pdo_ibm.h(55): error C2016: C requires that a struct or union have at least one member (compiling source file ext\pdo_ibm\ibm_statement.c) pdo_ibm.c c:\php-sdk\phpdev\vs16\x64\php-8.1.2\ext\pdo_ibm\php_pdo_ibm.h(55): error C2016: C requires that a struct or union have at least one member (compiling source file ext\pdo_ibm\pdo_ibm.c) NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\cl.exe"' : return code '0x2' Stop.
I wonder if a github action could be set up to build it for Windows and Linux at least.
Looks like php/php-src is using Azure pipelines, AppVeyor, and Travis CI.
@kadler The extensions used to use Travis, but uh, I'd probably want it to use Actions or Azure nowadays. The trickier part is setting up the Docker container for LUW tests; I need to figure out how to adapt the Travis stuff to an Actions workflow.
@kunkanon Can you try the following patch to see if it gets MSVC to quiet down? Some of these changes I'll probably apply, but one is questionable except as a workaround:
diff --git a/ibm_driver.c b/ibm_driver.c
index db0db36..3ceb4fb 100644
--- a/ibm_driver.c
+++ b/ibm_driver.c
@@ -370,7 +370,7 @@ static STATUS_RETURN_TYPE ibm_handle_preparer(
/* directly execute an SQL statement. */
#if PHP_8_1_OR_HIGHER
-static long ibm_handle_doer(
+static zend_long ibm_handle_doer(
pdo_dbh_t *dbh,
const zend_string *sql)
#else
@@ -997,7 +997,11 @@ static int ibm_handle_get_attribute(
return FALSE;
}
+#if PHP_8_1_OR_HIGHER
static int ibm_handle_check_liveness(pdo_dbh_t *dbh)
+#else
+static zend_result ibm_handle_check_liveness(pdo_dbh_t *dbh)
+#endif
{
conn_handle *conn_res = (conn_handle *) dbh->driver_data;
#ifdef PASE
diff --git a/php_pdo_ibm.h b/php_pdo_ibm.h
index df1330b..3dba75e 100644
--- a/php_pdo_ibm.h
+++ b/php_pdo_ibm.h
@@ -22,7 +22,7 @@
#ifndef PHP_PDO_IBM_H
#define PHP_PDO_IBM_H
-#define PDO_IBM_VERSION "1.4.2"
+#define PDO_IBM_VERSION "1.4.3"
extern zend_module_entry pdo_ibm_module_entry;
#define phpext_pdo_ibm_ptr &pdo_ibm_module_entry
@@ -51,6 +51,8 @@ ZEND_BEGIN_MODULE_GLOBALS(pdo_ibm)
#ifdef PASE /* i5/OS ease of use turn off/on */
long i5_ignore_userid; /* blank userid, possible no qsqsrvr */
long i5_override_ccsid; /* prior any CLI routine override ascii ccsid */
+#else
+ long dummy; /* Not used; test to see if this makes MSVC quiet */
#endif /* PASE */
ZEND_END_MODULE_GLOBALS(pdo_ibm)
If it works out, I'll see what I can do to include these patches in a release.
Thanks for your reply.
Worked perfectly. Only one warning has been displayed:
ext\pdo_ibm\ibm_driver.c(1032): warning C4133: 'initializing': incompatible types - from 'int (__cdecl )(pdo_dbh_t )' to 'pdo_dbh_check_liveness_func'
Although, the .ddl file has been generated successfully.
Thanks for all the support. You are excellent!!
@NattyNarwhal yeah no disagreement here on ditching Travis. The docker stuff is kinda tricky, but might be a good first step to at least run builds which that wouldn't be needed for.
I'd say ifdef around the globals:
php_pdo_ibm.h:
#ifdef __PASE__
ZEND_BEGIN_MODULE_GLOBALS(pdo_ibm)
long i5_ignore_userid; /* blank userid, possible no qsqsrvr */
long i5_override_ccsid; /* prior any CLI routine override ascii ccsid */
ZEND_END_MODULE_GLOBALS(pdo_ibm)
#endif
pdo_ibm.c:
#ifdef __PASE__
ZEND_DECLARE_MODULE_GLOBALS(pdo_ibm)
#endif
...
#ifdef __PASE__
ZEND_INIT_MODULE_GLOBALS(pdo_ibm, php_pdo_ibm_init_globals, NULL);
#endif
@kunkanon @NattyNarwhal can we close this issue if its working.
@kunkanon @NattyNarwhal can we close this issue if its working.
Yes. Thanks.
OS: Windows Server 2019 Essentials x64 Compiler: Visual C++ 2019 Architecture: x64 Package: PDO_IBM-1.4.2 PHP Version: 8.1.2 Client: IBM Data Server Driver Package V11.1
Script: configure --disable-all --disable-zts --enable-pdo --enable-cgi --with-all-shared --with-pdo-ibm="C:\Program Files\IBM\SQLLIB"
Error message:
C:\php-sdk\phpdev\vs16\x64\php-8.1.2\ext\pdo_ibm\php_pdo_ibm.h(55): error C2016: C requires that a struct or union have at least one member (compiling source file ext\pdo_ibm\ibm_driver.c) C:\php-sdk\phpdev\vs16\x64\php-8.1.2\ext\pdo_ibm\php_pdo_ibm.h(55): error C2016: C requires that a struct or union have at least one member (compiling source file ext\pdo_ibm\ibm_statement.c) ext\pdo_ibm\ibm_statement.c(1033): error C2039: 'param_type': is not a member of 'pdo_column_data' ext\pdo/php_pdo_driver.h(526): note: see declaration of 'pdo_column_data' ext\pdo_ibm\ibm_statement.c(1091): error C2039: 'param_type': is not a member of 'pdo_column_data' ext\pdo/php_pdo_driver.h(526): note: see declaration of 'pdo_column_data' C:\php-sdk\phpdev\vs16\x64\php-8.1.2\ext\pdo_ibm\php_pdo_ibm.h(55): error C2016: C requires that a struct or union have at least one member (compiling source file ext\pdo_ibm\pdo_ibm.c) NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\cl.exe"' : return code '0x2' Stop.