Closed rbich closed 11 months ago
Did you re-run buildconf
before configuring?
I've tried 3 different ways to compile:
I tried to compile only the extension .dll by using the following steps:
After failing with the steps from number 1 found the appveyor.yml file which has a "build_script:" section. I had to modify it lightly but ended up with the following series of prompts:
"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x64 -vcvars_ver=
wget https://github.com/OSTC/php-sdk-binary-tools/archive/php-sdk-2.2.0.zip --no-check-certificate -q -O php-sdk-binary-tools-php-sdk-2.2.0.zip
7z x -y php-sdk-binary-tools-php-sdk-2.2.0.zip -oC:\projects
move C:\projects\php-sdk-binary-tools-php-sdk-2.2.0 C:\projects\php-sdk
C:\projects\php-sdk\bin\phpsdk_setvars.bat
git clone https://github.com/php/php-src C:\projects\php-src -b PHP-8.1 --depth=1
mkdir C:\projects\php-src\ext\pmmpthread
xcopy C:\projects\pmmpthread C:\projects\php-src\ext\pmmpthread /s /e /y /q
phpsdk_deps -u -t vs16 -b 8.1 -a x64 -f -d C:\projects\php-src\deps
wget http://www.mirrorservice.org/sites/sources.redhat.com/pub/pthreads-win32/pthreads-w32-2-9-1-release.zip -q
7z x -y pthreads-w32-2-9-1-release.zip -oC:\projects\pthreads-w32
copy C:\projects\pthreads-w32\Pre-built.2\include\pthread.h C:\projects\php-src\deps\include\pthread.h
copy C:\projects\pthreads-w32\Pre-built.2\include\sched.h C:\projects\php-src\deps\include\sched.h
copy C:\projects\pthreads-w32\Pre-built.2\include\semaphore.h C:\projects\php-src\deps\include\semaphore.h
copy C:\projects\pthreads-w32\Pre-built.2\lib\x64\pthreadVC2.lib C:\projects\php-src\deps\lib\pthreadVC2.lib
cd C:\projects\php-src
buildconf.bat
configure.bat --disable-all --enable-cli --enable-zts --with-pmmpthread=shared --enable-sockets --with-prefix=C:\projects\pmmpthread\bin --with-php-build=deps --enable-ipv6
nmake
nmake install
cd C:\projects\pmmpthread\bin
copy C:\projects\pthreads-w32\Pre-built.2\dll\x64\pthreadVC2.dll C:\projects\pmmpthread\bin\pthreadVC2.dll
As you see, I spend quite some hours trying to build the DLL with no success with all 3 options I tried. Number 2 looked very promising as it run very smoothly and I even ended up with a DLL but as written above I can't load it due to the "The procedure entry point socket_ce could not be located" error.
Any advice (or a simply windows build script) is greatly appreciated. I'm sure a simple windows build script would be appreciated for all the windows users out there too.
Best
You need to compile against a TS build of PHP. You also may need php_sockets.dll
I did compile against a TS build of PHP and also have a TS version installed. php_sockets.dll is also included in the ext folder (it's a standard Xampp installation).
PHP 8.1.12 (cli) (built: Oct 25 2022 18:16:21) (ZTS Visual C++ 2019 x64) Copyright (c) The PHP Group Zend Engine v4.1.12, Copyright (c) Zend Technologies with Zend OPcache v8.1.12, Copyright (c), by Zend Technologies with Xdebug v3.2.1, Copyright (c) 2002-2023, by Derick Rethans
Make sure you enabled the sockets extension in php.ini
.
The extension is primarily built in in-tree mode (your 2nd method), as it's distributed as part of PMMP's custom PHP-Binaries. The out-of-tree build (your 1st method) hasn't been tested for as long as I've been maintaining the extension, so I have no idea if it works at all.
I do have the sockets extension loaded/enabled. I didn't know about the https://github.com/pmmp/PHP-Binaries project, will try this one out now. Thanks!
First of all thanks for your effort to port this to the latest PHP versions (8+)! I've tried to compile the windows version of this for my current PHP version (8.1) and after changing a couple of files I got it working until some linker issues that I don't know how to resolve.
Is there a plan to include pre-built dll files in the releases? That would save a lot of time for all users using Windows.
These are the errors I'm facing at the moment: C:\phpext\ext-pmmpthread-6.0.12 $ nmake
Microsoft (R) Program Maintenance Utility Version 14.36.32537.0 Copyright (C) Microsoft Corporation. All rights reserved.
NMAKE : warning U4004: too many rules for target 'C:\phpext\ext-pmmpthread-6.0.12\x64\Release_TS\worker.obj' "link.exe" @"C:\phpext\ext-pmmpthread-6.0.12\x64\Release_TS\resp\PMMPTHREAD_GLOBAL_OBJS.txt" C:\phpext\php-8.1.12-devel-vs16-x64\lib\php8ts.lib pthreadVC3.lib php_sockets.lib kernel32.lib ole32.lib user32.lib advapi32.lib shell32.lib ws2_32.lib Dnsapi.lib psapi.lib bcrypt.lib C:\phpext\ext-pmmpthread-6.0.12\x64\Release_TS\php_pmmpthread.dll.res /out:C:\phpext\ext-pmmpthread-6.0.12\x64\Release_TS\php_pmmpthread.dll /dll /nologo /GUARD:CF /d2:-AllowCompatibleILVersions /libpath:"\"C:\phpext\ext-pmmpthread-6.0.12\no\lib\"" /libpath:"C:\phpext\php-8.1.12-devel-vs16-x64\lib\;C:\phpext\php-8.1.12-devel-vs16-x64" /libpath:"yes" /libpath:C:\phpext\php-8.1.12-devel-vs16-x64\lib C:\phpext\ext-pmmpthread-6.0.12\x64\Release_TS\worker.obj : warning LNK4042: object specified more than once; extras ignored Creating library C:\phpext\ext-pmmpthread-6.0.12\x64\Release_TS\php_pmmpthread.lib and object C:\phpext\ext-pmmpthread-6.0.12\x64\Release_TS\php_pmmpthread.exp object.obj : error LNK2019: unresolved external symbol pmmpthread_worker_data_alloc referenced in function pmmpthread_worker_ctor object.obj : error LNK2019: unresolved external symbol pmmpthread_worker_data_free referenced in function pmmpthread_base_free object.obj : error LNK2019: unresolved external symbol pmmpthread_worker_get_gc_extra referenced in function pmmpthread_base_gc routine.obj : error LNK2019: unresolved external symbol pmmpthread_worker_sync_collectable_tasks referenced in function pmmpthread_join store.obj : error LNK2001: unresolved external symbol pmmpthread_worker_sync_collectable_tasks routine.obj : error LNK2019: unresolved external symbol pmmpthread_worker_next_task referenced in function pmmpthread_routine routine.obj : error LNK2019: unresolved external symbol pmmpthread_worker_add_garbage referenced in function pmmpthread_routine worker.obj : error LNK2019: unresolved external symbol pmmpthread_worker_task_queue_size referenced in function zim_pmmp_thread_Worker_getStacked@@16 worker.obj : error LNK2019: unresolved external symbol pmmpthread_worker_add_task referenced in function zim_pmmp_thread_Worker_stack@@16 worker.obj : error LNK2019: unresolved external symbol pmmpthread_worker_dequeue_task referenced in function zim_pmmp_thread_Worker_unstack@@16 worker.obj : error LNK2019: unresolved external symbol pmmpthread_worker_collect_tasks referenced in function zim_pmmp_thread_Worker_collect@@16 pool.obj : error LNK2001: unresolved external symbol pmmpthread_worker_collect_tasks worker.obj : error LNK2019: unresolved external symbol pmmpthread_worker_collect_function referenced in function zim_pmmp_thread_Worker_collect@@16 pool.obj : error LNK2001: unresolved external symbol pmmpthread_worker_collect_function C:\phpext\ext-pmmpthread-6.0.12\x64\Release_TS\php_pmmpthread.dll : fatal error LNK1120: 11 unresolved externals NMAKE : fatal error U1077: '"link.exe" @"C:\phpext\ext-pmmpthread-6.0.12\x64\Release_TS\resp\PMMPTHREAD_GLOBAL_OBJS.txt" C:\phpext\php-8.1.12-devel-vs16-x64\lib\php8ts.lib pthreadVC3.lib php_sockets.lib kernel32.lib ole32.lib user32.lib advapi32.lib shell32.lib ws2_32.lib Dnsapi.lib psapi.lib bcrypt.lib C:\phpext\ext-pmmpthread-6.0.12\x64\Release_TS\php_pmmpthread.dll.res /out:C:\phpext\ext-pmmpthread-6.0.12\x64\Release_TS\php_pmmpthread.dll /dll /nologo /GUARD:CF /d2:-AllowCompatibleILVersions /libpath:"\"C:\phpext\ext-pmmpthread-6.0.12\no\lib\"" /libpath:"C:\phpext\php-8.1.12-devel-vs16-x64\lib\;C:\phpext\php-8.1.12-devel-vs16-x64" /libpath:"yes" /libpath:C:\phpext\php-8.1.12-devel-vs16-x64\lib' : return code '0x460' Stop.