Skip to content

Fix 'PHP_EXTNAME_SHARED' is undefined #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 11, 2018
Merged

Fix 'PHP_EXTNAME_SHARED' is undefined #24

merged 1 commit into from
Dec 11, 2018

Conversation

TBK
Copy link
Contributor

@TBK TBK commented Dec 11, 2018

I tried to build the extension on Windows for PHP 7.3.0 and get this error C:\php-sdk\php-7.3.0\vc15\x64\php-7.3.0-src\configure.js(6120, 3) Microsoft JScript runtime error: 'PHP_EXTNAME_SHARED' is undefined when running configure --disable-all --enable-cli --with-vips.

It seems the same issue is causing pecl.php.net not being able build the Windows binaries:
https://windows.php.net/downloads/pecl/releases/vips/1.0.9/logs/php_vips-1.0.9-7.2-ts-vc15-x64-logs.zip -> configure-php_vips-1.0.9-7.2-ts-vc15-x64.txt
https://windows.php.net/downloads/pecl/releases/vips/1.0.9/

I have not been able to find the docs describing what the third argument for the EXTENSION function in the config.w32 files does but looking at official extensions they pass PHP_ extension name _SHARED.

Changing the variable name from:

EXTENSION("vips", "vips.c", PHP_EXTNAME_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");

to:

EXTENSION("vips", "vips.c", PHP_VIPS_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");

fixes the issue and now executes configure --disable-all --enable-cli --with-vips without error.

@jcupitt jcupitt merged commit 0aa9375 into libvips:master Dec 11, 2018
@jcupitt
Copy link
Member

jcupitt commented Dec 11, 2018

That's great, thank you! I've never tried building it on Windows, so it's good to hear it works.

Do all tests pass?

@TBK TBK deleted the patch-1 branch December 11, 2018 10:05
@jcupitt
Copy link
Member

jcupitt commented Dec 12, 2018

I've made a 1.0.10 including this change, would you be able to test it before I upload to pecl?

@TBK
Copy link
Contributor Author

TBK commented Dec 12, 2018

Hi, I got statically compiled working with two additional changes.

config.w32:

// $Id$
// vim:ft=javascript

ARG_WITH("vips", "VIPS support", "no");

if (PHP_VIPS != "no") {
	if (CHECK_HEADER_ADD_INCLUDE("vips.h", "CFLAGS_VIPS", PHP_VIPS+ ";" + PHP_PHP_BUILD + "\\include\\vips") &&
		CHECK_HEADER_ADD_INCLUDE("glib.h", "CFLAGS_VIPS", PHP_VIPS+ ";" + PHP_PHP_BUILD + "\\include\\glib-2.0") &&
		CHECK_LIB("libvips.lib", "vips", PHP_VIPS) && CHECK_LIB("glib-2.0.lib", "vips", PHP_VIPS) && CHECK_LIB("gobject-2.0.lib", "vips", PHP_VIPS) ) {
		EXTENSION("vips", "vips.c", PHP_VIPS_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
		AC_DEFINE('HAVE_VIPS', 1, 'Have vips library');
	} else {
		WARNING("vips not enabled; libraries and headers not found");
	}
}

vips.c

PHP_MINIT_FUNCTION(vips)
{
if (strcmp(sapi_module.name, "apache2handler") == 0) {
........
........
........
........
........
#if defined(VIPS_SONAME) && !defined(PHP_WIN32) /*Unix*/
		if (!dlopen(VIPS_SONAME, RTLD_LAZY | RTLD_NODELETE)) 
#elif !defined(PHP_WIN32) /*Unix & !VIPS_SONAME*/
		if (!dlopen("libvips.so.42", RTLD_LAZY | RTLD_NODELETE)) 
#elif defined(VIPS_SONAME) && defined(PHP_WIN32) /*PHP_WIN32*/
		if (!LoadLibrary("VIPS_SONAME"))
#else /*PHP_WIN32 & !VIPS_SONAME*/
		if (!LoadLibrary("libvips-42.dll"))
#endif 

At the moment I can not get the tests to pass since PHP craches before reaching the tests. I am working on an appveyor setup to automate the testing and test different PHP versions. Currently I am only doing 7.3.0 which might be the issue.

My intention is to get shared working and pass the tests and then make a PR.

@jcupitt
Copy link
Member

jcupitt commented Dec 12, 2018

Hey, great progress! OK, I'll hold off on 1.0.10 and hope to get your PR in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants