Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nmake on windows cmd is throwing error when compiling memcache extension with php-src #117

Open
aravindjayanthi98 opened this issue Jan 16, 2025 · 3 comments

Comments

@aravindjayanthi98
Copy link

Environment
OS: Windows servercore 2022 ( on docker)
PHP: 8.4.2 (using source code), NTS, x64
MongoDB extension: 1.20.1 (Downloaded from pecl repository)

Steps:
I have successfully compiled the php-src along with some extensions (like redis, raphf) using the steps mentioned in this page(https://wiki.php.net/internals/windows/stepbystepbuild_sdk_2).
Now, when I add the memcache(version: 8.2) extension by download the src code here. The configure command runs file but when I run nmake I get the following error:

internal_functions.c
C:\php-sdk\phpdev\vs17\x64\php-8.4.2-src\ext\memcache\src\memcache_pool.h(38): fatal error C1083: Cannot open include file: 'win32/php_stdint.h': No such file or directory
NMAKE : fatal error U1077: '"cl.exe" /D _USRDLL /D PHP_EXPORTS /D LIBZEND_EXPORTS /D TSRM_EXPORTS /D SAPI_EXPORTS /D WINVER=0x0602 /D COMPILE_DL_GD /D COMPILE_DL_OPENSSL /D COMPILE_DL_FILEINFO /D COMPILE_DL_INTL /D COMPILE_DL_MONGODB /D COMPILE_DL_ZIP /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 /I "..\deps\include" /DHAVE_CURL_EASY_H=1 /DHAVE_OPENSSL_SSL_H=1 /D CURL_STATICLIB /D PHP_CURL_EXPORTS=1 /Iext/date/lib /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 /DHAVE_TIMELIB_CONFIG_H=1 /wd4244 /I "ext/hash/sha3/generic64lc" /DHAVE_KECCAKHASH_H=1 /DKeccakP200_excluded /DKeccakP400_excluded /DKeccakP800_excluded /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 /I "..\deps\include" /DHAVE_ICONV_H=1 /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 /D PHP_ICONV_EXPORTS /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 /D HAVE_MEMCACHE_SESSION=1 -Iext/pcre/pcre2lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 /D HAVE_CONFIG_H /D HAVE_MEMMOVE /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 /Iext\raphf /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 /DHAVE_WINSOCK_H=1 /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 /D PHP_SOCKETS_EXPORTS=1 /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 /I "..\deps\include" /DHAVE_SQLITE3_H=1 /DHAVE_SQLITE3EXT_H=1 /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 /I "ext/date/lib" /DHAVE_TIMELIB_CONFIG_H=1 /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 /D ZLIB_EXPORTS /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 /I "..\deps\include\libxml2" /DHAVE_LIBXML_PARSER_H=1 /DHAVE_LIBXML_TREE_H=1 /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 /D LIBXML_STATIC /D LIBXML_STATIC_FOR_DLL /D HAVE_WIN32_THREADS /I "..\deps\include\libxml2" /DHAVE_LIBXML_PARSER_H=1 -Iext/dom/lexbor /D LEXBOR_STATIC /D LIBXML_STATIC /DHAVE_MBSTRING_H=1 -Iext/mbstring -Iext/mbstring/libmbfl -Iext/mbstring/libmbfl/mbfl /D HAVE_STRICMP /D MBFL_DLL_EXPORT=1 /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 /I "..\deps\include" /DHAVE_SQLITE3_H=1 /DHAVE_SQLITE3EXT_H=1 /W3 /I "..\deps\include" /DHAVE_ZLIB_H=1 /I "ext\pecl_http..\hash" /DHTTP_HAVE_PHP_HASH_H=1 /DHAVE_CURL_CURL_H=1 /DHAVE_OPENSSL_CRYPTO_H=1 /Iext\pecl_http /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 /D PHP_SESSION=1 /I "..\deps\include\libxml2" /DHAVE_LIBXML_TREE_H=1 /D LIBXML_STATIC /D PHP_SIMPLEXML_EXPORTS /I "..\deps\include\libxml2" /DHAVE_LIBXML_PARSER_H=1 /DHAVE_LIBXML_TREE_H=1 /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 /D LIBXML_STATIC /I "..\deps\include\libxml2" /DHAVE_LIBXML_PARSER_H=1 /DHAVE_LIBXML_TREE_H=1 /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 /D LIBXML_STATIC /I "..\deps\include\libxml2" /DHAVE_LIBXML_PARSER_H=1 /DHAVE_LIBXML_TREE_H=1 /D LIBXML_STATIC /I "..\deps\include\libxml2" /DHAVE_LIBXML_XMLWRITER_H=1 /D LIBXML_STATIC /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 /D _USE_MATH_DEFINES /FD /wd4996 /RTC1 /Zc:__cplusplus /d2FuncCache1 /Zc:preprocessor /Zc:wchar_t /LDd /MDd /Od /D _DEBUG /D ZEND_DEBUG=1 /Zi /I "..\deps\include" /D FD_SETSIZE=256 /FpC:\php\Debug\main\ /FRC:\php\Debug\main\ /FdC:\php\Debug\main\ /c main\internal_functions.c /FoC:\php\Debug\main\internal_functions.obj' : return code '0x2'
Stop.
The command 'cmd /S /C configure --enable-object-out-dir=%PHP_OUT_DIR% --with-php-build=..\deps %PHP_PARAMETERS% && nmake' returned a non-zero code: 2

Is there a way to resolve this issue? I am not able to find anything on the internet to fix this one.

Can anyone please help me why I am getting this issue and what can I do to resolve it?

PS: I have tried using the prebuild DLL file to help me run the extension but I am getting the error: PHP Startup: Unable to load dynamic library 'php_memcache.dll'. I think this might be because I configured the php with (--enable-debug) during build, I might be wrong. If there is a solution for this also please let me know, it would a huge help to me.

Thanks in advance.

@nono303
Copy link

nono303 commented Jan 17, 2025

Hi @aravindjayanthi98

fatal error C1083: Cannot open include file: 'win32/php_stdint.h': No such file or directory

your issue is related to #80

-#include <win32/php_stdint.h>
+#include <main/php_stdint.h> 

Depending on your MSVC version, make sure your you have the latest src for pecl-memcache (cf. 7e7fb52)

Otherwise, you can find all compiled binaries here https://github.com/nono303/PHP-memcache-dll

@aravindjayanthi98
Copy link
Author

Hello @nono303

Thank you very much for helping out, I checked out to the commit you have mentioned as I am using VS2022, it worked in my build. I am not sure when the next version is gonna release but once its released I'll update my script to use the release version.

Just one more thing, is there any solution for the error: PHP Startup: Unable to load dynamic library. I am getting this error if I use DLL files to add the extension. Is this issue happening because I am compiling the php in debug mode?

@nono303
Copy link

nono303 commented Jan 17, 2025

I checked out to the commit you have mentioned

Personally I compile with latest main commit and apply a big patch related to some open PR

I am not sure when the next version is gonna release

... nobody knows ;)

Is this issue happening because I am compiling the php in debug mode?

I don't think so.
All PHP Startup: Unable to load dynamic library issues on my builds are always related to bad version (x86 / x64, TS / NTS, vc15 / vs16 / vs17, SSE2 / AVX) or confusion (uncorrelated php & pecl_memcache versions)
U can have a look at https://github.com/nono303/PHP-memcache-dll?tab=readme-ov-file#how-to-get-the-good-version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants