microsoft/msphpsql

Unable to build version 5.12.0beta1 on Windows

macintoshplus opened this issue · 3 comments

PHP version
PHP 8.2

PHP SQLSRV or PDO_SQLSRV version

SQLSRV 5.12.0beta1

Microsoft ODBC Driver version
N/D

SQL Server version
N/D

Client operating system
Windows 10

Table schema
N/D

Problem description

Unable to build this version on Windows 10 (VS16)

Expected behavior and actual behavior

Error not expected:

D:\actions-runner\_work\builder\builder\php-dev\include\ext/random/php_random.h(152): error C4146: opérateur moins unaire appliqué à un type non signé, le résultat sera non signé (compilation du fichier source D:\actions-runner\_work\builder\builder\ext\sqlsrv-5.12.0beta1\shared\core_util.cpp)
D:\actions-runner\_work\builder\builder\php-dev\include\ext/random/php_random.h(152): error C4146: opérateur moins unaire appliqué à un type non signé, le résultat sera non signé (compilation du fichier source D:\actions-runner\_work\builder\builder\ext\sqlsrv-5.12.0beta1\shared\core_stream.cpp)
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX64\x64\cl.exe"'�: code retour '0x2'
Stop.

Repro code or steps to reproduce

  1. Download PECL archive for version 5.12.0beta1
  2. Extract it and install PHP SDK, PHP DEVEL for PHP 8.2 x64
  3. Open Visual studio CMD for build x64
  4. Go to source directory
  5. Execute phpsdk-vs16-x64.bat from PHP SDK
  6. Call phpize from PHP devel
  7. call ./configure --enable-sqlsrv (add options --with-prefix if need)
  8. call nmake

Hi @macintoshplus, there is a known issue on PHP 8.3 related to sdl. You can by pass this by removing the '/sdl' from the line
'ADD_FLAG( "CFLAGS_PDO_SQLSRV", "/ZH:SHA_256 /sdl /W3" );' under '\source\pdo_sqlsrv\config.w32' and
'ADD_FLAG( "CFLAGS_SQLSRV", "/ZH:SHA_256 /sdl /W3" );' under '\source\sqlsrv\config.w32'.
This should resolve the issue.

Shouldn't /sdl be enabled during development only? After all, it's about Security Development Lifecycle (SDL) checks.