php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #81331 compile errors ibm_db2.c v2.1.3 on Windows
Submitted: 2021-08-04 16:07 UTC Modified: 2021-08-04 17:59 UTC
From: mike_itguy at yahoo dot co dot uk Assigned: cmb (profile)
Status: Closed Package: ibm_db2 (PECL)
PHP Version: 7.4.22 OS: Win81x64
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mike_itguy at yahoo dot co dot uk
New email:
PHP Version: OS:

 

 [2021-08-04 16:07 UTC] mike_itguy at yahoo dot co dot uk
Description:
------------
I want to build ibm_db2.dll  from the ibm_db2 v2.1.3 Source on Windows x64 with Visual Studio 2017 community edition and PHP 7.4.22, and I'm following the steps at https://wiki.php.net/internals/windows/stepbystepbuild_sdk_2 . I am using clidriver as the Db2-driver.  

When nmake compiles ibm_db2.c , cl.exe reports syntax errors shown below when variables of type " ulong " are used.

   "cl.exe" /D COMPILE_DL_IBM_DB2 /D IBM_DB2_EXPORTS=1 /DHAVE_SQL_H=1 /DHAVE_SQLEXT_H=1 /DHAVE_SQLCLI1_H=0 /nologo /I . /I main /I Zend /I TSRM /I ext /D _WINDOWS /D WINDOWS=1 /D ZEND_WIN32=1 /D PHP_WIN32=1 /D WIN32 /D _MBCS /W3 /D _USE_MATH_DEFINES /FD /wd4996 /Qspectre /guard:cf /Zc:inline /Zc:__cplusplus /d2FuncCache1 /Zc:wchar_t /MP /LD /MD /W3 /Ox /D NDebug /D NDEBUG /D ZEND_WIN32_FORCE_INLINE /GF /D ZEND_DEBUG=0 /D ZTS=1 /I "C:\php-sdk\phpdev\vc15\x64\deps\include" /D FD_SETSIZE=256 /FoC:\php-sdk\phpdev\vc15\x64\php-src-php-7.4.22\x64\Release_TS\pecl\ibm_db2-2.1.3\ /FpC:\php-sdk\phpdev\vc15\x64\php-src-php-7.4.22\x64\Release_TS\pecl\ibm_db2-2.1.3\ /FRC:\php-sdk\phpdev\vc15\x64\php-src-php-7.4.22\x64\Release_TS\pecl\ibm_db2-2.1.3\ /FdC:\php-sdk\phpdev\vc15\x64\php-src-php-7.4.22\x64\Release_TS\pecl\ibm_db2-2.1.3\ /c ..\pecl\ibm_db2-2.1.3\ibm_db2.c
ibm_db2.c


.\pecl\ibm_db2-2.1.3\ibm_db2.c(1890): error C2065: 'ulong': undeclared identifier
..\pecl\ibm_db2-2.1.3\ibm_db2.c(1890): error C2146: syntax error: missing ';' before identifier 'num_idx'
..\pecl\ibm_db2-2.1.3\ibm_db2.c(1890): error C2065: 'num_idx': undeclared identifier
..\pecl\ibm_db2-2.1.3\ibm_db2.c(4774): error C2065: 'ulong': undeclared identifier
..\pecl\ibm_db2-2.1.3\ibm_db2.c(4774): error C2146: syntax error: missing ';' before identifier 'num_key'
..\pecl\ibm_db2-2.1.3\ibm_db2.c(4774): error C2065: 'num_key': undeclared identifier
..\pecl\ibm_db2-2.1.3\ibm_db2.c(4837): error C2065: 'num_key': undeclared identifier
..\pecl\ibm_db2-2.1.3\ibm_db2.c(7522): error C2065: 'ulong': undeclared identifier
..\pecl\ibm_db2-2.1.3\ibm_db2.c(7522): error C2146: syntax error: missing ';' before identifier 'num_key'
..\pecl\ibm_db2-2.1.3\ibm_db2.c(7522): error C2065: 'num_key': undeclared identifier
..\pecl\ibm_db2-2.1.3\ibm_db2.c(7522): error C2065: 'num_key1': undeclared identifier
..\pecl\ibm_db2-2.1.3\ibm_db2.c(7522): error C2065: 'num_key2': undeclared identifier
..\pecl\ibm_db2-2.1.3\ibm_db2.c(7522): error C2065: 'num_key3': undeclared identifier
..\pecl\ibm_db2-2.1.3\ibm_db2.c(7522): error C2065: 'num_key4': undeclared identifier
..\pecl\ibm_db2-2.1.3\ibm_db2.c(7522): error C2065: 'num_key5': undeclared identifier
..\pecl\ibm_db2-2.1.3\ibm_db2.c(7574): error C2065: 'num_key': undeclared identifier
..\pecl\ibm_db2-2.1.3\ibm_db2.c(7607): error C2065: 'num_key1': undeclared identifier
..\pecl\ibm_db2-2.1.3\ibm_db2.c(7631): error C2065: 'num_key2': undeclared identifier
..\pecl\ibm_db2-2.1.3\ibm_db2.c(7633): error C2065: 'num_key3': undeclared identifier
..\pecl\ibm_db2-2.1.3\ibm_db2.c(7655): error C2065: 'num_key4': undeclared identifier
..\pecl\ibm_db2-2.1.3\ibm_db2.c(7657): error C2065: 'num_key5': undeclared identifier





Test script:
---------------
These are the steps that I follow, all succeed until the nmake, which fails due to the above mentioned syntax errors.

rd /s /q c:\php-sdk
git clone https://github.com/Microsoft/php-sdk-binary-tools.git c:\php-sdk
cd c:\php-sdk
git checkout php-sdk-2.2.0
phpsdk-vc15-x64.bat
phpsdk_buildtree phpdev
unzip -q C:\Users\user1\downloads\php-src-php-7.4.22.zip
mkdir pecl
copy %userprofile%\downloads\ibm_db2-2.1.3.tgz .\pecl
cd pecl
gzip -d ibm_db2-2.1.3.tgz
tar -xf ibm_db2-2.1.3.tar
edit the config.w32 to replace db2cli.lib by db2cli64.lib for clidriver
cd ..\php-src-php-7.4.22
phpsdk_deps -u
set LIB=c:\clidriver\lib;%LIB%
set INCLUDE=c:\clidriver\include;%INCLUDE%
set PATH=c:\clidriver\bin;%PATH%
buildconf
configure --help | find /i "ibm" 

configure --enable-cli --with-ibm_db2=shared,C:\clidriver 1>\tmp\configure.log 2>&1 

 nmake 1>\tmp\nmake1.log 2>&1 


Expected result:
----------------
was expecting the compilation of ibm_db2.c to complete without syntax errors.

Actual result:
--------------
See the syntax errors mentioned above.

Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-08-04 16:20 UTC] cmb@php.net
The following pull request has been associated:

Patch Name: Fix #81331: compile errors ibm_db2.c v2.1.3 on Windows
On GitHub:  https://github.com/php/pecl-database-ibm_db2/pull/13
Patch:      https://github.com/php/pecl-database-ibm_db2/pull/13.patch
 [2021-08-04 16:21 UTC] cmb@php.net
-Status: Open +Status: Verified -Assigned To: +Assigned To: cmb
 [2021-08-04 16:21 UTC] cmb@php.net
Could you please try with the suggested fix:
<https://github.com/php/pecl-database-ibm_db2/pull/13>.
 [2021-08-04 16:21 UTC] cmb@php.net
-Status: Verified +Status: Feedback
 [2021-08-04 17:15 UTC] mike_itguy at yahoo dot co dot uk
Thank you. The replacing in ibm_db2.c, of " ulong " by " unsigned long " allows the build to complete without errors. I cannot comment on whether  " zend_ulong " or " unsigned long " is preferred.
 [2021-08-04 17:59 UTC] cmb@php.net
-Status: Feedback +Status: Verified
 [2021-08-04 17:59 UTC] cmb@php.net
Thanks for the swift reply!  unsigned long is an exact replacement
for ulong, but indeed there may be an opportunity to actually fix
the types.
 [2021-08-05 14:11 UTC] git@php.net
Automatic comment on behalf of cmb69
Revision: https://github.com/php/pecl-database-ibm_db2/commit/3d612efbb2d56c1118b5d5d245a98af8c3825403
Log: Fix #81331: compile errors ibm_db2.c v2.1.3 on Windows
 [2021-08-05 14:11 UTC] git@php.net
-Status: Verified +Status: Closed
 [2021-08-05 14:11 UTC] git@php.net
Automatic comment on behalf of NattyNarwhal (author) and web-flow (committer)
Revision: https://github.com/php/pecl-database-ibm_db2/commit/7b25ec67b0a7c5b68c6d68dc01790ba28453b21f
Log: Merge pull request #13 from cmb69/cmb/ulong
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 01 17:01:34 2025 UTC