Skip to content
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

GNUisms in Makefile.fragment cause BSD make not to install headers #4

Closed
jdavidlists opened this issue Feb 4, 2016 · 10 comments
Closed
Labels

Comments

@jdavidlists
Copy link

Under PHP 5.6.18 after a successful/uneventful "pecl install raphf-1.1.2" the extension is there, but the installed file include/php/ext/raphf/php_raphf.h contains the line:

#include "php_raphf_api.h"

However, this file is not present:

$ find /usr/local/php -name php_raphf_api.h
$

This causes dependencies (i.e. pecl_http 2.5.5) to fail to build:

In file included from /tmp/pear/temp/pecl_http/src/php_http.c:13:
In file included from /tmp/pear/temp/pecl_http/src/php_http_api.h:26:
/usr/local/php/5.6.18/include/php/ext/raphf/php_raphf.h:33:10: fatal error: 'php_raphf_api.h' file not found
#include "php_raphf_api.h"
         ^
1 error generated.
*** Error code 1

Stop.
@m6w6
Copy link
Owner

m6w6 commented Feb 5, 2016

Hey!

At the end of pecl install raphf-1.1.2, you should see something along those lines:

Installing shared extensions:     /private/tmp/pear/install/pear-build-rootPG3LSs/install-raphf-1.1.2/usr/lib/php/extensions/no-debug-non-zts-20121212/
Installing header files:          /private/tmp/pear/install/pear-build-rootPG3LSs/install-raphf-1.1.2/usr/include/php/
running: find "/private/tmp/pear/install/pear-build-rootPG3LSs/install-raphf-1.1.2" | xargs ls -dils
23761159  0 drwxr-xr-x  3 root  wheel    102  5 Feb 12:17 /private/tmp/pear/install/pear-build-rootPG3LSs/install-raphf-1.1.2
23761529  0 drwxr-xr-x  4 root  wheel    136  5 Feb 12:17 /private/tmp/pear/install/pear-build-rootPG3LSs/install-raphf-1.1.2/usr
23761539  0 drwxr-xr-x  3 root  wheel    102  5 Feb 12:17 /private/tmp/pear/install/pear-build-rootPG3LSs/install-raphf-1.1.2/usr/include
23761540  0 drwxr-xr-x  3 root  wheel    102  5 Feb 12:17 /private/tmp/pear/install/pear-build-rootPG3LSs/install-raphf-1.1.2/usr/include/php
23761541  0 drwxr-xr-x  3 root  wheel    102  5 Feb 12:17 /private/tmp/pear/install/pear-build-rootPG3LSs/install-raphf-1.1.2/usr/include/php/ext
23761542  0 drwxr-xr-x  4 root  wheel    136  5 Feb 12:17 /private/tmp/pear/install/pear-build-rootPG3LSs/install-raphf-1.1.2/usr/include/php/ext/raphf
23761543  8 -rw-r--r--  1 root  wheel   1295  5 Feb 12:17 /private/tmp/pear/install/pear-build-rootPG3LSs/install-raphf-1.1.2/usr/include/php/ext/raphf/php_raphf.h
23761544 32 -rw-r--r--  1 root  wheel  13656  5 Feb 12:17 /private/tmp/pear/install/pear-build-rootPG3LSs/install-raphf-1.1.2/usr/include/php/ext/raphf/php_raphf_api.h
23761530  0 drwxr-xr-x  3 root  wheel    102  5 Feb 12:17 /private/tmp/pear/install/pear-build-rootPG3LSs/install-raphf-1.1.2/usr/lib
23761531  0 drwxr-xr-x  3 root  wheel    102  5 Feb 12:17 /private/tmp/pear/install/pear-build-rootPG3LSs/install-raphf-1.1.2/usr/lib/php
23761532  0 drwxr-xr-x  3 root  wheel    102  5 Feb 12:17 /private/tmp/pear/install/pear-build-rootPG3LSs/install-raphf-1.1.2/usr/lib/php/extensions
23761533  0 drwxr-xr-x  3 root  wheel    102  5 Feb 12:17 /private/tmp/pear/install/pear-build-rootPG3LSs/install-raphf-1.1.2/usr/lib/php/extensions/no-debug-non-zts-20121212
23761534 56 -rwxr-xr-x  1 root  wheel  26544  5 Feb 12:17 /private/tmp/pear/install/pear-build-rootPG3LSs/install-raphf-1.1.2/usr/lib/php/extensions/no-debug-non-zts-20121212/raphf.so

Build process completed successfully
Installing '/usr/include/php/ext/raphf/php_raphf.h'
Installing '/usr/include/php/ext/raphf/php_raphf_api.h'
Installing '/usr/lib/php/extensions/no-debug-non-zts-20121212/raphf.so'
install ok: channel://pecl.php.net/raphf-1.1.2
configuration option "php_ini" is not set to php.ini location
You should add "extension=raphf.so" to php.ini

Just tried that, and both headers were installed.
What's your output?

Thanks!

@jdavidlists
Copy link
Author

Weirdly, there is no reference to that header at any point during the config/build/install:

$ /usr/local/php/5.6.18/bin/pecl install raphf-1.1.2
downloading raphf-1.1.2.tar ...
Starting to download raphf-1.1.2.tar (80,384 bytes)
..................done: 80,384 bytes
8 source files, building
running: phpize
Configuring for:
PHP Api Version:         20131106
Zend Module Api No:      20131226
Zend Extension Api No:   220131226
building in /tmp/pear/temp/pear-build-jdavidzNk9jX/raphf-1.1.2
running: /tmp/pear/temp/raphf/configure --with-php-config=/usr/local/php/5.6.18/bin/php-config
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-freebsd10.2
checking host system type... x86_64-unknown-freebsd10.2
checking target system type... x86_64-unknown-freebsd10.2
checking for PHP prefix... /usr/local/php/5.6.18
checking for PHP includes... -I/usr/local/php/5.6.18/include/php -I/usr/local/php/5.6.18/include/php/main -I/usr/local/php/5.6.18/include/php/TSRM -I/usr/local/php/5.6.18/include/php/Zend -I/usr/local/php/5.6.18/include/php/ext -I/usr/local/php/5.6.18/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/php/5.6.18/libexec
checking for PHP installed headers prefix... /usr/local/php/5.6.18/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... no
checking for nawk... nawk
checking if nawk is broken... no
checking whether to enable raphf support... yes, shared
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 whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 196608
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... yes
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 whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... freebsd10.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... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/sh /tmp/pear/temp/pear-build-jdavidzNk9jX/raphf-1.1.2/libtool --mode=compile cc  -I. -I/tmp/pear/temp/raphf -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-jdavidzNk9jX/raphf-1.1.2/include -I/tmp/pear/temp/pear-build-jdavidzNk9jX/raphf-1.1.2/main -I/tmp/pear/temp/raphf -I/usr/local/php/5.6.18/include/php -I/usr/local/php/5.6.18/include/php/main -I/usr/local/php/5.6.18/include/php/TSRM -I/usr/local/php/5.6.18/include/php/Zend -I/usr/local/php/5.6.18/include/php/ext -I/usr/local/php/5.6.18/include/php/ext/date/lib -I/tmp/pear/temp/raphf/src  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/raphf/src/php_raphf_api.c -o src/php_raphf_api.lo
mkdir src/.libs
 cc -I. -I/tmp/pear/temp/raphf -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-jdavidzNk9jX/raphf-1.1.2/include -I/tmp/pear/temp/pear-build-jdavidzNk9jX/raphf-1.1.2/main -I/tmp/pear/temp/raphf -I/usr/local/php/5.6.18/include/php -I/usr/local/php/5.6.18/include/php/main -I/usr/local/php/5.6.18/include/php/TSRM -I/usr/local/php/5.6.18/include/php/Zend -I/usr/local/php/5.6.18/include/php/ext -I/usr/local/php/5.6.18/include/php/ext/date/lib -I/tmp/pear/temp/raphf/src -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/raphf/src/php_raphf_api.c  -fPIC -DPIC -o src/.libs/php_raphf_api.o
/bin/sh /tmp/pear/temp/pear-build-jdavidzNk9jX/raphf-1.1.2/libtool --mode=link cc -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-jdavidzNk9jX/raphf-1.1.2/include -I/tmp/pear/temp/pear-build-jdavidzNk9jX/raphf-1.1.2/main -I/tmp/pear/temp/raphf -I/usr/local/php/5.6.18/include/php -I/usr/local/php/5.6.18/include/php/main -I/usr/local/php/5.6.18/include/php/TSRM -I/usr/local/php/5.6.18/include/php/Zend -I/usr/local/php/5.6.18/include/php/ext -I/usr/local/php/5.6.18/include/php/ext/date/lib -I/tmp/pear/temp/raphf/src  -DHAVE_CONFIG_H  -g -O2   -o ./raphf.la -export-dynamic -avoid-version -prefer-pic -module -rpath /tmp/pear/temp/pear-build-jdavidzNk9jX/raphf-1.1.2/modules  src/php_raphf_api.lo
mkdir ./.libs
cc -shared  src/.libs/php_raphf_api.o   -Wl,-soname -Wl,raphf.so -o ./.libs/raphf.so
creating ./raphf.la
(cd ./.libs && rm -f raphf.la && ln -s ../raphf.la raphf.la)
/bin/sh /tmp/pear/temp/pear-build-jdavidzNk9jX/raphf-1.1.2/libtool --mode=install cp ./raphf.la /tmp/pear/temp/pear-build-jdavidzNk9jX/raphf-1.1.2/modules
cp ./.libs/raphf.so /tmp/pear/temp/pear-build-jdavidzNk9jX/raphf-1.1.2/modules/raphf.so
cp ./.libs/raphf.lai /tmp/pear/temp/pear-build-jdavidzNk9jX/raphf-1.1.2/modules/raphf.la
----------------------------------------------------------------------
Libraries have been installed in:
   /tmp/pear/temp/pear-build-jdavidzNk9jX/raphf-1.1.2/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
Don't forget to run 'make test'.

running: make INSTALL_ROOT="/tmp/pear/temp/pear-build-jdavidzNk9jX/install-raphf-1.1.2" install
/bin/sh /tmp/pear/temp/pear-build-jdavidzNk9jX/raphf-1.1.2/libtool --mode=install cp ./raphf.la /tmp/pear/temp/pear-build-jdavidzNk9jX/raphf-1.1.2/modules
cp ./.libs/raphf.so /tmp/pear/temp/pear-build-jdavidzNk9jX/raphf-1.1.2/modules/raphf.so
cp ./.libs/raphf.lai /tmp/pear/temp/pear-build-jdavidzNk9jX/raphf-1.1.2/modules/raphf.la
----------------------------------------------------------------------
Libraries have been installed in:
   /tmp/pear/temp/pear-build-jdavidzNk9jX/raphf-1.1.2/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
Installing shared extensions:     /tmp/pear/temp/pear-build-jdavidzNk9jX/install-raphf-1.1.2/usr/local/php/5.6.18/libexec/
Installing header files:          /tmp/pear/temp/pear-build-jdavidzNk9jX/install-raphf-1.1.2/usr/local/php/5.6.18/include/php/
running: find "/tmp/pear/temp/pear-build-jdavidzNk9jX/install-raphf-1.1.2" | xargs ls -dils
66190  4 drwxrwxr-x  3 jdavid  wheel    512 Feb  6 21:01 /tmp/pear/temp/pear-build-jdavidzNk9jX/install-raphf-1.1.2
66213  4 drwxrwxr-x  3 jdavid  wheel    512 Feb  6 21:01 /tmp/pear/temp/pear-build-jdavidzNk9jX/install-raphf-1.1.2/usr
66214  4 drwxrwxr-x  3 jdavid  wheel    512 Feb  6 21:01 /tmp/pear/temp/pear-build-jdavidzNk9jX/install-raphf-1.1.2/usr/local
66215  4 drwxrwxr-x  3 jdavid  wheel    512 Feb  6 21:01 /tmp/pear/temp/pear-build-jdavidzNk9jX/install-raphf-1.1.2/usr/local/php
66216  4 drwxrwxr-x  4 jdavid  wheel    512 Feb  6 21:01 /tmp/pear/temp/pear-build-jdavidzNk9jX/install-raphf-1.1.2/usr/local/php/5.6.18
66218  4 drwxrwxr-x  3 jdavid  wheel    512 Feb  6 21:01 /tmp/pear/temp/pear-build-jdavidzNk9jX/install-raphf-1.1.2/usr/local/php/5.6.18/include
66219  4 drwxrwxr-x  3 jdavid  wheel    512 Feb  6 21:01 /tmp/pear/temp/pear-build-jdavidzNk9jX/install-raphf-1.1.2/usr/local/php/5.6.18/include/php
66224  4 drwxrwxr-x  3 jdavid  wheel    512 Feb  6 21:01 /tmp/pear/temp/pear-build-jdavidzNk9jX/install-raphf-1.1.2/usr/local/php/5.6.18/include/php/ext
66229  4 drwxrwxr-x  2 jdavid  wheel    512 Feb  6 21:01 /tmp/pear/temp/pear-build-jdavidzNk9jX/install-raphf-1.1.2/usr/local/php/5.6.18/include/php/ext/raphf
66230  4 -rw-r--r--  1 jdavid  wheel   1295 Feb  6 21:01 /tmp/pear/temp/pear-build-jdavidzNk9jX/install-raphf-1.1.2/usr/local/php/5.6.18/include/php/ext/raphf/php_raphf.h
66217  4 drwxrwxr-x  2 jdavid  wheel    512 Feb  6 21:01 /tmp/pear/temp/pear-build-jdavidzNk9jX/install-raphf-1.1.2/usr/local/php/5.6.18/libexec
66212 60 -rwxr-xr-x  1 jdavid  wheel  61208 Feb  6 21:01 /tmp/pear/temp/pear-build-jdavidzNk9jX/install-raphf-1.1.2/usr/local/php/5.6.18/libexec/raphf.so

Build process completed successfully
Installing '/usr/local/php/5.6.18/libexec/raphf.so'
Installing '/usr/local/php/5.6.18/include/php/ext/raphf/php_raphf.h'
install ok: channel://pecl.php.net/raphf-1.1.2
Extension raphf enabled in php.ini

@m6w6
Copy link
Owner

m6w6 commented Feb 7, 2016

Strange. What's your PEAR version?

pear version

Can you try upgrading PEAR?

pear upgrade PEAR

@jdavidlists
Copy link
Author

This is a fresh install of just-released 5.6.18:

$ /usr/local/php/5.6.18/bin/pear version
PEAR Version: 1.10.1
PHP Version: 5.6.18
Zend Engine Version: 2.6.0

Running "pear upgrade" only tries (unsuccessfully) to upgrade propro and raphf to the versions that require PHP 7:

$ /usr/local/php/5.6.18/bin/pear upgrade
pecl/propro requires PHP (version >= 7.0.0), installed version is 5.6.18
pecl/raphf requires PHP (version >= 7.0.0), installed version is 5.6.18
No valid packages found
upgrade failed
$ /usr/local/php/5.6.18/bin/pear upgrade PEAR
Nothing to upgrade

Thanks!

@m6w6
Copy link
Owner

m6w6 commented Feb 7, 2016

Just reproduced on a freebsd vm.

@jdavidlists
Copy link
Author

With that clue, it was possible to narrow the issue down to some difference between BSD make and GNU make. The following will work:

$ sudo pkg install -y gmake
...
$ MAKE=gmake /usr/local/php/5.6.18/bin/pecl install raphf-1.1.2
...
Build process completed successfully
Installing '/usr/local/php/5.6.18/libexec/raphf.so'
Installing '/usr/local/php/5.6.18/include/php/ext/raphf/php_raphf.h'
Installing '/usr/local/php/5.6.18/include/php/ext/raphf/php_raphf_api.h'
install ok: channel://pecl.php.net/raphf-1.1.2
Extension raphf enabled in php.ini

The same is required for propro. Then, pecl_http will build without include errors.

That's easy enough, so we're all set. But if you want to explore it further, this must be related to some recent Makefile change. It looks like we previously built this OK with raphf 1.1.0, so at a glance it might be this commit:

eeae0a9

Thanks!

@m6w6
Copy link
Owner

m6w6 commented Feb 7, 2016

Yep, just verified myself as a bsd/gnu make issue, maybe bsd make barfs on the $(all_targets): raphf-build-headers rule.

@m6w6
Copy link
Owner

m6w6 commented Feb 7, 2016

...or doesn't it support pattern rules?

@jdavidlists
Copy link
Author

This make is new with 10.x so I don't know its ins and outs yet, but the old version definitely handled pattern rules quite differently. E.g. instead of:

%.o: %.c

It (IIRC) used something else called a "transformation rule" that looks like:

.c.o:

From a glance at the man page, it looks like the new version still does it that way.

@m6w6
Copy link
Owner

m6w6 commented Feb 8, 2016

Apparently I have multiple GNUisms in my Makefile:

https://github.com/m6w6/ext-raphf/blob/master/Makefile.frag#L3
https://github.com/m6w6/ext-raphf/blob/master/Makefile.frag#L5

Thanks for the report, I'll think about a proper fix.

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

No branches or pull requests

2 participants