snowflakedb / pdo_snowflake

PHP PDO driver for snowflake

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SNOW-900379: Windows VS2019 build script produces unusable DLL

artello73 opened this issue · comments

I've been usung the instruction to build a PHP (8.2.9) PDO Snowflake driver on Windows 10 x64 machine using Visual Studio 2019. The build completed successfully, but PHP interpreter throwing an error that DLL can't be loaded.

While reviewing the build scripts output I noticed that an issue happened during command execution

 .\scripts\run_setup_php.bat x64 Release VS16 8.2.9 F:\php-sdk
builder@aorus > .\scripts\run_setup_php.bat x64 Release VS16 8.2.9 F:\php-sdk
=== setting up global environment variables
"Building with platform: x64, build type: Release, visual studio version: VS16, cmake generator: Visual Studio 16 2019"
[vcvarsall.bat] Environment initialized for: 'x64'
=== setting up global environment variables
"Building with platform: x64, build type: Release, visual studio version: VS16, cmake generator: Visual Studio 16 2019"
Cloning into 'php-src'...
remote: Enumerating objects: 986224, done.
remote: Counting objects: 100% (3504/3504), done.
remote: Compressing objects: 100% (1294/1294), done.
remote: Total 986224 (delta 2333), reused 3174 (delta 2197), pack-reused 982720Receiving objects: 100% (986224/986224), 502.88 MiB | 9.73 MiB/s
Receiving objects: 100% (986224/986224), 505.47 MiB | 6.39 MiB/s, done.
Resolving deltas: 100% (765838/765838), done.
Updating files: 100% (22466/22466), done.
Updating files: 100% (3280/3280), done.
Note: switching to 'tags/php-8.2.9'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 3d832da8f5 Update versions for PHP 8.2.9

Fatal error: Uncaught SDK\Exception: The passed CRT 'vc16' doesn't match any availbale for branch '8.2' in F:\php-sdk\lib\php\libsdk\SDK\Config.php:287
Stack trace:
#0 F:\php-snow\bin\phpsdk_deps.php(134): SDK\Config::getCurrentBranchData()
#1 {main}
  thrown in F:\php-snow\lib\php\libsdk\SDK\Config.php on line 287
Rebuilding configure.js
Now run 'configure --help'
PHP Version: 8.2.9

Saving configure options to config.nice.bat

Looking further into the build scripts I found an issue in https://github.com/snowflakedb/pdo_snowflake/blob/master/scripts/_init.bat line 57, where Visual Studio 2019 target version incorectly set as vc16 instead vs16. Correcting this typo fixes the issue. Otherwise build script can't download dependency libraries for VS16 and make corrupted binary.

set cmake_generator=
set vsdir=
set vc_version=
if "%vs_version%"=="VS16" (
    set cmake_generator=Visual Studio 16 2019
    set vsdir=vs16
-    set vc_version=vc16
+    set vc_version=vs16
)
if "%vs_version%"=="VS15" (
    set cmake_generator=Visual Studio 15 2017
    set vsdir=vs15
    set vc_version=vc15

Fix was merged in #366

Latest version 2.0.2 released couple hours ago, which should contain the fix. Thank you for bearing with us !