php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74495 PHP failed to build due to link error LNK2001
Submitted: 2017-04-25 06:25 UTC Modified: 2017-04-27 10:57 UTC
From: seaheart_2006 at 126 dot com Assigned: ab (profile)
Status: Closed Package: Compile Failure
PHP Version: master-Git-2017-04-25 (Git) OS: Windows Server 2012 R2
Private report: No CVE-ID: None
 [2017-04-25 06:25 UTC] seaheart_2006 at 126 dot com
Description:
------------
Environment: Windiows Server 2012 R2 + VS2015 Update 3

I tried to build PHP with master branch latest revision on Windows.It failed to build due to link error LNK2001: unresolved external symbol inflateValidate. This issue can be reproduced form master branch revision 347b880 (https://github.com/php/php-src/commit/347b880ee4081140f488916a40ff6f2765a69e43).

It failed when execute the following link command. Could you please take a look at this? Thanks!
link.exe @"D:\PHP7\phpdev\vc14\x86\src\Release_TS\resp\PHP_GLOBAL_OBJS.txt" @"D:\PHP7\phpdev\vc14\x86\src\Release_TS\resp\BCMATH_GLOBAL_OBJS.txt" @"D:\PHP7\phpdev\vc14\x86\src\Release_TS\resp\CALENDAR_GLOBAL_OBJS.txt" @"D:\PHP7\phpdev\vc14\x86\src\Release_TS\resp\COM_DOTNET_GLOBAL_OBJS.txt" @"D:\PHP7\phpdev\vc14\x86\src\Release_TS\resp\CTYPE_GLOBAL_OBJS.txt" @"D:\PHP7\phpdev\vc14\x86\src\Release_TS\resp\DATE_GLOBAL_OBJS.txt" @"D:\PHP7\phpdev\vc14\x86\src\Release_TS\resp\FILTER_GLOBAL_OBJS.txt" @"D:\PHP7\phpdev\vc14\x86\src\Release_TS\resp\HASH_GLOBAL_OBJS.txt" @"D:\PHP7\phpdev\vc14\x86\src\Release_TS\resp\ICONV_GLOBAL_OBJS.txt" @"D:\PHP7\phpdev\vc14\x86\src\Release_TS\resp\JSON_GLOBAL_OBJS.txt" @"D:\PHP7\phpdev\vc14\x86\src\Release_TS\resp\MYSQLND_GLOBAL_OBJS.txt" @"D:\PHP7\phpdev\vc14\x86\src\Release_TS\resp\PCRE_GLOBAL_OBJS.txt" @"D:\PHP7\phpdev\vc14\x86\src\Release_TS\resp\READLINE_GLOBAL_OBJS.txt" @"D:\PHP7\phpdev\vc14\x86\src\Release_TS\resp\REFLECTION_GLOBAL_OBJS.txt" @"D:\PHP7\phpdev\vc14\x86\src\Release_TS\resp\SESSION_GLOBAL_OBJS.txt" @"D:\PHP7\phpdev\vc14\x86\src\Release_TS\resp\SPL_GLOBAL_OBJS.txt" @"D:\PHP7\phpdev\vc14\x86\src\Release_TS\resp\STANDARD_GLOBAL_OBJS.txt" @"D:\PHP7\phpdev\vc14\x86\src\Release_TS\resp\TOKENIZER_GLOBAL_OBJS.txt" @"D:\PHP7\phpdev\vc14\x86\src\Release_TS\resp\ZIP_GLOBAL_OBJS.txt" @"D:\PHP7\phpdev\vc14\x86\src\Release_TS\resp\ZLIB_GLOBAL_OBJS.txt" @"D:\PHP7\phpdev\vc14\x86\src\Release_TS\resp\LIBXML_GLOBAL_OBJS.txt" @"D:\PHP7\phpdev\vc14\x86\src\Release_TS\resp\DOM_GLOBAL_OBJS.txt" @"D:\PHP7\phpdev\vc14\x86\src\Release_TS\resp\PHAR_GLOBAL_OBJS.txt" @"D:\PHP7\phpdev\vc14\x86\src\Release_TS\resp\SIMPLEXML_GLOBAL_OBJS.txt" @"D:\PHP7\phpdev\vc14\x86\src\Release_TS\resp\XML_GLOBAL_OBJS.txt" @"D:\PHP7\phpdev\vc14\x86\src\Release_TS\resp\WDDX_GLOBAL_OBJS.txt" @"D:\PHP7\phpdev\vc14\x86\src\Release_TS\resp\XMLREADER_GLOBAL_OBJS.txt" @"D:\PHP7\phpdev\vc14\x86\src\Release_TS\resp\XMLWRITER_GLOBAL_OBJS.txt"   OleAut32.Lib     libiconv_a.lib  WS2_32.Lib  edit_a.lib       zlib_a.lib libxml2_a_dll.lib libiconv_a.lib kernel32.lib ole32.lib user32.lib advapi32.lib shell32.lib ws2_32.lib Dnsapi.lib psapi.lib bcrypt.lib D:\PHP7\phpdev\vc14\x86\src\Release_TS\php7ts.dll.res /out:D:\PHP7\phpdev\vc14\x86\src\Release_TS\php7ts.dll  /dll /nodefaultlib:libcmt /def:D:\PHP7\phpdev\vc14\x86\src\Release_TS\php7ts.dll.def /nologo /GUARD:CF /libpath:"D:\PHP7\phpdev\vc14\x86\deps\lib" /NXCOMPAT /DYNAMICBASE  /LTCG:INCREMENTAL /libpath:"..\deps\lib" /libpath:"..\deps\lib" /libpath:"..\deps\lib" /libpath:"..\deps\lib" /libpath:"..\deps\lib"  

Expected result:
----------------
link sccessfully

Actual result:
--------------
link failed with the following error:
php7ts.dll.def : error LNK2001: unresolved external symbol inflateValidate
.\php7ts.lib : fatal error LNK1120: 1 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\link.exe"' : return code '0x460'

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-04-25 11:16 UTC] ab@php.net
-Status: Open +Status: Feedback
 [2017-04-25 11:16 UTC] ab@php.net
Thanks for the report. Please update the deps. Also, with master, please use vc15, and do a clean rebuild of at least ext/zlib, but better full.

Thanks.
 [2017-04-26 06:52 UTC] seaheart_2006 at 126 dot com
Hi, ab@php.net 

Thanks for your reply. It seems the problem should be that:
1. In file ext\zlib\php_zlib.def, it exports function "inflateValidate".
2. In file ext\zlib\php_zlib.h, there is no definition for function "inflateValidate",

I think this is the root cause for the link error LNK2001. Any thought please let me know. Thank you so much!
 [2017-04-26 08:54 UTC] seaheart_2006 at 126 dot com
Hi, ab@php.net 

The "inflateValidate" is added into file ext\zlib\php_zlib.def recently. I looked at the other functions defined in php_zlib.def and found that they’re all defined in x86\deps\include\zlib.h. I then looked at this file and all definitions of functions in php_zlib.def are in here…except "inflateValidate". 

We follow the instruction on https://wiki.php.net/internals/windows/stepbystepbuild to build PHP.

We get the deps from http://windows.php.net/downloads/php-sdk/deps-master-vc14-x86.7z. The deps-master-vc14-x86.7z\deps\include\zlib.h file has no definiton for "inflateValidate". Do we get the deps from wrong place? If yes, where can we get the right deps?
 [2017-04-26 11:40 UTC] ab@php.net
@seaheart_2006 thanks for the further info. You should've seen the notes on the wiki, that 7.2 requires the new SDK. I just made it bold on the wiki page. But anyway, you should be following https://wiki.php.net/internals/windows/stepbystepbuild_sdk_2 instead of the old page. FYI, 7.2 == master. The deps-master-vc14-x86.7z is likely outdated and contains an older zlib version which indeed doesn't have `inflateValidate`. Please follow the new build instructions page and use `phpsdk_deps -u -b master` to fetch the deps, this will get you a suitable set of vc15 dependencies. Alternatively, you can fetch single packages from http://windows.php.net/downloads/php-sdk/deps/vc15/ for now.

Thanks.
 [2017-04-26 12:11 UTC] ab@php.net
FYI, i've upgraded the 7zips, so you can fetch them as well with the today's state, if you need for whatever reasons.

Thanks.
 [2017-04-27 06:52 UTC] seaheart_2006 at 126 dot com
Really appreciate your help! After replace the deps files, I can build PHP successfully. Thanks again!
 [2017-04-27 10:57 UTC] ab@php.net
-Status: Feedback +Status: Closed -Assigned To: +Assigned To: ab
 [2017-04-27 10:57 UTC] ab@php.net
Great, looks like we're done here :)

Thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 08:01:27 2024 UTC