Bug 243580

Summary: graphics/graphviz fails to build with PHP option
Product: Ports & Packages Reporter: Tommy P <tommyhp2>
Component: Individual Port(s)Assignee: Po-Chuan Hsieh <sunpoet>
Status: Closed FIXED    
Severity: Affects Only Me CC: sunpoet, tommyhp2
Priority: --- Flags: dinoex: maintainer-feedback? (sunpoet)
Version: Latest   
Hardware: amd64   
OS: Any   
Bug Depends on: 246613    
Bug Blocks:    
Attachments:
Description Flags
poudriere build log for graphics/graphviz
none
Options used to build graphics/graphviz
none
Logs of clean build in poudriere (part 1 of 2)
none
Logs of clean build in poudriere (part 2 of 2)
none
screen shot of recent interactive mode
none
screen shot of recent 2020.02.04 clean build
none
logs of recent 2020.02.04 clean build (1 of 2)
none
logs of recent 2020.02.04 clean build (2 of 2) none

Description Tommy P 2020-01-25 03:07:29 UTC
I'm unable to build graphics/graphviz with PHP option:

===> The following configuration options are available for graphviz-2.42.2_4:
     XPM=on: XPM pixmap image format support
     DIGCOLA=on: neato layout engine with DIGCOLA features
     IPSEPCOLA=on: neato layout engine with IPSEPCOLA features
     ICONV=on: Encoding conversion support via iconv
     NLS=on: Native Language Support
     PANGOCAIRO=on: pangocairo support
     POPPLER=on: PDF and PS file support via poppler
     ANN=off: ANN edge bundling support
     GTS=off: GNU Triangulated Surface Library support
     GTK2=off: gtk2 plugin (requires PANGOCAIRO)
     GDK=off: gdk library support (requires GTK2)
     GDK_PIXBUF=off: gdk pixbuf support (requires GDK)
     GNOMEUI=off: libgnomeui support
     SMYRNA=off: SMYRNA graph viewer (requires GTK2)
     DEVIL=off: devil plugin
     GHOSTSCRIPT=off: ghostscript plugin (requires PANGOCAIRO)
     PERL=on: Perl bindings (swig)
     PHP=on: PHP bindings (swig)
     PYTHON=on: Python bindings (swig)
     RUBY=off: Ruby bindings (swig)
     LUA=off: Lua bindings (swig)
     TCL=off: TCL bindings (swig)
     TK=off: TK toolkit support
     GUILE=off: Guile bindings (swig)
     GO=off: Go bindings (swig)
     NVTHREADS=on: Link with threads (needed for nvidia)
     DOCS=off: Build and/or install documentation
     EXAMPLES=off: Build and/or install examples
===> Use 'make config' to modify these settings

grep -e '^DEFAULT' /etc/make.conf

DEFAULT_VERSIONS+=bind=9.14 bdb=6
DEFAULT_VERSIONS+=mysql=10.4m pgsql=12 samba=4.10 ssl=openssl
DEFAULT_VERSIONS+=perl5=5.30 python=3.8 python2=2.7 python3=3.8 ruby=2.6 tcltk=8.7
DEFAULT_VERSIONS+=apache=2.4
Comment 1 Tommy P 2020-01-25 04:02:42 UTC
Created attachment 211026 [details]
poudriere build log for graphics/graphviz

gv_php.cpp:1007:16: error: use of undeclared identifier 'gv_globals'; did you mean 'gv_globals_id'?
    zend_error(SWIG_ErrorCode(), "%s", SWIG_ErrorMsg());
               ^
gv_php.cpp:1001:27: note: expanded from macro 'SWIG_ErrorCode'
#define SWIG_ErrorCode() (gv_globals.error_code)
                          ^
gv_php.cpp:999:1: note: 'gv_globals_id' declared here
ZEND_DECLARE_MODULE_GLOBALS(gv)
^
/usr/local/include/php/Zend/zend_API.h:161:13: note: expanded from macro 'ZEND_DECLARE_MODULE_GLOBALS'
        ts_rsrc_id module_name##_globals_id;
                   ^
<scratch space>:241:1: note: expanded from here
gv_globals_id
^
gv_php.cpp:1007:16: error: member reference base type 'ts_rsrc_id' (aka 'int') is not a structure or union
    zend_error(SWIG_ErrorCode(), "%s", SWIG_ErrorMsg());
Comment 2 Dirk Meyer freebsd_committer freebsd_triage 2020-01-29 09:25:07 UTC
Unable to reproduce.
build with php72-7.2.27 successful.
Comment 3 Dirk Meyer freebsd_committer freebsd_triage 2020-01-31 10:43:48 UTC
Still unable to reproduce.
build with php72-7.2.27 successful.
build with php73-7.3.14 successful.
build with php74-7.4.2 successful.

please clean up old packages and rebuild with poudriere.
Comment 4 Tommy P 2020-02-01 06:58:45 UTC
(In reply to Dirk Meyer from comment #3)

Thanks for checking, Dirk.  I tested clean builds several times to verify before submitting this.  I just tried again it still fails.  On non interactive build, it failed with different error.  I'll attached the logs of non-interactive build and options used during the build.
Comment 5 Tommy P 2020-02-01 07:05:21 UTC
Created attachment 211234 [details]
Options used to build graphics/graphviz

These options failed when using PHP 7.4 as default version.  For PHP 7.3 works OK.
Comment 6 Tommy P 2020-02-01 07:06:36 UTC
Created attachment 211235 [details]
Logs of clean build in poudriere (part 1 of 2)

Due to size limitations in attachment, I've split into 800K chunks.
Comment 7 Tommy P 2020-02-01 07:07:07 UTC
Created attachment 211236 [details]
Logs of clean build in poudriere (part 2 of 2)
Comment 8 Tommy P 2020-02-01 07:14:32 UTC
Created attachment 211237 [details]
screen shot of recent interactive mode

If you look at both the logs (211235 & 211236) and the screen shot, PHP 7.4 was built and installed.  However, the non interactive mode looks for PHP 7.3 which failed.
Comment 9 Dirk Meyer freebsd_committer freebsd_triage 2020-02-03 16:04:55 UTC
Please check your /etc/make.conf

HOSTNAME may not be set at all times.
so php7.3 is picked up in your case.

please try to force there:
DEFAULT_VERSIONS+=php=7.4
Comment 10 Tommy P 2020-02-05 22:04:38 UTC
Created attachment 211395 [details]
screen shot of recent 2020.02.04 clean build

(Replying to comment #9)
It still fails with the same error as seen in the screen shot and logs.
Comment 11 Tommy P 2020-02-05 22:05:15 UTC
Created attachment 211396 [details]
logs of recent 2020.02.04 clean build (1 of 2)
Comment 12 Tommy P 2020-02-05 22:05:40 UTC
Created attachment 211397 [details]
logs of recent 2020.02.04 clean build (2 of 2)
Comment 13 Tommy P 2020-02-06 01:41:37 UTC
Hi Dirk,

I did some more investigation and found that both 7.3 and 7.4 are the same for module's globals(_id):

lang/php73/work/php-7.3.14/Zend/zend_modules.h:54:# define ZEND_MODULE_GLOBALS(module_name) sizeof(zend_##module_name##_globals), &module_name##_globals_id
lang/php73/work/php-7.3.14/Zend/zend_modules.h:56:# define ZEND_MODULE_GLOBALS(module_name) sizeof(zend_##module_name##_globals), &module_name##_globals


lang/php74/work/php-7.4.2/Zend/zend_modules.h:54:# define ZEND_MODULE_GLOBALS(module_name) sizeof(zend_##module_name##_globals), &module_name##_globals_id
lang/php74/work/php-7.4.2/Zend/zend_modules.h:56:# define ZEND_MODULE_GLOBALS(module_name) sizeof(zend_##module_name##_globals), &module_name##_globals

However, I suspect this change in 7.4 that may possibly throw the error I've encountered:

--- lang/php73/work/php-7.3.14/Zend/zend_API.h  2020-01-21 02:00:01.000000000 -0800
+++ lang/php74/work/php-7.4.2/Zend/zend_API.h   2020-01-21 03:35:33.000000000 -0800
@@ -140,7 +141,7 @@
 #define ZEND_MODULE_ACTIVATE_D(module)         int ZEND_MODULE_ACTIVATE_N(module)(INIT_FUNC_ARGS)
 #define ZEND_MODULE_DEACTIVATE_D(module)       int ZEND_MODULE_DEACTIVATE_N(module)(SHUTDOWN_FUNC_ARGS)
 #define ZEND_MODULE_POST_ZEND_DEACTIVATE_D(module)     int ZEND_MODULE_POST_ZEND_DEACTIVATE_N(module)(void)
-#define ZEND_MODULE_INFO_D(module)                     void ZEND_MODULE_INFO_N(module)(ZEND_MODULE_INFO_FUNC_ARGS)
+#define ZEND_MODULE_INFO_D(module)                     ZEND_COLD void ZEND_MODULE_INFO_N(module)(ZEND_MODULE_INFO_FUNC_ARGS)
 #define ZEND_MODULE_GLOBALS_CTOR_D(module)  void ZEND_MODULE_GLOBALS_CTOR_N(module)(zend_##module##_globals *module##_globals)
 #define ZEND_MODULE_GLOBALS_DTOR_D(module)  void ZEND_MODULE_GLOBALS_DTOR_N(module)(zend_##module##_globals *module##_globals)


Unfortunately, my C/C++ skills are not up to par for me to dig deeper and verify. :(  If you're unable to duplicate with the options I'm using, I'm OK to close this report since the changes in 7.4 also break compatibility with other ports I need (like www/nextcloud due removal of wddx).  Thus, I'm stuck with PHP 7.3.  Thank you.
Comment 14 Tommy P 2020-03-24 21:35:20 UTC
Hi Dirk,

I have some again to look at this.  I appears the this port only fails:

/usr/ports/lang/php74 # make showconfig|grep ZTS
     ZTS=on: Force Zend Thread Safety (ZTS) build

/usr/ports/www/apache24 # make showconfig | grep WORKER
     MPM_WORKER=on: hybrid multi-threaded multi-process web server


Otherwise, it builds successfully.  Another person has encounter similar issue with PHP ZTS:

https://lists.freebsd.org/pipermail/freebsd-ports/2014-June/092744.html

I'm unable to find anything regarding graphviz's support of PHP ZTS.  I did find other Linux was able to build graphviz with PHP ZTS.

Thanks.
Comment 15 Dirk Meyer freebsd_committer freebsd_triage 2020-04-22 20:00:17 UTC
I can reproduce the problem, but this can not be fixed within graphviz

see also:
https://github.com/mapserver/mapserver/issues/5795


swig30 needs to be patched.

patch suggested:
https://github.com/swig/swig/pull/1238/files/03a2e2b6f74b518d8b4ade3169f7ed6544838a9b

Passing over to swig30 Maintainer.
Comment 16 Po-Chuan Hsieh freebsd_committer freebsd_triage 2020-05-28 20:04:31 UTC
According to https://github.com/mapserver/mapserver/issues/5795 and https://github.com/swig/swig/pull/1238, the problem is fixed in swig 4. Let's wait for the exp-run of swig 4.0.1 (bug #246613).
Comment 17 Po-Chuan Hsieh freebsd_committer freebsd_triage 2020-06-17 18:31:27 UTC
swig 4.0.1 landed.