# Why do PHP 8.1 extensions need PHP headers during make install (worked in <8.1)?

- Thread: https://externals.io/message/116588
- Original archive: https://news-web.php.net/php.internals/116588
- Started by David Zuelke via internals on 2021-12-08T15:24:46+00:00
- Messages: 13
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #116588 — David Zuelke via internals — 2021-12-08T15:24:46+00:00

URL: https://externals.io/message/116588#116588

Hi all,

When building shared extensions for PHP for the purpose of packaging
and distributing the builds, the build environment obviously needs PHP
installed in the destination directory structure (for headers, phpize,
and so forth).

But the resulting archive of the built extension should only contain
the shared object, and possibly the headers.

A common pattern to do achieve is:

1) download/extract PHP to $installdir
2) download/extract extension to $builddir
3) phpize in $builddir
4) make in $builddir
5) rm -rf $installdir
6) make install
7) package up $installdir

Step 6 installs the extension into $installdir - you end up with
/foo/bar/lib/php/extensions/no-debug-non-zts-20210902/something.so

That doesn't work with PHP 8.1 anymore - the Makefile generated by
phpize now contains an include directive at the top level (near the
bottom), e.g.:

-include src/php_raphf_api.dep

Which lists not only the extension's headers, but also all of PHP's
(in include/main, include/Zend, and so forth):

src/php_raphf_api.lo: /tmp/bob-2eBC7e/raphf-2.0.1/src/php_raphf_api.c \
 config.h /app/.heroku/php/include/php/main/php.h \
 /app/.heroku/php/include/php/main/php_version.h \
 /app/.heroku/php/include/php/Zend/zend_stream.h \
 /app/.heroku/php/include/php/main/streams/php_stream_context.h \
… (many more from main/ and Zend/ here)
 /app/.heroku/php/include/php/ext/standard/info.h php_raphf.h \
 php_raphf_api.h php_raphf.h

This results in the 'make install' failing if, like in our step 5
above, PHP itself has been (re-)moved since the 'make' (output that
follows is from a 'make -d install'):

      Considering target file 'src/php_raphf_api.lo'.
…
        Considering target file '/app/.heroku/php/include/php/main/php.h'.
         File '/app/.heroku/php/include/php/main/php.h' does not exist.
         Looking for an implicit rule for
'/app/.heroku/php/include/php/main/php.h'.
         Trying pattern rule with stem 'php'.
         Trying implicit prerequisite
'/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/php.h'.
         Trying pattern rule with stem 'php.h'.
         Trying implicit prerequisite
'/app/.heroku/php/include/php/main/php.h,v'.
         Trying pattern rule with stem 'php.h'.
         Trying implicit prerequisite
'/app/.heroku/php/include/php/main/RCS/php.h,v'.
         Trying pattern rule with stem 'php.h'.
         Trying implicit prerequisite
'/app/.heroku/php/include/php/main/RCS/php.h'.
         Trying pattern rule with stem 'php.h'.
         Trying implicit prerequisite
'/app/.heroku/php/include/php/main/s.php.h'.
         Trying pattern rule with stem 'php.h'.
         Trying implicit prerequisite
'/app/.heroku/php/include/php/main/SCCS/s.php.h'.
         Trying pattern rule with stem 'php'.
         Trying implicit prerequisite
'/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/php.h'.
         Looking for a rule with intermediate file
'/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/php.h'.
          Avoiding implicit rule recursion.
          Trying pattern rule with stem 'php.h'.
          Trying implicit prerequisite
'/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/php.h,v'.
          Trying pattern rule with stem 'php.h'.
          Trying implicit prerequisite
'/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/RCS/php.h,v'.
          Trying pattern rule with stem 'php.h'.
          Trying implicit prerequisite
'/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/RCS/php.h'.
          Trying pattern rule with stem 'php.h'.
          Trying implicit prerequisite
'/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/s.php.h'.
          Trying pattern rule with stem 'php.h'.
          Trying implicit prerequisite
'/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/SCCS/s.php.h'.
         No implicit rule found for '/app/.heroku/php/include/php/main/php.h'.
         Finished prerequisites of target file
'/app/.heroku/php/include/php/main/php.h'.
        Must remake target '/app/.heroku/php/include/php/main/php.h'.
make: *** No rule to make target
'/app/.heroku/php/include/php/main/php.h', needed by
'src/php_raphf_api.lo'.  Stop.

Building extensions for 8.0 or lower doesn't generate such a
`src/php_EXTNAME_api.dep` file.

Is this intentional? If so, could someone explain the purpose of the
change? I couldn't find anything insightful when browsing the Git
logs.

The workaround is to

make INSTALL_ROOT=$SOMETEMPDIR install

and then move things into place for packaging, but I was still
wondering why this change was made in the first place.

Thanks and greetings,

David

---

## #116593 — Glash Gnome — 2021-12-08T23:33:08+00:00

URL: https://externals.io/message/116588#116593 · In reply to: #116588

Hello,

Can you tell me what the program is in step 7)

> package up

Thanks you,


Le mer. 8 déc. 2021 à 16:25, David Zuelke via internals <
internals@lists.php.net> a écrit :

> Hi all,
>
> When building shared extensions for PHP for the purpose of packaging
> and distributing the builds, the build environment obviously needs PHP
> installed in the destination directory structure (for headers, phpize,
> and so forth).
>
> But the resulting archive of the built extension should only contain
> the shared object, and possibly the headers.
>
> A common pattern to do achieve is:
>
> 1) download/extract PHP to $installdir
> 2) download/extract extension to $builddir
> 3) phpize in $builddir
> 4) make in $builddir
> 5) rm -rf $installdir
> 6) make install
> 7) package up $installdir
>
> Step 6 installs the extension into $installdir - you end up with
> /foo/bar/lib/php/extensions/no-debug-non-zts-20210902/something.so
>
> That doesn't work with PHP 8.1 anymore - the Makefile generated by
> phpize now contains an include directive at the top level (near the
> bottom), e.g.:
>
> -include src/php_raphf_api.dep
>
> Which lists not only the extension's headers, but also all of PHP's
> (in include/main, include/Zend, and so forth):
>
> src/php_raphf_api.lo: /tmp/bob-2eBC7e/raphf-2.0.1/src/php_raphf_api.c \
>  config.h /app/.heroku/php/include/php/main/php.h \
>  /app/.heroku/php/include/php/main/php_version.h \
>  /app/.heroku/php/include/php/Zend/zend_stream.h \
>  /app/.heroku/php/include/php/main/streams/php_stream_context.h \
> … (many more from main/ and Zend/ here)
>  /app/.heroku/php/include/php/ext/standard/info.h php_raphf.h \
>  php_raphf_api.h php_raphf.h
>
> This results in the 'make install' failing if, like in our step 5
> above, PHP itself has been (re-)moved since the 'make' (output that
> follows is from a 'make -d install'):
>
>       Considering target file 'src/php_raphf_api.lo'.
> …
>         Considering target file '/app/.heroku/php/include/php/main/php.h'.
>          File '/app/.heroku/php/include/php/main/php.h' does not exist.
>          Looking for an implicit rule for
> '/app/.heroku/php/include/php/main/php.h'.
>          Trying pattern rule with stem 'php'.
>          Trying implicit prerequisite
> '/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/php.h'.
>          Trying pattern rule with stem 'php.h'.
>          Trying implicit prerequisite
> '/app/.heroku/php/include/php/main/php.h,v'.
>          Trying pattern rule with stem 'php.h'.
>          Trying implicit prerequisite
> '/app/.heroku/php/include/php/main/RCS/php.h,v'.
>          Trying pattern rule with stem 'php.h'.
>          Trying implicit prerequisite
> '/app/.heroku/php/include/php/main/RCS/php.h'.
>          Trying pattern rule with stem 'php.h'.
>          Trying implicit prerequisite
> '/app/.heroku/php/include/php/main/s.php.h'.
>          Trying pattern rule with stem 'php.h'.
>          Trying implicit prerequisite
> '/app/.heroku/php/include/php/main/SCCS/s.php.h'.
>          Trying pattern rule with stem 'php'.
>          Trying implicit prerequisite
> '/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/php.h'.
>          Looking for a rule with intermediate file
> '/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/php.h'.
>           Avoiding implicit rule recursion.
>           Trying pattern rule with stem 'php.h'.
>           Trying implicit prerequisite
>
> '/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/php.h,v'.
>           Trying pattern rule with stem 'php.h'.
>           Trying implicit prerequisite
>
> '/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/RCS/php.h,v'.
>           Trying pattern rule with stem 'php.h'.
>           Trying implicit prerequisite
>
> '/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/RCS/php.h'.
>           Trying pattern rule with stem 'php.h'.
>           Trying implicit prerequisite
>
> '/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/s.php.h'.
>           Trying pattern rule with stem 'php.h'.
>           Trying implicit prerequisite
>
> '/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/SCCS/s.php.h'.
>          No implicit rule found for
> '/app/.heroku/php/include/php/main/php.h'.
>          Finished prerequisites of target file
> '/app/.heroku/php/include/php/main/php.h'.
>         Must remake target '/app/.heroku/php/include/php/main/php.h'.
> make: *** No rule to make target
> '/app/.heroku/php/include/php/main/php.h', needed by
> 'src/php_raphf_api.lo'.  Stop.
>
> Building extensions for 8.0 or lower doesn't generate such a
> `src/php_EXTNAME_api.dep` file.
>
> Is this intentional? If so, could someone explain the purpose of the
> change? I couldn't find anything insightful when browsing the Git
> logs.
>
> The workaround is to
>
> make INSTALL_ROOT=$SOMETEMPDIR install
>
> and then move things into place for packaging, but I was still
> wondering why this change was made in the first place.
>
> Thanks and greetings,
>
> David
>
> --
> 
> To unsubscribe, visit: https://www.php.net/unsub.php

---

## #116594 — David Zuelke via internals — 2021-12-09T00:20:24+00:00

URL: https://externals.io/message/116588#116594 · In reply to: #116593

That's... sort of... irrelevant for this question; the problem appears
before that step. You could make a tarball of the built extension,
create a .deb archive, whatever; the point is that it should be
installable standalone (think e.g. 'apt-get install php81-imagick').




>
> Hello,
>
> Can you tell me what the program is in step 7)
>
> > […]
>
> Thanks you,
>
>
> Le mer. 8 déc. 2021 à 16:25, David Zuelke via internals <internals@lists.php.net> a écrit :
> > […]

---

## #116595 — Glash Gnome — 2021-12-09T01:29:55+00:00

URL: https://externals.io/message/116588#116595 · In reply to: #116594

Thanks, I'll check it out.

I'm confused. Can you tell me if you have this problem with this extension
(PHP8 / 7/5>):
https://github.com/gtkphp/php-ext-cairo-src checkout PHP-8.0

At the moment I need to check some dependency to try your extension.
I'll keep you informed.

Best Regards

Le jeu. 9 déc. 2021 à 01:20, David Zuelke <dzuelke@salesforce.com> a écrit :

> That's... sort of... irrelevant for this question; the problem appears
> before that step. You could make a tarball of the built extension,
> create a .deb archive, whatever; the point is that it should be
> installable standalone (think e.g. 'apt-get install php81-imagick').
>
>
>
> 
> > […]
> internals@lists.php.net> a écrit :
> > […]
> '/app/.heroku/php/include/php/main/php.h'.
> > […]
> '/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/php.h'.
> > […]
> '/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/php.h'.
> > […]
> '/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/php.h'.
> > […]
> '/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/php.h,v'.
> > […]
> '/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/RCS/php.h,v'.
> > […]
> '/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/RCS/php.h'.
> > […]
> '/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/s.php.h'.
> > […]
> '/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/SCCS/s.php.h'.
> > […]
> '/app/.heroku/php/include/php/main/php.h'.
> > […]

---

## #116596 — David Zuelke via internals — 2021-12-09T02:19:01+00:00

URL: https://externals.io/message/116588#116596 · In reply to: #116595

Yes, of course; it happens with any extension, because the Makefile
generated by 8.1's 'phpize' now lists those header dependencies even
for 'make install'.

Like I described, you can reproduce this by 'make'ing the extension,
then moving the PHP you used to build the extension, then running
'make install' (sample with your ext, on my build environment for
Heroku's PHP support):

root@8f6813d6dc88:/app# export PATH=/app/.heroku/php/bin:$PATH
root@8f6813d6dc88:/app# which php
/app/.heroku/php/bin/php
root@8f6813d6dc88:/app# php -v
PHP 8.1.0 (cli) (built: Dec  8 2021 20:43:30) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.0, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.0, Copyright (c), by Zend Technologies

root@8f6813d6dc88:/app# mkdir /tmp/build-ext-cairo
root@8f6813d6dc88:/app# cd /tmp/build-ext-cairo/
root@8f6813d6dc88:/tmp/build-ext-cairo# git clone
https://github.com/gtkphp/php-ext-cairo-src
Cloning into 'php-ext-cairo-src'...
…

root@8f6813d6dc88:/tmp/build-ext-cairo# cd php-ext-cairo-src/
root@8f6813d6dc88:/tmp/build-ext-cairo/php-ext-cairo-src# git checkout
origin/PHP-8.0
Note: checking out 'origin/PHP-8.0'.

You are in 'detached HEAD' state. You can look around, make experimental
…

HEAD is now at 2cd2ce9 Fix test( compatibility PHP-8)

root@8f6813d6dc88:/tmp/build-ext-cairo/php-ext-cairo-src# phpize
Configuring for:
PHP Api Version:         20210902
Zend Module Api No:      20210902
Zend Extension Api No:   420210902

root@8f6813d6dc88:/tmp/build-ext-cairo/php-ext-cairo-src# ./configure
--prefix=/app/.heroku/php
…

root@8f6813d6dc88:/tmp/build-ext-cairo/php-ext-cairo-src# make -j9
…
Build complete.
Don't forget to run 'make test'.

root@8f6813d6dc88:/tmp/build-ext-cairo/php-ext-cairo-src# mv
/app/.heroku/php{,_}

root@8f6813d6dc88:/tmp/build-ext-cairo/php-ext-cairo-src# make install
make: *** No rule to make target
'/app/.heroku/php/include/php/main/php.h', needed by 'cairo.lo'.
Stop.



>
> Thanks, I'll check it out.
>
> I'm confused. Can you tell me if you have this problem with this extension (PHP8 / 7/5>):
> https://github.com/gtkphp/php-ext-cairo-src checkout PHP-8.0
>
> At the moment I need to check some dependency to try your extension.
> I'll keep you informed.
>
> Best Regards
>
> Le jeu. 9 déc. 2021 à 01:20, David Zuelke <dzuelke@salesforce.com> a écrit :
> > […]

---

## #116602 — Glash Gnome — 2021-12-09T15:52:55+00:00

URL: https://externals.io/message/116588#116602 · In reply to: #116596

Thanks a lot.
I use PHP 8.2.0-dev (cli) (built: Dec  8 2021 23:53:19) (NTS)
And I can't reproduce the error with my build procedure.
But, if I use "make -d install' insteadof *"make && make install'* I get
errors.

Can you confirm it ?





Le jeu. 9 déc. 2021 à 03:19, David Zuelke <dzuelke@salesforce.com> a écrit :

> Yes, of course; it happens with any extension, because the Makefile
> generated by 8.1's 'phpize' now lists those header dependencies even
> for 'make install'.
>
> Like I described, you can reproduce this by 'make'ing the extension,
> then moving the PHP you used to build the extension, then running
> 'make install' (sample with your ext, on my build environment for
> Heroku's PHP support):
>
> root@8f6813d6dc88:/app# export PATH=/app/.heroku/php/bin:$PATH
> root@8f6813d6dc88:/app# which php
> /app/.heroku/php/bin/php
> root@8f6813d6dc88:/app# php -v
> PHP 8.1.0 (cli) (built: Dec  8 2021 20:43:30) (NTS)
> Copyright (c) The PHP Group
> Zend Engine v4.1.0, Copyright (c) Zend Technologies
>     with Zend OPcache v8.1.0, Copyright (c), by Zend Technologies
>
> root@8f6813d6dc88:/app# mkdir /tmp/build-ext-cairo
> root@8f6813d6dc88:/app# cd /tmp/build-ext-cairo/
> root@8f6813d6dc88:/tmp/build-ext-cairo# git clone
> https://github.com/gtkphp/php-ext-cairo-src
> Cloning into 'php-ext-cairo-src'...
> …
>
> root@8f6813d6dc88:/tmp/build-ext-cairo# cd php-ext-cairo-src/
> root@8f6813d6dc88:/tmp/build-ext-cairo/php-ext-cairo-src# git checkout
> origin/PHP-8.0
> Note: checking out 'origin/PHP-8.0'.
>
> You are in 'detached HEAD' state. You can look around, make experimental
> …
>
> HEAD is now at 2cd2ce9 Fix test( compatibility PHP-8)
>
> root@8f6813d6dc88:/tmp/build-ext-cairo/php-ext-cairo-src# phpize
> Configuring for:
> PHP Api Version:         20210902
> Zend Module Api No:      20210902
> Zend Extension Api No:   420210902
>
> root@8f6813d6dc88:/tmp/build-ext-cairo/php-ext-cairo-src# ./configure
> --prefix=/app/.heroku/php
> …
>
> root@8f6813d6dc88:/tmp/build-ext-cairo/php-ext-cairo-src# make -j9
> …
> Build complete.
> Don't forget to run 'make test'.
>
> root@8f6813d6dc88:/tmp/build-ext-cairo/php-ext-cairo-src# mv
> /app/.heroku/php{,_}
>
> root@8f6813d6dc88:/tmp/build-ext-cairo/php-ext-cairo-src# make install
> make: *** No rule to make target
> '/app/.heroku/php/include/php/main/php.h', needed by 'cairo.lo'.
> Stop.
>
>
> 
> > […]
> extension (PHP8 / 7/5>):
> > […]
> écrit :
> > […]
> wrote:
> > […]
> internals@lists.php.net> a écrit :
> > […]
> PHP
> > […]
> phpize,
> > […]
> /tmp/bob-2eBC7e/raphf-2.0.1/src/php_raphf_api.c \
> > […]
> '/app/.heroku/php/include/php/main/php.h'.
> > […]
> exist.
> > […]
> '/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/php.h'.
> > […]
> '/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/php.h'.
> > […]
> '/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/php.h'.
> > […]
> '/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/php.h,v'.
> > […]
> '/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/RCS/php.h,v'.
> > […]
> '/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/RCS/php.h'.
> > […]
> '/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/s.php.h'.
> > […]
> '/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/SCCS/s.php.h'.
> > […]
> '/app/.heroku/php/include/php/main/php.h'.
> > […]

---

## #116603 — David Zuelke via internals — 2021-12-09T16:34:39+00:00

URL: https://externals.io/message/116588#116603 · In reply to: #116602

Of course a 'make && make install' works. That is *not* what's broken
since 8.1, and not what I'm talking about.



>
> Thanks a lot.
> I use PHP 8.2.0-dev (cli) (built: Dec  8 2021 23:53:19) (NTS)
> And I can't reproduce the error with my build procedure.
> But, if I use "make -d install' insteadof "make && make install' I get errors.
>
> Can you confirm it ?
>
>
>
>
>
> Le jeu. 9 déc. 2021 à 03:19, David Zuelke <dzuelke@salesforce.com> a écrit :
> > […]

---

## #116604 — Glash Gnome — 2021-12-09T17:14:04+00:00

URL: https://externals.io/message/116588#116604 · In reply to: #116603

Right.
> configure && make && make install
works.

For my personal information : Now which command should I use to get the
error ?


Le jeu. 9 déc. 2021 à 17:34, David Zuelke <dzuelke@salesforce.com> a écrit :

> Of course a 'make && make install' works. That is *not* what's broken
> since 8.1, and not what I'm talking about.
>
>
> 
> > […]
> errors.
> > […]
> écrit :
> > […]
> wrote:
> > […]
> extension (PHP8 / 7/5>):
> > […]
> écrit :
> > […]
> appears
> > […]
> wrote:
> > […]
> internals@lists.php.net> a écrit :
> > […]
> packaging
> > […]
> needs PHP
> > […]
> phpize,
> > […]
> contain
> > […]
> the
> > […]
> PHP's
> > […]
> /tmp/bob-2eBC7e/raphf-2.0.1/src/php_raphf_api.c \
> > […]
> that
> > […]
> '/app/.heroku/php/include/php/main/php.h'.
> > […]
> exist.
> > […]
> '/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/php.h'.
> > […]
> '/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/php.h'.
> > […]
> '/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/php.h'.
> > […]
> '/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/php.h,v'.
> > […]
> '/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/RCS/php.h,v'.
> > […]
> '/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/RCS/php.h'.
> > […]
> '/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/s.php.h'.
> > […]
> '/app/.heroku/php/include/php/main//tmp/bob-1830jl/raphf-2.0.1/src/SCCS/s.php.h'.
> > […]
> '/app/.heroku/php/include/php/main/php.h'.
> > […]
> '/app/.heroku/php/include/php/main/php.h'.
> > […]
> the
> > […]

---

## #116605 — David Zuelke via internals — 2021-12-09T18:04:33+00:00

URL: https://externals.io/message/116588#116605 · In reply to: #116604

See my previous messages; there's step by step output where I trigger
it with your extension by renaming the directory containing the PHP
it's built against (this obviously requires you have a PHP that's
built with --prefix=/usr/local/myphpbuild or whatever).

I suppose the solution for now is to use 'make
INSTALL_ROOT=/tmp/mypackagedir install', but that's a PHP specific
thing; other software, like Nginx for example, uses the more
"standard" DESTDIR variable as recommended by
https://www.gnu.org/prep/standards/html_node/DESTDIR.html for staged
installs.

That's why I am asking here for the reason this change was made. If
it's unintentional, then it should be fixable; if it's on purpose,
then maybe migrating PHP's Makefiles to also use DESTDIR would be
useful in order to allow generic build tooling to have fewer special
cases for PHP.

David



>
> Right.
> > […]
> works.
>
> For my personal information : Now which command should I use to get the error ?
>
>
> Le jeu. 9 déc. 2021 à 17:34, David Zuelke <dzuelke@salesforce.com> a écrit :
> > […]

---

## #116606 — Dan Ackroyd — 2021-12-09T19:28:18+00:00

URL: https://externals.io/message/116588#116606 · In reply to: #116588

On Wed, 8 Dec 2021 at 15:25, David Zuelke via internals
<internals@lists.php.net> wrote:
>
> That doesn't work with PHP 8.1 anymore - the Makefile generated by
> phpize now contains an include directive at the top level (near the
> bottom), e.g.:
>
> -include src/php_raphf_api.dep

The file src/php_raphf_api.dep is created when the source code is
compiled. It creates a list of which files were used in the
compilation of a C file. In this case src/php_raphf_api.c

The '-include' directive apparently allows for a file to be listed,
but not error when it doesn't exist, apparently:
https://www.gnu.org/software/make/manual/html_node/Features.html so on
a fresh cleaned build, it shouldn't make any difference.

> Which lists not only the extension's headers, but also all of PHP's
> (in include/main, include/Zend, and so forth):

Yes. Those are the files that need to be present to compile that
source code file. It's used to check to see if a C file should be
recompiled, as one of it's dependencies has changed. The dep file is
also deleted when doing make clean.

It doesn't appear to me that the change to the phpize and the dep file
is affecting other people....I think the problem you're seeing is
something unique to your build process. In particular:

1. Are you doing a make clean, or is there a chance of left over files
from a previous build?

2. Why are you (as far as I understand) deleting the PHP files in `5)
rm -rf $installdir`, before compiling the extension? The command `make
install` does a check on whether anything needs recompiling.....and I
believe it's failing because the files it's trying to check no longer
exist.

>  Is this intentional? If so, could someone explain the purpose of the change?

Probably to make the build process less flaky, by explicitly checking
dependencies, so that there are fewer instances of "stuffs not
working.....I guess I'll do a make clean and see if that helps".

cheers
Dan
Ack

---

## #116607 — Dan Ackroyd — 2021-12-09T19:41:06+00:00

URL: https://externals.io/message/116588#116607 · In reply to: #116606

> > […]
>
> Probably to make the build process less flaky, by explicitly checking
> dependencies, so that there are fewer instances of "stuffs not
> working.....I guess I'll do a make clean and see if that helps".
>

And of course I find the commit just after sending previous email:

commit - https://github.com/php/php-src/commit/c4d508c2bc09860bfa15b7f520e0ba68425acfc1
reasoning - https://github.com/php/php-src/pull/6693

cheers
Dan
Ack

---

## #116617 — David Zuelke via internals — 2021-12-09T22:50:25+00:00

URL: https://externals.io/message/116588#116617 · In reply to: #116606

Thanks for your response! I'm not removing PHP before *compiling*, I
am removing it before *installing*:

1) download/extract PHP (as a build dependency) to $PREFIX
2) phpize
3) ./configure --prefix=$PREFIX
4) make
5) remove PHP from $PREFIX
6) make install

The purpose is to have a clean $PREFIX directory that, in its
entirety, can be compressed into an archive for distribution of only
that extension's files.

Does that make sense?


>
> On Wed, 8 Dec 2021 at 15:25, David Zuelke via internals
> <internals@lists.php.net> wrote:
> > […]
>
> The file src/php_raphf_api.dep is created when the source code is
> compiled. It creates a list of which files were used in the
> compilation of a C file. In this case src/php_raphf_api.c
>
> The '-include' directive apparently allows for a file to be listed,
> but not error when it doesn't exist, apparently:
> https://www.gnu.org/software/make/manual/html_node/Features.html so on
> a fresh cleaned build, it shouldn't make any difference.
>
> > […]
>
> Yes. Those are the files that need to be present to compile that
> source code file. It's used to check to see if a C file should be
> recompiled, as one of it's dependencies has changed. The dep file is
> also deleted when doing make clean.
>
> It doesn't appear to me that the change to the phpize and the dep file
> is affecting other people....I think the problem you're seeing is
> something unique to your build process. In particular:
>
> 1. Are you doing a make clean, or is there a chance of left over files
> from a previous build?
>
> 2. Why are you (as far as I understand) deleting the PHP files in `5)
> rm -rf $installdir`, before compiling the extension? The command `make
> install` does a check on whether anything needs recompiling.....and I
> believe it's failing because the files it's trying to check no longer
> exist.
>
> > […]
>
> Probably to make the build process less flaky, by explicitly checking
> dependencies, so that there are fewer instances of "stuffs not
> working.....I guess I'll do a make clean and see if that helps".
>
> cheers
> Dan
> Ack

---

## #116618 — David Zuelke via internals — 2021-12-09T22:59:06+00:00

URL: https://externals.io/message/116588#116618 · In reply to: #116607

Ahhh okay that explains where this change is coming from. Thanks a lot, Dan!

I wonder if this side effect ("all dependencies are iterated also
during "make install") is intentional.

Maybe Niki can chime in on GitHub; I'll ping him there, as well as the
original author.

Thanks a lot!

David

P.S. regarding your earlier comment on the '-include' directive - that
allows the actual file you're specifying there to be missing; not any
file names listed inside it - the purpose is to optionally let
generic/templated Makefiles specify a file that lists additional
includes, but making that file itself optional.


>
> 
> > […]
>
> And of course I find the commit just after sending previous email:
>
> commit - https://github.com/php/php-src/commit/c4d508c2bc09860bfa15b7f520e0ba68425acfc1
> reasoning - https://github.com/php/php-src/pull/6693
>
> cheers
> Dan
> Ack
