Edit report at https://bugs.php.net/bug.php?id=62651&edit=1

 ID:                 62651
 User updated by:    carlo dot pastorino at neologica dot it
 Reported by:        carlo dot pastorino at neologica dot it
 Summary:            Extensions out of PHP source tree does not build
                     anymore (link problem)
-Status:             Feedback
+Status:             Open
 Type:               Bug
 Package:            Compile Failure
 Operating System:   Windows 7
 PHP Version:        5.4.5
 Block user comment: N
 Private report:     N

 New Comment:

Tested with phpize too and I obtained the same result. By the way the "phpize" 
way is simply 
not feasible for me/us and, if phpize makes it, Visual Studio should be able to 
make it too, 
right ?.

Please find my "phpize" project here : 
http://www.neologica.it/test_ext_phpize.7z

I must admint I never used phpize before on windows and I didn't think it was 
fully Windows 
compatible, however here is what I did (everything is provided with the 7z 
archive):

1] Created the "test" folder under "php_5.4/include/ext"
2] Moved my source files in this folder
3] Created the config.w32 file 
4] Opened the Visual Studio 2008 command prompt and moved to this folder
5] ..\..\..\phpize.bat
6] configure.bat --enable-test (here I had to add "bison.exe" location to my 
"PATH" and in 
the configure.js file I needed to add PHP_PGI and PHP_PGO definition)
7] nmake

and the result was the same as before.

Microsoft (R) Incremental Linker Version 9.00.30729.01
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:test_class.exe
/out:Release_TS\php_test.dll
/dll
/libpath:C:\php_5.4\lib\;C:\php_5.4
Release_TS\php_5.4\include\ext\test\test_class.obj
Release_TS\php_5.4\include\ext\test\test_ext.obj
C:\php_5.4\lib\php5ts.lib
kernel32.lib
ole32.lib
user32.lib
advapi32.lib
shell32.lib
ws2_32.lib
Dnsapi.lib
Release_TS\php_test.dll.res
   Creating library Release_TS\php_test.lib and object Release_TS\php_test.exp
test_class.obj : error LNK2019: unresolved external symbol "__declspec(dllimport
) char const * (__cdecl* zend_new_interned_string)(char const *,int,int,void * *
 *)" (__imp_?zend_new_interned_string@@3P6APBDPBDHHPAPAPAX@ZA) referenced in fun
ction "void __cdecl init_test_class(void * * *)" (?init_test_class@@YAXPAPAPAX@Z
)
Release_TS\php_test.dll : fatal error LNK1120: 1 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN
\cl.exe"' : return code '0x2'
Stop.

Thank you in advance,
Carlo Pastorino


Previous Comments:
------------------------------------------------------------------------
[2012-07-24 10:11:20] paj...@php.net

This callback is part of the build (while interned string are only implemented 
in 
NTS).

Please check a build of your ext using the supported ways, phpize or to build 
with 
php to double check the actual problem.

------------------------------------------------------------------------
[2012-07-24 09:50:26] carlo dot pastorino at neologica dot it

Description:
------------
I have a PHP extension which adds some "native" functions and zend classes to 
the PHP framework.
This extension is located out of the php source tree and it is built using a 
Visual Studio 2008 project which 
should set all the preprocessor definitions and .lib needed.
In order to build this extension i'm linking it to the php5ts.lib file included 
inside the php-devel-pack (which 
can be downloaded from here 
http://windows.php.net/downloads/releases/archives/) 
and, of course, including the 
*.h files provided with the php-devel-pack.

My Visual Studio solution worked fine using php5.2 and php5.3 includes and libs 
but it fails the compilation 
using the php5.4 php-devel-pack.

In particular I receive a link error:

unresolved external symbol "__declspec(dllimport) char const * (__cdecl* 
zend_new_interned_string)(char const 
*,int,int,void * * *)" (__imp_?zend_new_interned_string@@3P6APBDPBDHHPAPAPAX@ZA)

as if that symbol were not available from the php5ts.lib file.

I've generated a simpler Visual Studio solution containing ALL the files needed 
to build which should present 
the issue.

The solution can be downloaded here:

http://www.neologica.it/test_ext_vc9.7z

The source code contains a simple php extension and a zend class declaration 
(Test) having a method: "sayHello".
Compiling it using the configuration *_5.3 should produce the dll correctly 
while using the *_5.4 configuration 
should trigger the link error.

I'm not sure if this is some unfortunate case of undeclared macro in my code / 
solution, or if there is 
something that could be done in php source.

Test script:
---------------
1 - Extract the archive
2 - Open the solution with Visual Studio (2008 or 2010 is the same)
3 - Select "Release_5.4" or "Debug_5.4" from the build Solution configurations 
dropdown
4 - Build the extension.

Expected result:
----------------
php_test.dll correctly built

Actual result:
--------------
error LNK2001: unresolved external symbol "__declspec(dllimport) char const * 
(__cdecl* zend_new_interned_string)(char const *,int,int,void * * *)" (__imp_?
zend_new_interned_string@@3P6APBDPBDHHPAPAPAX@ZA)


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=62651&edit=1

Reply via email to