php-src icon indicating copy to clipboard operation
php-src copied to clipboard

Build failure with libxml2 v2.12.4

Open chpock opened this issue 2 years ago • 9 comments

Description

PHP 8.1.27 build from source does not work when linked to libxml2 v2.12.4 on Windows platform.

Resulted in this output:

        rc /nologo /fo C:\src\ec-toolchain\build\i686_win64\php-8.1.27\vc15\x64\x64\Release_TS\php8ts.dll.res /d FILE_DESCRIPTION="\"PHP Script Interpreter\""  /d FILE_NAME="\"php8t
s.dll\"" /d PRODUCT_NAME="\"PHP Script Interpreter\""  /IC:\src\ec-toolchain\build\i686_win64\php-8.1.27\vc15\x64\x64\Release_TS /d MC_INCLUDE="\"C:\src\ec-toolchain\build\i686_win6
4\php-8.1.27\vc15\x64\x64\Release_TS\wsyslog.rc\""  win32\build\template.rc
        ML64.exe /DBOOST_CONTEXT_EXPORT=EXPORT /nologo /Fo C:\src\ec-toolchain\build\i686_win64\php-8.1.27\vc15\x64\x64\Release_TS\Zend\jump_x86_64_ms_pe_masm.obj /c Zend\asm\jump_x
86_64_ms_pe_masm.asm
 Assembling: Zend\asm\jump_x86_64_ms_pe_masm.asm
        ML64.exe /DBOOST_CONTEXT_EXPORT=EXPORT /nologo /Fo C:\src\ec-toolchain\build\i686_win64\php-8.1.27\vc15\x64\x64\Release_TS\Zend\make_x86_64_ms_pe_masm.obj /c Zend\asm\make_x
86_64_ms_pe_masm.asm
 Assembling: Zend\asm\make_x86_64_ms_pe_masm.asm
php8ts.dll.def : error LNK2001: unresolved external symbol __docbDefaultSAXHandler
php8ts.dll.def : error LNK2001: unresolved external symbol docbCreateFileParserCtxt
php8ts.dll.def : error LNK2001: unresolved external symbol docbCreatePushParserCtxt
php8ts.dll.def : error LNK2001: unresolved external symbol docbDefaultSAXHandlerInit
php8ts.dll.def : error LNK2001: unresolved external symbol docbEncodeEntities
php8ts.dll.def : error LNK2001: unresolved external symbol docbFreeParserCtxt
php8ts.dll.def : error LNK2001: unresolved external symbol docbParseChunk
php8ts.dll.def : error LNK2001: unresolved external symbol docbParseDoc
php8ts.dll.def : error LNK2001: unresolved external symbol docbParseDocument
php8ts.dll.def : error LNK2001: unresolved external symbol docbParseFile
php8ts.dll.def : error LNK2001: unresolved external symbol docbSAXParseDoc
php8ts.dll.def : error LNK2001: unresolved external symbol docbSAXParseFile
php8ts.dll.def : error LNK2001: unresolved external symbol initdocbDefaultSAXHandler
php8ts.dll.def : error LNK2001: unresolved external symbol xmlModuleClose
php8ts.dll.def : error LNK2001: unresolved external symbol xmlModuleFree
php8ts.dll.def : error LNK2001: unresolved external symbol xmlModuleOpen
php8ts.dll.def : error LNK2001: unresolved external symbol xmlModuleSymbol
php8ts.dll.def : error LNK2001: unresolved external symbol xmlSAX2InitDocbDefaultSAXHandler
php8ts.dll.def : error LNK2001: unresolved external symbol xmlXPtrEvalRangePredicate
C:\src\ec-toolchain\build\i686_win64\php-8.1.27\vc15\x64\x64\Release_TS\php8ts.lib : fatal error LNK1120: 19 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64\link.exe"' : return code '0x460'
Stop.
make[1]: *** [Makefile:196: build] Error 2

PHP Version

8.1.27

Operating System

Windows 10 x86_64

chpock avatar Feb 14 '24 15:02 chpock

I guess this wasn't comitted to 8.1 because of BC reasons. The thing is though that 8.1 is out of bugfix support. So not sure what to do here.

ndossche avatar Feb 14 '24 16:02 ndossche

8.1.x is under security support and the latest release libxml2 from v2.9.x branch contains multiple vulnerabilities: https://www.cvedetails.com/vulnerability-list/vendor_id-1962/product_id-3311/version_id-1602068/Xmlsoft-Libxml2-2.9.14.html

chpock avatar Feb 14 '24 17:02 chpock

I've raised this issue internally.

ndossche avatar Feb 14 '24 17:02 ndossche

libxml2 2.11.7 should probably be used with PHP 8.1. It is free of security vulnerabilities, and compiles properly (as far as I'm aware, certainly does, on not Windows).

GrahamCampbell avatar Feb 14 '24 20:02 GrahamCampbell

libxml2 2.11.7 should probably be used with PHP 8.1. It is free of security vulnerabilities, and compiles properly (as far as I'm aware, certainly does on not Windows).

Won't work because of the def file symbol exports.

ndossche avatar Feb 14 '24 20:02 ndossche

libxml2 2.11.7 should probably be used with PHP 8.1. It is free of security vulnerabilities, and compiles properly (as far as I'm aware, certainly does, on not Windows).

On Linux x86_64, PHP 8.1.27 can be successfully linked with libxml2 2.12.4 without any issues. It seems to be related to Windows nmake builds.

chpock avatar Feb 14 '24 20:02 chpock

@chpock , libxml2 2.12.4 is vulnerable https://www.cvedetails.com/cve/CVE-2024-25062/

jorgsowa avatar Feb 15 '24 20:02 jorgsowa

@jorgsowa yes, you are right. I filed this issue with libxml2 version, I tried building and faced this error. It should be reproducible with all 2.12.4+ libxml2 version as it is related to deprecated and removed functionality.

chpock avatar Feb 15 '24 21:02 chpock

FWIW, future builds of 8.1 will use libxml 2.9.14 + backported security fixes. I recommend this backporting approach as it will prevent unwanted BC breaks as well. Fully supporting 2.12.x versions for 8.1 on both Windows and Linux falls into bugfixing, and the 8.1 series is out of bugfix support.

ndossche avatar Sep 09 '24 21:09 ndossche