grpc / grpc/grpc

Unable to build PHP PECL extension on Windows.

Open
#35,474 5 comments 1 reaction 2 assignees Claimed by @pawbhard View on GitHub
kind/bug lang/php priority/P2
Dominant language
C++
Stars
45.3k
Forks
11.4k
Avg merge
2d 12h
Merged PRs (30d)
47

Description

### What version of gRPC and what language are you using?
PHP 8.2 x64
gRPC 1.60.0

### What operating system (Linux, Windows,...) and version?
Windows 10 x64

### What runtime / compiler are you using (e.g. python version or version of gcc)
Visual studio 2019 (vs16)

### What did you do?
Please provide either 1) A unit test for reproducing the bug or 2) Specific steps for us to follow to reproduce the bug. If there’s not enough information to debug the problem, gRPC team may close the issue at their discretion. You’re welcome to re-open the issue once you have a reproduction.
I want build the extension for Windows.

1. extract PECL archive of version 1.60.0
2. open CMD x64 build environement
3. run PHP SDK `phpsdk-vs16-x64.bat`
4. run `phpize`
5. run `configure --with-grpc --with-prefix=d:\actions-runner\_work\builder\builder\php-bin`
6. run `nmake`

### What did you expect to see?

I expect the correct building PHP extension DLL.

### What did you see instead?

When this command is exectuted:

```cmd
"cl.exe" /D ZEND_COMPILE_DL_EXT=1 /D COMPILE_DL_GRPC /D GRPC_EXPORTS=1 /DOPENSSL_NO_ASM /D_GNU_SOURCE /DWIN32_LEAN_AND_MEAN /D_HAS_EXCEPTIONS=0 /DNOMINMAX /DGRPC_ARES=0 /D_WIN32_WINNT=0x600 /ID:\actions-runner\_work\builder\builder\ext\2\grpc-1.60.0 /ID:\actions-runner\_work\builder\builder\ext\2\grpc-1.60.0\include /ID:\actions-runner\_work\builder\builder\ext\2\grpc-1.60.0\src\core\ext\upb-gen /ID:\actions-runner\_work\builder\builder\ext\2\grpc-1.60.0\src\core\ext\upbdefs-gen /ID:\actions-runner\_work\builder\builder\ext\2\grpc-1.60.0\src\php\ext\grpc /ID:\actions-runner\_work\builder\builder\ext\2\grpc-1.60.0\third_party\abseil-cpp /ID:\actions-runner\_work\builder\builder\ext\2\grpc-1.60.0\third_party\address_sorting\include /ID:\actions-runner\_work\builder\builder\ext\2\grpc-1.60.0\third_party\boringssl-with-bazel\src\include /ID:\actions-runner\_work\builder\builder\ext\2\grpc-1.60.0\third_party\re2 /ID:\actions-runner\_work\builder\builder\ext\2\grpc-1.60.0\third_party\upb /ID:\actions-runner\_work\builder\builder\ext\2\grpc-1.60.0\third_party\utf8_range /ID:\actions-runner\_work\builder\builder\ext\2\grpc-1.60.0\third_party\xxhash /ID:\actions-runner\_work\builder\builder\ext\2\grpc-1.60.0\third_party\zlib /nologo /I D:\actions-runner\_work\builder\builder\php-dev/include /I D:\actions-runner\_work\builder\builder\php-dev/include/main /I D:\actions-runner\_work\builder\builder\php-dev/include/Zend /I D:\actions-runner\_work\builder\builder\php-dev/include/TSRM /I D:\actions-runner\_work\builder\builder\php-dev/include/ext /D _WINDOWS /D WINDOWS=1 /D ZEND_WIN32=1 /D PHP_WIN32=1 /D WIN32 /D _MBCS /D _USE_MATH_DEFINES /FS /FD /wd4996 /Qspectre /guard:cf /Zc:inline /Zc:__cplusplus /d2FuncCache1 /Zc:wchar_t /MP /LD /MD /Ox /D NDebug /D NDEBUG /GF /D ZEND_DEBUG=0 /D ZTS=1 /I "D:\actions-runner\_work\builder\builder\ext\2\grpc-1.60.0\no\include" /FoD:\actions-runner\_work\builder\builder\ext\2\grpc-1.60.0\x64\Release_TS\src\core\ext\filters\client_channel\lb_policy\grpclb\ /FpD:\actions-runner\_work\builder\builder\ext\2\grpc-1.60.0\x64\Release_TS\src\core\ext\filters\client_channel\lb_policy\grpclb\ /FRD:\actions-runner\_work\builder\builder\ext\2\grpc-1.60.0\x64\Release_TS\src\core\ext\filters\client_channel\lb_policy\grpclb\ /FdD:\actions-runner\_work\builder\builder\ext\2\grpc-1.60.0\x64\Release_TS\src\core\ext\filters\client_channel\lb_policy\grpclb\ /c D:\actions-runner\_work\builder\builder\ext\2\grpc-1.60.0\src\core\ext\filters\client_channel\lb_policy\grpclb\client_load_reporting_filter.cc D:\actions-runner\_work\builder\builder\ext\2\grpc-1.60.0\src\core\ext\filters\client_channel\lb_policy\grpclb\grpclb.cc D:\actions-runner\_work\builder\builder\ext\2\grpc-1.60.0\src\core\ext\filters\client_channel\lb_policy\grpclb\grpclb_balancer_addresses.cc D:\actions-runner\_work\builder\builder\ext\2\grpc-1.60.0\src\core\ext\filters\client_channel\lb_policy\grpclb\grpclb_client_stats.cc D:\actions-runner\_work\builder\builder\ext\2\grpc-1.60.0\src\core\ext\filters\client_channel\lb_policy\grpclb\load_balancer_api.cc
```

I have this error:

```
D:\actions-runner\_work\builder\builder\ext\2\grpc-1.60.0\src\core\ext\filters\client_channel\lb_policy\grpclb\grpclb.cc: fatal error C1041: impossible d'ouvrir la base de données du programme 'D:\actions-runner\_work\builder\builder\ext\2\grpc-1.60.0\x64\Release_TS\src\core\ext\filters\client_channel\lb_policy\grpclb\vc140.idb' ; si plusieurs CL.EXE écrivent dans le même fichier .PDB, utilisez /FS.
```

To solve the ` fatal error C1041`, I have try to add the `/FS` option without change.

### Anything else we should know about your project / environment?

nope

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.