Re: Why do PHP 8.1 extensions need PHP headers during make install (worked in <8.1)?
| From: | David Zuelke via internals | Date: | Thu, 09 Dec 2021 00:20:24 +0000 |
| Subject: | Re: Why do PHP 8.1 extensions need PHP headers during make install (worked in <8.1)? | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-116594@lists.php.net to get a copy of this message | ||
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').
On Thu, Dec 9, 2021 at 12:33 AM Glash Gnome <glash.gnome@gmail.com> wrote:
>
> 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
>>
>> --
>> PHP Internals - PHP Runtime Development Mailing List
>> To unsubscribe, visit: https://www.php.net/unsub.php
>>