Bug 1350620

Summary: redland-bindings: FTBFS in rawhide: 'rsrc' undeclared
Product: [Fedora] Fedora Reporter: Shawn Iwinski <shawn>
Component: redland-bindingsAssignee: Petr Pisar <ppisar>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 25CC: jplesnik, ppisar, releng, thomas
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
URL: http://bugs.librdf.org/mantis/view.php?id=622
Whiteboard:
Fixed In Version: redland-bindings-1.0.16.1-20.fc27 redland-bindings-1.0.16.1-19.fc26 redland-bindings-1.0.16.1-18.fc25 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-06-19 14:34:33 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1356985    
Bug Blocks: 1423041    

Description Shawn Iwinski 2016-06-27 21:45:38 UTC
Description of problem:
Package redland-bindings fails to build from source in rawhide.

Version-Release number of selected component (if applicable):
1.0.16.1-16.fc25

Steps to Reproduce:
koji build --scratch f25 redland-bindings-1.0.16.1-16.fc25.src.rpm

Additional info:
This package is tracked by Koschei. See:
https://apps.fedoraproject.org/koschei/package/redland-bindings

Comment 1 Jan Kurik 2016-07-26 05:08:22 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 25 development cycle.
Changing version to '25'.

Comment 2 Petr Pisar 2016-10-05 14:17:34 UTC
It fails in build phase:

gcc -DHAVE_CONFIG_H  -I. -DREDLAND_POST_I -DREDLAND_INIT_I -DREDLAND_DECL_I -DREDLAND_TYPEMAP_I -UHAVE_CONFIG_H   -I/usr/include/rasqal -I/usr/include/raptor2 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DREDLAND_BINDINGS_VERSION=\"1.0.16.1\"  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic  -I/usr/include/rasqal -I/usr/include/raptor2  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -fPIC -DPIC redland_wrap.c -c -o redland_wrap.o
redland_wrap.c: In function 'SWIG_landfill':
redland_wrap.c:811:51: error: 'rsrc' undeclared (first use in this function)
 static ZEND_RSRC_DTOR_FUNC(SWIG_landfill) { (void)rsrc; }
                                                   ^~~~

A difference between working and failing build root is:

        php-devel 	5.6.23-1.fc25 	> 	7.0.8-1.fc25
	php-cli 	5.6.23-1.fc25 	> 	7.0.8-1.fc25
	php-common 	5.6.23-1.fc25 	> 	7.0.8-1.fc25
	openssl-libs 	1:1.0.2h-1.fc25 	> 	1:1.0.2h-2.fc25
	nss 	3.24.0-3.fc25 	> 	3.25.0-3.fc25
	libselinux 	2.5-8.fc25 	> 	2.5-9.fc25
	php-json 		> 	7.0.8-1.fc25
	php-pecl-jsonc-devel 	1.3.10-1.fc25 	< 	
	php-pecl-jsonc 	1.3.10-1.fc25 	< 	
	libnghttp2 	1.11.1-1.fc25 	> 	1.12.0-1.fc25
	nss-tools 	3.24.0-3.fc25 	> 	3.25.0-3.fc25
	file-libs 	5.28-1.fc25 	> 	5.28-2.fc25
	nss-sysinit 	3.24.0-3.fc25 	> 	3.25.0-3.fc25
	file 	5.28-1.fc25 	> 	5.28-2.fc25

This is very probably caused by upgrading PHP.

Comment 3 Jitka Plesnikova 2016-10-12 15:23:40 UTC
swig doesn't support php7 yet.

Comment 4 Shawn Iwinski 2016-10-14 19:30:25 UTC
Note: Removed blocked bug 1350621 as I removed the redland dependency from php-EasyRdf

Comment 5 Petr Pisar 2017-06-13 12:31:25 UTC
*** Bug 1424251 has been marked as a duplicate of this bug. ***

Comment 6 Petr Pisar 2017-06-13 12:49:45 UTC
swig already supports PHP 7, but this package uses pregenerated sources and the build fails with:

gcc -DHAVE_CONFIG_H  -I. -DREDLAND_POST_I -DREDLAND_INIT_I -DREDLAND_DECL_I -DREDLAND_TYPE
MAP_I -UHAVE_CONFIG_H   -I/usr/include/raptor2 -I/usr/include/rasqal  -I/usr/include/php -
I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/
ext -I/usr/include/php/ext/date/lib -DREDLAND_BINDINGS_VERSION=\"1.0.16.1\"  -O2 -g -pipe 
-Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-stron
g --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-harden
ed-cc1 -m64 -mtune=generic  -I/usr/include/raptor2 -I/usr/include/rasqal   -O2 -g -pipe -W
all -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong 
--param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened
-cc1 -m64 -mtune=generic -fPIC -DPIC redland_wrap.c -c -o redland_wrap.o
redland_wrap.c:730:3: error: #error These bindings need PHP5 - to generate PHP7 bindings use: swig -php7
 # error These bindings need PHP5 - to generate PHP7 bindings use: swig -php7
   ^~~~~

I was told that's its impossible to regenerate the sources. If this is true I will try to disable the PHP support in this package.

Comment 7 Petr Pisar 2017-06-13 16:26:44 UTC
After patching these two files:

--- a/configure.ac
+++ b/configure.ac
@@ -165,7 +165,9 @@ if test "X$PHP_CONFIG" != X ; then
   PHP_INCLUDES=`$PHP_CONFIG --includes`
   PHP_EXTENSION_DIR=`$PHP_CONFIG --extension-dir`
 
-  if test $PHP_VERSION '>' 5.0.0; then
+  if test $PHP_VERSION '>' 7; then
+    PHP_SWIG="-php7"
+  elif test $PHP_VERSION '>' 5.0.0; then
     PHP_SWIG="-php5"
   else
     PHP_SWIG="-php4"
diff --git a/php/redland-post.i b/php/redland-post.i
index 2ab09dd..6b16e0a 100644
--- a/php/redland-post.i
+++ b/php/redland-post.i
@@ -132,8 +132,11 @@ librdf_php_world_init(void)
     exception_ce = zend_exception_get_default();
     INIT_CLASS_ENTRY(ee_ce, "RedlandException", NULL);
     redland_exception_ptr = zend_register_internal_class_ex(&ee_ce, 
-                                                            exception_ce, 
-                                                            NULL TSRMLS_CC);
+                                                            exception_ce
+#if PHP_MAJOR_VERSION < 7
+                                                            ,NULL TSRMLS_CC
+#endif
+                                                            );
 #endif
 
     memset(&librdf_php_locator, '\0', sizeof(raptor_locator));

I get tons of these errors:

redland_wrap.c: In function ‘_wrap_librdf_world_get_feature’:
redland_wrap.c:1700:22: error: invalid type argument of unary ‘*’ (have ‘zval {aka struct _zval_struct}’)
   if(SWIG_ConvertPtr(*args[1], (void **) &arg2, SWIGTYPE_p_librdf_uri_s, 0) < 0) {
                      ^~~~~~~~

It's probably related to this PHP change <https://nikic.github.io/2015/05/05/Internal-value-representation-in-PHP-7-part-1.html>.

Comment 8 Petr Pisar 2017-06-14 05:34:01 UTC
I patched the code and submitted it to upstream in <http://bugs.librdf.org/mantis/view.php?id=622>.

Comment 9 Fedora Update System 2017-06-14 05:38:41 UTC
redland-bindings-1.0.16.1-19.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-51d9681974

Comment 10 Fedora Update System 2017-06-14 05:44:16 UTC
redland-bindings-1.0.16.1-18.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2017-d7dd086849

Comment 11 Fedora Update System 2017-06-15 10:57:56 UTC
redland-bindings-1.0.16.1-18.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-d7dd086849

Comment 12 Fedora Update System 2017-06-15 13:58:42 UTC
redland-bindings-1.0.16.1-19.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-51d9681974

Comment 13 Fedora Update System 2017-06-19 14:34:33 UTC
redland-bindings-1.0.16.1-19.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.

Comment 14 Fedora Update System 2017-06-23 01:56:23 UTC
redland-bindings-1.0.16.1-18.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.