Author |
|
Jan-E
Joined: 09 Mar 2012 Posts: 1281 Location: Amsterdam, NL, EU
|
Posted: Sun 20 Jul '25 10:41 Post subject: |
|
|
Like this:
Code: | N:\php-sdk\win64build.vc17\lib
$ dumpbin /EXPORTS libcurl_a.lib | grep InitSecurityInterface
InitSecurityInterfaceW
InitSecurityInterfaceA
| The 'InitSecurityInterfaceA' has to be there, otherwise php_curl.dll and others will not compile in PHP 8.4.10. |
|
Back to top |
|
tangent Moderator
Joined: 16 Aug 2020 Posts: 392 Location: UK
|
Posted: Sun 20 Jul '25 16:06 Post subject: |
|
|
I've spent some time looking at the CMake build configuration with Curl, and due to its complexity confess I don't fully understand some of the setup. However, the BUILD_STATIC_LIBS option creates a libcurl.lib file (not libcurl_a.lib), whilst the BUILD_SHARED_LIBS option creates a libcurl.dll file along with an import library file libcurl_imp.lib. There's also a BUILD_STATIC_CURL option, which I've tried setting.
Code: | [ 77%] Building C object lib/CMakeFiles/libcurl_object.dir/curlx/winapi.c.obj
winapi.c
[ 77%] Built target libcurl_object
[ 77%] Linking C static library libcurl.lib
[ 77%] Built target libcurl_static
[ 77%] Building C object lib/CMakeFiles/libcurl_shared.dir/dllmain.c.obj
dllmain.c
...
...
[ 80%] Linking C shared library libcurl.dll
[ 80%] Built target libcurl_shared
[ 80%] Generating tool_hugehelp.c
[ 80%] Building C object src/CMakeFiles/curl.dir/config2setopts.c.obj
config2setopts.c
...
...
-- Installing: C:/Apache24/lib/libcurl.lib
-- Installing: C:/Apache24/lib/libcurl_imp.lib
-- Installing: C:/Apache24/bin/libcurl.dll
-- Installing: C:/Apache24/bin/curl.exe
-- Installing: C:/Apache24/bin/curl-config |
Dumpbin output from libcurl.lib /exports is minimal:
Code: | C:\Development\apache24\build>dumpbin /exports c:\Apache24\lib\libcurl.lib
Microsoft (R) COFF/PE Dumper Version 14.44.35207.1
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file c:\Apache24\lib\libcurl.lib
File Type: LIBRARY
Summary
3F9 .bss
1A418 .chks64
A21 .data
73E8 .debug$S
20C7 .drectve
9E88 .pdata
19869 .rdata
9BEB2 .text$mn
E .voltbl
EEFC .xdata |
However, if I use the /symbols option, it does pick up this external reference (UNICODE not ANSI):
Code: | C:\Development\apache24\build>dumpbin /symbols c:\Apache24\lib\libcurl.lib | grep -i InitSecurity
015 00000000 UNDEF notype External | __imp_InitSecurityInterfaceW |
Similarly for libcurl.dll
Code: | C:\Development\apache24\build>dumpbin /imports c:\Apache24\bin\libcurl.dll | grep -i InitSecurity
20 InitSecurityInterfaceW |
and understand this is provided by Secur32.lib/Secur32.dll. There is no reference to InitSecurityInterfaceA (ANSI)
Looking at the CMake configuration for HTTPD, by default it picks up on the Curl import library:
Code: | -- Curl include directory........... : C:/Apache24/include
-- Curl libraries .................. : C:/Apache24/lib/libcurl_imp.lib |
However, it's only mod_md.so that requires Curl, and by default it seems to link to libcurl.dll (confirmed using dependencies.exe tool).
If I change the CMakeLists.txt file to choose libcurl.lib over libcurl_imp.lib, then the HTTPD build of mod_md.so fails:
Code: | [ 65%] Linking C shared library mod_md.so
LINK: command "C:\PROGRA~2\MICROS~2\2022\BUILDT~1\VC\Tools\MSVC\1444~1.352\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\mod_md.dir\objects1.rsp /out:mod_md.so /implib:mod_md.lib /pdb:C:\Development\apache24\build\httpd\mod_md.pdb /dll /version:0.0 /base:@C:/Development/apache24/build/httpd/BaseAddr.ref,mod_md.so /machine:x64 /INCREMENTAL:NO C:\Apache24\lib\libssl.lib C:\Apache24\lib\libcrypto.lib C:\Apache24\lib\libcurl.lib C:\Apache24\lib\jansson.lib mod_watchdog.lib libhttpd.lib C:\Apache24\lib\libapr-1.lib C:\Apache24\lib\libaprutil-1.lib C:\Apache24\lib\apr_ldap-1.lib ws2_32.lib mswsock.lib C:\Apache24\lib\pcre2-8.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST:EMBED,ID=2" failed (exit code 1120) with the following output:
Creating library mod_md.lib and object mod_md.exp
md_curl.c.obj : error LNK2019: unresolved external symbol __imp_curl_global_init referenced in function md_curl_init
etc... |
so the CMake build of HTTPD is evidently geared around using shared libraries...
Either way, overall, I'm guessing this confirms your concerns over the latest Curl static library. |
|
Back to top |
|
Jan-E
Joined: 09 Mar 2012 Posts: 1281 Location: Amsterdam, NL, EU
|
Posted: Sun 20 Jul '25 16:48 Post subject: |
|
|
Thanks. Some versions of dumpbin do not support /exports anymore. And apparently CMake creates the static and shared lib's for libcurl with different names.
Could you check the libs for curl 8.14.1 to see if something changed with respect to the InitSecurityInterface definitions? |
|
Back to top |
|
tangent Moderator
Joined: 16 Aug 2020 Posts: 392 Location: UK
|
Posted: Sun 20 Jul '25 19:31 Post subject: |
|
|
They have changed.
The InitSecurityInterface entry for libcurl.lib differs, whilst there isn't one in libcurl.dll.
Code: | C:\Development\apache24\build>c:\Apache24\bin\curl -V
curl 8.14.1 (Windows) libcurl/8.14.1 (OpenSSL/3.5.1) Schannel zlib/1.3.1 brotli/1.1.0 nghttp2/1.66.0
Release-Date: 2025-06-04
Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns ldap ldaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp ws wss
Features: alt-svc AsynchDNS brotli HSTS HTTP2 HTTPS-proxy IPv6 Kerberos Largefile libz MultiSSL NTLM SPNEGO SSL SSPI threadsafe TLS-SRP Unicode UnixSockets
C:\Development\apache24\build>dumpbin /symbols c:\Apache24\lib\libcurl.lib | grep -i InitSecurity
05A 00000000 SECT18 notype External | ??_C@_0BH@DCJCBOGF@InitSecurityInterfaceW@ (`string')
C:\Development\apache24\build>dumpbin /imports c:\Apache24\bin\libcurl.dll | grep -i InitSecurity
|
The code has evidently changed in the curl_sspi.c module.
Curl 8.14.1
Code: | C:\Development\apache24\src\curl-8.14.1>c:\bin\find . -type f -exec grep -i InitSecurityInterface {} ; -ls
typedef PSecurityFunctionTable (APIENTRY *INITSECURITYINTERFACE_FN)(VOID);
# define SECURITYENTRYPOINT L"InitSecurityInterfaceW"
# define SECURITYENTRYPOINT "InitSecurityInterfaceW"
# define SECURITYENTRYPOINT "InitSecurityInterfaceA"
INITSECURITYINTERFACE_FN pInitSecurityInterface;
/* Get address of the InitSecurityInterfaceA function from the SSPI dll */
pInitSecurityInterface =
CURLX_FUNCTION_CAST(INITSECURITYINTERFACE_FN,
if(!pInitSecurityInterface)
Curl_pSecFn = pInitSecurityInterface();
16409 8 -rw-rw-rw- 1 user group 7191 Jun 04 06:42 .\\lib\\curl_sspi.c
|
Curl 8.15.0
Code: | C:\Development\apache24\src\curl-8.15.0>c:\bin\find . -type f -exec grep -i InitSecurityInterface {} ; -ls
Curl_pSecFn = InitSecurityInterfaceW();
Curl_pSecFn = InitSecurityInterface();
31550 6 -rw-rw-rw- 1 user group 5778 Jul 16 07:22 .\\lib\\curl_sspi.c
|
|
|
Back to top |
|
Jan-E
Joined: 09 Mar 2012 Posts: 1281 Location: Amsterdam, NL, EU
|
Posted: Mon 21 Jul '25 0:16 Post subject: |
|
|
The ‘find’ you are using in the previous post ignores the ifdef’s around the statements. See the changes in curl_sspi.c int this commit:
https://github.com/curl/curl/commit/0d71b18153c8edb996738f8a362373fc72d0013b
In the description of the commit:
Quote: | - replace dynamic `InitSecurityInterface()` call with early binding and
link `secur32` system DLL.
The library and function are available in all supported curl Windows
targets, meaning WinXP or newer. Add small hack for mingw32ce to
make it build. |
The library and function are available in secur32.lib. Without including that lib in a VS-project you will runinro link errors. |
|
Back to top |
|
tangent Moderator
Joined: 16 Aug 2020 Posts: 392 Location: UK
|
Posted: Fri 25 Jul '25 15:54 Post subject: |
|
|
Build dependency updates to include latest HTTPD 2.4.65 release:
CURL (8.15.0))
HTTPD (2.4.65)
LIBXML2 (2.14.5)
Other than release version details, there are no changes to the batch file build logic from before. |
|
Back to top |
|
Jan-E
Joined: 09 Mar 2012 Posts: 1281 Location: Amsterdam, NL, EU
|
Posted: Fri 25 Jul '25 16:18 Post subject: |
|
|
Could you share the generated static and shared files (lib. dll, pdb if any) for curl 8.15.0, so I can test if they work for PHP? |
|
Back to top |
|
tangent Moderator
Joined: 16 Aug 2020 Posts: 392 Location: UK
|
Posted: Fri 25 Jul '25 17:25 Post subject: |
|
|
I've zipped up the following three curl 8.15.0 files, built with the CMake script, as curl-8.15.0-libs.zip
23/07/2025 20:27 762,368 libcurl.dll
23/07/2025 20:27 3,566,236 libcurl.lib
23/07/2025 20:27 21,338 libcurl_imp.lib
The file is downloadable from Limewire at https://limewire.com/d/dsdMz#UsuGPrtThH (this link will expire in 7 days).
Note, the CMake build HowTo currently doesn't create PDB files.
I'd be surprised if the static library works for you, as you say, because in Curl 8.15.0 the developers have chosen to rework the InitSecurityInterface() functionality to need secur32.lib.
I did try hacking the HTTPD CMakeLists.txt file, to link mod_md.so statically with libcurl.lib, and although that seemed to work, dumpbin shows the CMake build process still insists on including libcurl.dll, presumably through the import library.
Basically, the CMake build process for Windows favours a shared library approach. |
|
Back to top |
|
Jan-E
Joined: 09 Mar 2012 Posts: 1281 Location: Amsterdam, NL, EU
|
Posted: Fri 25 Jul '25 18:02 Post subject: |
|
|
Thanks. Downloaded. |
|
Back to top |
|
tanquang
Joined: 21 Mar 2020 Posts: 68 Location: Vietnam
|
Posted: Mon 04 Aug '25 19:59 Post subject: |
|
|
Can you add the wintty.exe build code? |
|
Back to top |
|
tangent Moderator
Joined: 16 Aug 2020 Posts: 392 Location: UK
|
Posted: Wed 06 Aug '25 22:10 Post subject: |
|
|
I've duly updated the build script to support wintty.exe, by patching the CMakeLists.txt file to include suitable build directives.
The HTTPD file set does include a Windows make file for wintty.exe, but this is incompatible with the CMake build (APR) file locations. |
|
Back to top |
|
tanquang
Joined: 21 Mar 2020 Posts: 68 Location: Vietnam
|
Posted: Thu 07 Aug '25 17:44 Post subject: |
|
|
tangent wrote: | I've duly updated the build script to support wintty.exe, by patching the CMakeLists.txt file to include suitable build directives.
The HTTPD file set does include a Windows make file for wintty.exe, but this is incompatible with the CMake build (APR) file locations. |
This script code:
Code: | ...
rem Patch CMakeLists.txt to add LUA_COMPAT_5_3 to compile options.
rem
perl -pi.bak -e ^" ^
s~( LUA_BUILD_AS_DLL ^)(^\^)^)~${1}LUA_COMPAT_5_3 ${2}~; ^
^" CMakeLists.txt
... |
As far as I understand it seems to be trying to replace "LUA_COMPAT_ALL" with "LUA_COMPAT_5_3" in this line of code:
Code: | ...
target_compile_definitions ( libluadll PRIVATE _CRT_SECURE_NO_WARNINGS LUA_BUILD_AS_DLL LUA_COMPAT_ALL )
... |
But it seems to have a syntax error so the replacement fails, in fact it still uses "LUA_COMPAT_ALL" when compiling.
P/s: I tried with both files "CMakeLists.txt for LUA 5.3" and "CMakeLists.txt for LUA 5.4", all failed to be replaced. |
|
Back to top |
|
tangent Moderator
Joined: 16 Aug 2020 Posts: 392 Location: UK
|
Posted: Thu 07 Aug '25 22:14 Post subject: |
|
|
Thanks for pointing this out.
This edit entry is a hangover from previous versions of CMakeLists.txt that were used to build older versions of LUA.
In fact the edit is trying to change the line:
target_compile_definitions ( libluadll PRIVATE _CRT_SECURE_NO_WARNINGS LUA_BUILD_AS_DLL ) totarget_compile_definitions ( libluadll PRIVATE _CRT_SECURE_NO_WARNINGS LUA_BUILD_AS_DLL LUA_COMPAT_5_3 ) which now fails since both CMakeLists.txt files referenced on PASTEBIN contain the line
target_compile_definitions ( libluadll PRIVATE _CRT_SECURE_NO_WARNINGS LUA_BUILD_AS_DLL LUA_COMPAT_ALL ) Since the entry is benign, I'll remove it from the LUA build section next time the CMake HowTo gets updated.
Similarly, there's still an edit in the HTTPD section specifically for version 2.4.62, which is now several releases behind the curve. That will get removed at some point too... |
|
Back to top |
|
tanquang
Joined: 21 Mar 2020 Posts: 68 Location: Vietnam
|
Posted: Fri 08 Aug '25 1:05 Post subject: |
|
|
tangent wrote: | Thanks for pointing this out.
This edit entry is a hangover from previous versions of CMakeLists.txt that were used to build older versions of LUA.
In fact the edit is trying to change the line:
target_compile_definitions ( libluadll PRIVATE _CRT_SECURE_NO_WARNINGS LUA_BUILD_AS_DLL ) totarget_compile_definitions ( libluadll PRIVATE _CRT_SECURE_NO_WARNINGS LUA_BUILD_AS_DLL LUA_COMPAT_5_3 ) which now fails since both CMakeLists.txt files referenced on PASTEBIN contain the line
target_compile_definitions ( libluadll PRIVATE _CRT_SECURE_NO_WARNINGS LUA_BUILD_AS_DLL LUA_COMPAT_ALL ) Since the entry is benign, I'll remove it from the LUA build section next time the CMake HowTo gets updated.
Similarly, there's still an edit in the HTTPD section specifically for version 2.4.62, which is now several releases behind the curve. That will get removed at some point too... |
As far as I checked in the source code of lua 5.4.8, LUA_COMPAT_ALL is no longer declared/used anywhere in the source code, while LUA_COMPAT_5_3 is still found in the luaconf.h file. So I'm not sure if LUA_COMPAT_ALL is still supported on lua 5.4.8 (but it doesn't cause errors when compiling). |
|
Back to top |
|
tanquang
Joined: 21 Mar 2020 Posts: 68 Location: Vietnam
|
Posted: Fri 08 Aug '25 1:12 Post subject: |
|
|
This code:
Code: | ...
if /i "%CURL_USE_OPENSSL%" == "ON" (
rem Patch lib\url.c to force use of native CA store on Windows.
rem
perl -pi.bak -0777 -Mopen=OUT,:raw -e ^" ^
s~(return result;\n#endif$^)\n }~${1} \n#if defined(USE_WIN32_CRYPTO^)\n^
/* Mandate Windows CA store to be used */\n^
if(\x21set-\x3Essl.primary.CAfile \x26\x26 \x21set-\x3Essl.primary.CApath^) {\n^
/* User and environment did not specify any CA file or path.\n^
*/\n^
set-\x3Essl.native_ca_store = TRUE;\n^
}\n#endif\n }~smg; ^
^" lib\url.c
) else (
rem Remove above lib\url.c patch if present.
rem
perl -pi.bak -0777 -Mopen=OUT,:raw -e ^" ^
s~(return result;\n#endif^) \n.+native_ca_store = TRUE;\n }\n#endif\n~${1}\n~smg; ^
^" lib\url.c
)
... |
Also didn't work as expected, it didn't insert the code behind as expected (of course when "%CURL_USE_OPENSSL%" == "ON").
And this code:
Code: | ...
if /i "%CURL_USE_OPENSSL%" == "ON" if /i "%CURL_DEFAULT_SSL_BACKEND%" == "SCHANNEL" (
rem Patch CMakeLists.txt to add a compiler definition for a default SSL backend of Schannel.
rem
perl -pi.bak -e ^" ^
s~(USE_OPENSSL ON\^)^)\n~${1} \n add_definitions(-DCURL_DEFAULT_SSL_BACKEND=\x22schannel\x22^)\n~m; ^
^" CMakeLists.txt
) else (
rem Remove above CMakeLists.txt patch if present.
rem
perl -pi.bak -e ^" ^
s~(USE_OPENSSL ON\^)^) \n~${1}\n~m; ^
s~[ ]+add_definitions.+CURL_DEFAULT_SSL_BACKEND=.*\n~~m; ^
^" CMakeLists.txt
)
... |
Then it worked "beyond" the expected level. It inserted:
Code: |
add_definitions(-DCURL_DEFAULT_SSL_BACKEND="schannel")
|
Incorrectly into AMIGA. I did a different comparison here. |
|
Back to top |
|