Bug 190662 - lang/php5 Fails to Compile
Summary: lang/php5 Fails to Compile
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Many People
Assignee: Alex Dupre
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-05 16:46 UTC by Martin Vahi
Modified: 2014-11-27 09:41 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Vahi 2014-06-05 16:46:58 UTC
/bin/sh /usr/ports/lang/php5/work/php-5.4.28/libtool --silent --preserve-dup-deps --mode=compile cc  -Iext/standard/ -I/usr/ports/lang/php5/work/php-5.4.28/ext/standard/ -DPHP_ATOM_INC -I/usr/ports/lang/php5/work/php-5.4.28/include -I/usr/ports/lang/php5/work/php-5.4.28/main -I/usr/ports/lang/php5/work/php-5.4.28 -I/usr/ports/lang/php5/work/php-5.4.28/ext/date/lib -I/usr/ports/lang/php5/work/php-5.4.28/ext/ereg/regex -I/usr/local/include/libxml2 -I/usr/local/include -I/usr/ports/lang/php5/work/php-5.4.28/TSRM -I/usr/ports/lang/php5/work/php-5.4.28/Zend    -O2 -pipe -fno-strict-aliasing -fvisibility=hidden -DZTS  -c /usr/ports/lang/php5/work/php-5.4.28/ext/standard/url_scanner_ex.c -o ext/standard/url_scanner_ex.lo
dtrace: failed to compile script /usr/ports/lang/php5/work/php-5.4.28/Zend/zend_dtrace.d: "/usr/lib/dtrace/errno.d", line 13: operator -> cannot be applied to a forward declaration: no struct devstat definition is available
*** [Zend/zend_dtrace_gen.h] Error code 1
1 error
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** [do-build] Error code 1

Stop in /usr/ports/lang/php5.
*** [stage] Error code 1

Stop in /usr/ports/lang/php5.





=====COMMENT===START====

A thing to notice here is the 
"MAKE_JOBS_UNSAFE=yes", which is applied at the next
compilation try.

=====COMMENT===END======




[root@mvahi /usr/ports/lang/php5]# make clean
pkg-static: PACKAGESITE in pkg.conf is deprecated. Please create a repository configuration file
===>  Cleaning for php5-5.4.28
[root@mvahi /usr/ports/lang/php5]# MAKE_JOBS_UNSAFE=yes make
pkg-static: PACKAGESITE in pkg.conf is deprecated. Please create a repository configuration file
===>  License PHP301 accepted by the user
===>  Found saved configuration for php5-5.4.27
===>   php5-5.4.28 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by php5-5.4.28 for building
===>  Extracting for php5-5.4.28
=> SHA256 Checksum OK for php-5.4.28.tar.bz2.
=> SHA256 Checksum OK for php-5.4.x-mail-header.patch.
===>  Patching for php5-5.4.28
===>  Applying distribution patches for php5-5.4.28
===>  Applying FreeBSD patches for php5-5.4.28
===>   php5-5.4.28 depends on file: /usr/local/bin/autoconf-2.69 - found
===>   php5-5.4.28 depends on shared library: libpcre.so - found (/usr/local/lib/libpcre.so.3)
===>   php5-5.4.28 depends on shared library: libxml2.so - found (/usr/local/lib/libxml2.so.5)
===>  Configuring for php5-5.4.28
configure: loading site script /usr/ports/Templates/config.site
checking for grep that handles long lines and -e... (cached) /usr/bin/grep
checking for egrep... (cached) /usr/bin/egrep




========SOME CONSOLE OUTPUT SKIPPED FROM THE CITATION=============




Configuring libtool
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking how to recognize dependent libraries... pass_all
checking how to run the C++ preprocessor... c++ -E
checking the maximum length of command line arguments... (cached) 262144
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... freebsd9.2 ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... no
checking whether to build static libraries... yes

creating libtool
appending configuration tag "CXX" to libtool
checking whether the c++ linker (/usr/bin/ld) supports shared libraries... yes
checking for c++ option to produce PIC... 
checking if c++ static flag  works... yes
checking if c++ supports -c -o file.o... yes
checking whether the c++ linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... freebsd9.2 ld.so
(cached) (cached) checking how to hardcode library paths into programs... unsupported

Generating files
configure: creating ./config.status
creating main/internal_functions.c
creating main/internal_functions_cli.c
+--------------------------------------------------------------------+
| License:                                                           |
| This software is subject to the PHP License, available in this     |
| distribution in the file LICENSE.  By continuing this installation |
| process, you are bound by the terms of this license agreement.     |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point.                            |
+--------------------------------------------------------------------+

Thank you for using PHP.

config.status: creating php5.spec
config.status: creating main/build-defs.h
config.status: creating scripts/phpize
config.status: creating scripts/man1/phpize.1
config.status: creating scripts/php-config
config.status: creating scripts/man1/php-config.1
config.status: creating sapi/cli/php.1
config.status: creating sapi/fpm/php-fpm.conf
config.status: creating sapi/fpm/init.d.php-fpm
config.status: creating sapi/fpm/php-fpm.service
config.status: creating sapi/fpm/php-fpm.8
config.status: creating sapi/fpm/status.html
config.status: creating sapi/cgi/php-cgi.1
config.status: creating main/php_config.h
config.status: executing default commands
===>  Building for php5-5.4.28
CFLAGS="-O2 -pipe -fno-strict-aliasing -fvisibility=hidden -DZTS" dtrace -h -C -s /usr/ports/lang/php5/work/php-5.4.28/Zend/zend_dtrace.d -o Zend/zend_dtrace_gen.h.bak && sed -e 's,PHP_,DTRACE_,g' Zend/zend_dtrace_gen.h.bak > Zend/zend_dtrace_gen.h
dtrace: failed to compile script /usr/ports/lang/php5/work/php-5.4.28/Zend/zend_dtrace.d: "/usr/lib/dtrace/errno.d", line 13: operator -> cannot be applied to a forward declaration: no struct devstat definition is available
*** [Zend/zend_dtrace_gen.h] Error code 1

Stop in /usr/ports/lang/php5/work/php-5.4.28.
*** [do-build] Error code 1

Stop in /usr/ports/lang/php5.
*** [stage] Error code 1

Stop in /usr/ports/lang/php5.
[root@mvahi /usr/ports/lang/php5]# pwd
/usr/ports/lang/php5
[root@mvahi /usr/ports/lang/php5]# date
Thu Jun  5 19:40:26 EEST 2014
[root@mvahi /usr/ports/lang/php5]# uname -a
FreeBSD mvahi.bitikodo.eu 9.2-STABLE FreeBSD 9.2-STABLE #0 r264404: Sun Apr 13 14:39:51 EEST 2014     root@byte.bitikodo.ee:/usr/obj/usr/src/sys/BYTE2  amd64
[root@mvahi /usr/ports/lang/php5]#
Comment 1 Alex Dupre freebsd_committer 2014-06-09 08:23:35 UTC
You didn't specify environment and OPTIONS selected, I could imagine you are building php with DTRACE enabled inside a 9/10 jail, isn't it?
Comment 2 Steven Hartland freebsd_committer 2014-08-28 12:13:18 UTC
Got the same here today building on 10.0-RELEASE not in a jail:-

dtrace: failed to compile script /wrkdirs/usr/ports/lang/php55/work/php-5.5.16/Zend/zend_dtrace.d: "/usr/lib/dtrace/ip.d", line 226: operator -> cannot be applied to a forward declaration: no struct ip definition is available
Comment 3 Steven Hartland freebsd_committer 2014-08-28 12:22:32 UTC
Actually this was being built in a jail as it was poudriere building php.

Is there a way to make this work?
Comment 4 Alex Dupre freebsd_committer 2014-08-28 12:28:35 UTC
None that I'm aware of. It seems a known problem of dtrace inside jail, probably this should be brought to the attention of dtrace maintainer.
Comment 5 Steven Hartland freebsd_committer 2014-08-28 12:32:10 UTC
Copying /boot/kernel/* into the poudriere tree and recreating the poudriere @clean snapshot fixed this for me.
Comment 6 Alex Dupre freebsd_committer 2014-08-28 12:37:15 UTC
Good to know it!
Comment 7 Martin Vahi 2014-08-28 14:47:35 UTC
(In reply to Alex Dupre from comment #1)
> You didn't specify environment and OPTIONS selected, I could imagine you are
> building php with DTRACE enabled inside a 9/10 jail, isn't it?

Yes, it was in a FreeBSD jail, but shouldn't the jail be a lightweight version of an operating system specific virtual machine? If so, then, according to my unpopular opinion, package building failures in a jail is a flaw (bug).

If the flaw exists due to a flawed component, in this case, the proposed "dtrace", then a line of thought that a system is flawed as long as at least one of its sub-components is flawed, seems reasonable to me. That's why I think that this flaw report should not be closed until it actually is resolved. I propose that this flaw report stays open for about a year and then I'll test with some newer version of FreeBSD, if the flaw can be detected, its symptoms reproduced.

Thank You for Your efforts and thank You for reading my comment. :-)
Comment 8 Steven Hartland freebsd_committer 2014-08-28 15:16:19 UTC
The problem you have is you have is your install is missing a dependency required for compilation of php with dtrace enabled.

Installing said dependency into your build environment, as described in my previous comment, is the fix.

If you run the build in a full host and not a jail this is problem doesn't occur.
Comment 9 Alex Dupre freebsd_committer 2014-08-28 15:18:25 UTC
It could be useful to know what's exactly the dependency required. I could set a BROKEN tag with the explaination if the file is missing.
Comment 10 Steven Hartland freebsd_committer 2014-08-28 15:51:15 UTC
(In reply to Alex Dupre from comment #9)
> It could be useful to know what's exactly the dependency required. I could
> set a BROKEN tag with the explanation if the file is missing.

If the dtrace option is selected, then the contents of the machines /boot/kernel/ directory are required.

Obviously on a raw machine those are always present but when building in a jail they aren't.

Simply copying in the contents of /boot/kernel/ from the host machine into the jail will satisfy the build type dependencies for dtrace.
Comment 11 Steven Hartland freebsd_committer 2014-09-09 11:10:46 UTC
Another requirement is that the dtrace modules are loaded on the host machine. To do this run: dtrace -l > /dev/null
Comment 12 Mark Johnston freebsd_committer 2014-11-26 19:43:15 UTC
As Steven pointed out, the kernel needs to be available for DTrace to work. When dtrace -h runs, it processes /usr/lib/dtrace/* and makes use of CTF data from the kernel file, so in a jail, it'll fail if the kernel isn't available.

However, dtrace -h and dtrace -G (i.e. the options used when building ports with DTrace probes) don't need to process /usr/lib/dtrace/*, and there's a flag to tell them not to: -xnolibs. So one fix would be to add -xnolibs to dtrace invocations in the php build. Many ports have this already.
Comment 13 commit-hook freebsd_committer 2014-11-27 09:41:59 UTC
A commit references this bug:

Author: ale
Date: Thu Nov 27 09:41:20 UTC 2014
New revision: 373474
URL: https://svnweb.freebsd.org/changeset/ports/373474

Log:
  Fix build into jails with DTRACE enabled.

  PR:		190662
  Submitted by:	Martin Vahi <martin.vahi@softf1.com>

Changes:
  head/lang/php5/Makefile
  head/lang/php5/files/patch-acinclude.m4
  head/lang/php5/pkg-plist
  head/lang/php55/Makefile
  head/lang/php55/files/patch-acinclude.m4
  head/lang/php55/pkg-plist
  head/lang/php56/Makefile
  head/lang/php56/files/patch-acinclude.m4
  head/lang/php56/pkg-plist