Windows DLL available to download
macintoshplus opened this issue ยท 29 comments
I am pleased to announce that this extension is now compiled for Windows by the PHP Extension Repository site.
You can download the DLLs on the extension page: https://phpext.phptools.online/extension/database/pdo_sqlsrv-96
If you have any questions, I am available to discuss them.
Did you already try to compile this for PHP 8.4.0 VS17, Alpha 2?
Hi @Jan-E ,
Yes, I have tried to compile the latest version (5.12.0).
The result is poor.
Error example:
error C2039: 'const_pointer' not a member of 'std::allocator'
NMAKE : fatal error U1077
I will work on it later.
@cmb69 Jean-Baptiste Nahan aka @macintoshplus was able to compile php_pdo_sqlsrv.dll for PHP 8.3, but this fails for PHP 8.4.0 Alpha 2. Any idea what could be causing that?
@Jan-E, no particular idea, but since the latest commit in this repo was about updating the changelog to state "Support for PHP 8.3", I'd assume that the maintainers had no time yet to establish compatibility with PHP 8.4.
Also note that https://github.com/php/php-windows-builder already supports building pdo_sqlsrv and sqlsrv (and respective DLL downloads are available via the PECL website). I assume that mass rebuilds will be done later.
@Jan-E what architecture (x86/x64) and ts/nts do you need?
error C2039: 'const_pointer' not a member of 'std::allocator'
That apparently is not supported with /std:c++20
.
error C2039: 'const_pointer' not a member of 'std::allocator'
That apparently is not supported with
/std:c++20
.
Ok, but /std:c++20
is needed to solve errors.
To solve this error error C4146: unary minus operator applied to unsigned type, result still unsigned
, I need to change the php-8.4.0alpha2-devel-vs17-x64\include\ext\random\php_random_uint128.h
in PHP devel.
Why?
Other error error C4576: a parenthesized type followed by an initializer list is a non-standard explicit type conversion syntax
I had roughly the same errors. For GRPC 1.63.0 I had to go for standard C11:
ADD_FLAG("CFLAGS_GRPC", " /std:c11 ");
Might be a try. Change the CFLAGS into the good one for SQLSRV or PDO_SQLSRV
Ok, but
/std:c++20
is needed to solve errors.
No, this is not (and should not be) needed. See php/php-src#15094 regarding the php_random.h issue, and php/php-src#15096 regarding an issue with zend_portability.h. I did successfully build (haven't run any test, though), but need to sort out the mess I've created in the meantime. Perhaps there are more issues that need to be properly fixed. And of course, the /sdl
needs to be removed, like for PHP 8.3.
I had roughly the same errors. For GRPC 1.63.0 I had to go for standard C11:
That should be irrelevant, since this is a C++ extension. The default (C++14) should be good enough (with the already existing /Zc:__cplusplus
directive, which sets __cplusplus
accordingly).
Perhaps there are more issues that need to be properly fixed.
Apparently not. :)
@Jan-E what architecture (x86/x64) and ts/nts do you need?
Actually, all of them. This is what triggered my question:
https://www.apachelounge.com/viewtopic.php?p=42895#42895
But it looks like @cmb69 is on track for solving the issue.
@cmb69 I have build sucessfully with your change in PR and this change:
file: php-8.4.0alpha2-devel-vs17-x64\include\ext\random\php_random_uint128.h
@84
- return (v >> s) | (v << ((-s) & 63));
+ return (v >> s) | (v << ((s) & 63));
@124
- return (v >> s) | (v << ((-s) & 63));
+ return (v >> s) | (v << ((s) & 63));
I think that this patch would change the behavior: s
is unsigned, and the -
is relevant, and the code is just relying on underflow, what is even specified behavior (IIRC), but certainly not undefined behavior. Or is that different in C++?
Better use #1496 instead, in my opinion.
Even with the patch from php/php-src#15100 I am still getting error C2039: 'const_pointer': is not a member of 'std::allocator<void>'
That seems to be due yo the fact that it is used in L469 of
msphpsql/source/shared/core_sqlsrv.h
Lines 467 to 472 in 41ac126
What did you change to make it compile?
error C2039: 'const_pointer': is not a member of 'std::allocator'
Try with an older C++ standard; that failed for me with C++20, but worked with the default (for me C++14).
error C2039: 'const_pointer': is not a member of 'std::allocator'
Try with an older C++ standard; that failed for me with C++20, but worked with the default (for me C++14).
Works. https://phpdev.toolsforresearch.com/php-8.4.0alpha2-nts-Win32-vs17-x64.htm
I was already wondering why sqlsrv 5.11.1 was compiling with VS16, but failed with VS17. 5.11.1 has the same lines.
I did not run tests (due to missing a running SQL Server), but I will ask at Apachelounge if anyone can do some informal tests.
Note that building against early pre-releases is certainly a good idea to catch issues (either necessary changes to extension code, or, like in this case, upstream issues), but please do not redistribute such builds (at least add a warning), since the API version bump usually is done shortly prior to RC1, so previously build extension cannot be loaded anymore ("expected API version X, but got Y"). And building during RC stage for redistribution might still not be the best idea. When the PECL build machine was still running, we usually triggered mass rebuilds only a while after GA.
The topic on Apachelounge starts with:
This topic is about 'non-production' builds.
It seems pdo_sqlsrv 5.12.0 builds fine against PHP 8.4.0alpha2 with the same modifications.
Yes, both sqlsrv 5.12.0 extensions are already included:
https://phpdev.toolsforresearch.com/php-8.4.0alpha2-nts-Win32-vs17-x64.htm
https://phpdev.toolsforresearch.com/php-8.4.0alpha2-Win32-vs17-x64.htm
Hi,
Like last night, the build error is always the same. I have tried using CFLAGS=/std:c++20
or /std:c++14
without change.
What have you changed after the 2 patches of @cmb69 and removing /sdl
flag?
@cmb69 I have build sucessfully with your change in PR and this change:
file:
php-8.4.0alpha2-devel-vs17-x64\include\ext\random\php_random_uint128.h
@84 - return (v >> s) | (v << ((-s) & 63)); + return (v >> s) | (v << ((s) & 63)); @124 - return (v >> s) | (v << ((-s) & 63)); + return (v >> s) | (v << ((s) & 63));
@cmb69 your 2 patches work fine and resolve errors but not all.
Ok, I can build the extensions. To solve the error, I removed the extension source code and extracted it again.
Warnings, no errors. Sorry for the long lines. I am working on an iPad right now with a VNC connection to my build machine.
core_stmt.cpp
N:\php-sdk\php84dev\Zend\zend_gc.h(156): warning C4244: '=': conversion from '__int64' to 'int', possible loss of data (compiling source file ext\pdo_sqlsrv\shared\core_init.cpp)
N:\php-sdk\php84dev\Zend\zend_gc.h(156): warning C4244: '=': conversion from '__int64' to 'int', possible loss of data (compiling source file ext\pdo_sqlsrv\shared\core_results.cpp)
N:\php-sdk\php84dev\Zend\zend_gc.h(156): warning C4244: '=': conversion from '__int64' to 'int', possible loss of data (compiling source file ext\pdo_sqlsrv\shared\core_conn.cpp)
N:\php-sdk\php84dev\Zend\zend_gc.h(156): warning C4244: '=': conversion from '__int64' to 'int', possible loss of data (compiling source file ext\pdo_sqlsrv\shared\core_stmt.cpp)
N:\php-sdk\php84dev\ext\random\php_random_uint128.h(84): warning C4146: unary minus operator applied to unsigned type, result still unsigned (compiling source file ext\pdo_sqlsrv\shared\core_results.cpp)
N:\php-sdk\php84dev\ext\random\php_random_uint128.h(84): warning C4146: unary minus operator applied to unsigned type, result still unsigned (compiling source file ext\pdo_sqlsrv\shared\core_init.cpp)
N:\php-sdk\php84dev\ext\random\php_random_uint128.h(84): warning C4146: unary minus operator applied to unsigned type, result still unsigned (compiling source file ext\pdo_sqlsrv\shared\core_conn.cpp)
N:\php-sdk\php84dev\ext\random\php_random_uint128.h(84): warning C4146: unary minus operator applied to unsigned type, result still unsigned (compiling source file ext\pdo_sqlsrv\shared\core_stmt.cpp)
ext\pdo_sqlsrv\shared\core_conn.cpp(952): warning C4267: '=': conversion from 'size_t' to 'unsigned int', possible loss of data
core_stream.cpp
ext\pdo_sqlsrv\shared\core_conn.cpp(1195): warning C4267: '=': conversion from 'size_t' to 'unsigned int', possible loss of data
ext\pdo_sqlsrv\shared\core_stmt.cpp(951): warning C4244: '=': conversion from 'SQLLEN' to 'long', possible loss of data
ext\pdo_sqlsrv\shared\core_stmt.cpp(1609): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
ext\pdo_sqlsrv\shared\core_stmt.cpp(1621): warning C4244: 'initializing': conversion from '__int64' to 'int', possible loss of data
ext\pdo_sqlsrv\shared\core_stmt.cpp(1624): warning C4244: 'argument': conversion from '__int64' to 'int', possible loss of data
ext\pdo_sqlsrv\shared\core_stmt.cpp(1664): warning C4244: '=': conversion from 'SQLLEN' to 'SQLSMALLINT', possible loss of data
ext\pdo_sqlsrv\shared\core_stmt.cpp(1899): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
ext\pdo_sqlsrv\shared\core_stmt.cpp(1946): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
ext\pdo_sqlsrv\shared\core_stmt.cpp(1947): warning C4244: 'initializing': conversion from '__int64' to 'int', possible loss of data
ext\pdo_sqlsrv\shared\core_stmt.cpp(1953): warning C4244: 'argument': conversion from '__int64' to 'int', possible loss of data
ext\pdo_sqlsrv\shared\core_stmt.cpp(1964): warning C4244: 'initializing': conversion from '__int64' to 'int', possible loss of data
ext\pdo_sqlsrv\shared\core_stmt.cpp(1969): warning C4244: '=': conversion from '__int64' to 'int', possible loss of data
ext\pdo_sqlsrv\shared\core_stmt.cpp(1971): warning C4244: 'argument': conversion from '__int64' to 'int', possible loss of data
ext\pdo_sqlsrv\shared\core_stmt.cpp(1977): warning C4244: '=': conversion from '__int64' to 'int', possible loss of data
ext\pdo_sqlsrv\shared\core_stmt.cpp(1980): warning C4244: '=': conversion from '__int64' to 'int', possible loss of data
ext\pdo_sqlsrv\shared\core_stmt.cpp(1981): warning C4244: '=': conversion from '__int64' to 'int', possible loss of data
ext\pdo_sqlsrv\shared\core_stmt.cpp(3567): warning C4267: 'argument': conversion from 'size_t' to 'unsigned short', possible loss of data
core_util.cpp
Now, I have this log too.
In a perfect world, these warnings should be resolved, but as far as I can tell, these are level 2 and 3 warnings; if you want them suppressed, remove the /W3
from config.w32 (it's on the same line as '/sdl'), and phpize again.
With a x86 build there are less warnings.
core_stmt.cpp
N:\php-sdk\php84dev\ext\random\php_random_uint128.h(84): warning C4146: unary minus operator applied to unsigned type, result still unsigned (compiling source file ext\sqlsrv\shared\core_init.cpp)
N:\php-sdk\php84dev\ext\random\php_random_uint128.h(84): warning C4146: unary minus operator applied to unsigned type, result still unsigned (compiling source file ext\sqlsrv\shared\core_results.cpp)
N:\php-sdk\php84dev\ext\random\php_random_uint128.h(84): warning C4146: unary minus operator applied to unsigned type, result still unsigned (compiling source file ext\sqlsrv\shared\core_stmt.cpp)
N:\php-sdk\php84dev\ext\random\php_random_uint128.h(84): warning C4146: unary minus operator applied to unsigned type, result still unsigned (compiling source file ext\sqlsrv\shared\core_conn.cpp)
core_stream.cpp
ext\sqlsrv\shared\core_stmt.cpp(1664): warning C4244: '=': conversion from 'SQLINTEGER' to 'SQLSMALLINT', possible loss of data
ext\sqlsrv\shared\core_stmt.cpp(1918): warning C4018: '<': signed/unsigned mismatch
ext\sqlsrv\shared\core_stmt.cpp(3567): warning C4267: 'argument': conversion from 'size_t' to 'unsigned short', possible loss of data
core_util.cpp
With a reply:
I can confirm this current 8.4.0 Alpha 2 does contain SQLSRV and it works.
I've tested my use cases (Mostly selects and inserts) and all works like a charm.