Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116605 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 25730 invoked from network); 9 Dec 2021 17:04:01 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 9 Dec 2021 17:04:01 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 33F74180510 for ; Thu, 9 Dec 2021 10:04:46 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-yb1-f172.google.com (mail-yb1-f172.google.com [209.85.219.172]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 9 Dec 2021 10:04:45 -0800 (PST) Received: by mail-yb1-f172.google.com with SMTP id y68so15685662ybe.1 for ; Thu, 09 Dec 2021 10:04:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=salesforce.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=dlXkKuQ+QOcGW1ela/1FSb0JzdBWzxcg7jR6tGmSvQY=; b=ZUKNaSmoUU70fBKy4NVMAGj3EcSYFI0KQ+Kmph2o85TkmySjlBiCJRStC9ProCLnuY zAsXmvhXrl1qFQy13u2/9q/e/WeiitE3VkvPHYKOCgtofs0mzFBA6se0Ega1ow0LPTV+ GR07/lQjvtV/V0g1pfZ6AAsasgz8DhTv+uubA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=dlXkKuQ+QOcGW1ela/1FSb0JzdBWzxcg7jR6tGmSvQY=; b=3/dqFkNhq/S+pBRXsZrGeAOiiHUzeFMNJNXWSlvBHzGFpvNW4+o8aZgXVWWklM2xzt 2z2A9OgQ8K0JT4TTbRXzWVtbFa9ZqyVmcL8bN4qjzXOlNIoLqGfI9b0yv+ufAaPCIa0C 5YZ4qPkHyrGLhvNYMSIIaxcqoIHJehzIX2ng4A+ehdSNzvdto7MXOpbkvqMNTaD3m+7l nL1rHDuQal/tfgc5Xz7vlV3PAt5vaG8BwH9+6XeyfaV79Gl3ZXTgc4jFVC202ype72Px NZti0eRQDukrPVv2SH+bUhBAj1n2MCpZs/uUVByHlfngDYHZlQTqEur3+YoKa6Wbxs7s gnyg== X-Gm-Message-State: AOAM531FrLm8iy/6YqSN+4DBr6o13leW/6V2LJ+H+izwA93RjtKg4xqY 958QZPBORhUAxd5LBifsdll9ldMhDjHgfWtlg4QCjA== X-Google-Smtp-Source: ABdhPJwus7iW1v3xihaVi0Q0kv1d8NP54cGzN48dhHkXrX2anlpNCKYS8QBSXatnL4HeCC/Q2rk7kTfhego1bu7fk3I= X-Received: by 2002:a05:6902:1209:: with SMTP id s9mr8599479ybu.172.1639073084717; Thu, 09 Dec 2021 10:04:44 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Reply-To: David Zuelke Date: Thu, 9 Dec 2021 19:04:33 +0100 Message-ID: To: Glash Gnome Cc: PHP internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Why do PHP 8.1 extensions need PHP headers during make install (worked in <8.1)? From: internals@lists.php.net ("David Zuelke via internals") 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=3D/usr/local/myphpbuild or whatever). I suppose the solution for now is to use 'make INSTALL_ROOT=3D/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 On Thu, Dec 9, 2021 at 6:14 PM Glash Gnome wrote: > > Right. > > configure && make && make install > works. > > For my personal information : Now which command should I use to get the e= rror ? > > > Le jeu. 9 d=C3=A9c. 2021 =C3=A0 17:34, David Zuelke a =C3=A9crit : >> >> Of course a 'make && make install' works. That is *not* what's broken >> since 8.1, and not what I'm talking about. >> >> >> On Thu, Dec 9, 2021 at 4:53 PM Glash Gnome wrote= : >> > >> > 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=C3=A9c. 2021 =C3=A0 03:19, David Zuelke a =C3=A9crit : >> >> >> >> 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=3D/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'... >> >> =E2=80=A6 >> >> >> >> root@8f6813d6dc88:/tmp/build-ext-cairo# cd php-ext-cairo-src/ >> >> root@8f6813d6dc88:/tmp/build-ext-cairo/php-ext-cairo-src# git checkou= t >> >> origin/PHP-8.0 >> >> Note: checking out 'origin/PHP-8.0'. >> >> >> >> You are in 'detached HEAD' state. You can look around, make experimen= tal >> >> =E2=80=A6 >> >> >> >> 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=3D/app/.heroku/php >> >> =E2=80=A6 >> >> >> >> root@8f6813d6dc88:/tmp/build-ext-cairo/php-ext-cairo-src# make -j9 >> >> =E2=80=A6 >> >> 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 instal= l >> >> make: *** No rule to make target >> >> '/app/.heroku/php/include/php/main/php.h', needed by 'cairo.lo'. >> >> Stop. >> >> >> >> >> >> On Thu, Dec 9, 2021 at 2:30 AM Glash Gnome wr= ote: >> >> > >> >> > Thanks, I'll check it out. >> >> > >> >> > I'm confused. Can you tell me if you have this problem with this ex= tension (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=C3=A9c. 2021 =C3=A0 01:20, David Zuelke a =C3=A9crit : >> >> >> >> >> >> That's... sort of... irrelevant for this question; the problem app= ears >> >> >> 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 wrote: >> >> >> > >> >> >> > Hello, >> >> >> > >> >> >> > Can you tell me what the program is in step 7) >> >> >> > >> >> >> > > package up >> >> >> > >> >> >> > Thanks you, >> >> >> > >> >> >> > >> >> >> > Le mer. 8 d=C3=A9c. 2021 =C3=A0 16:25, David Zuelke via internal= s a =C3=A9crit : >> >> >> >> >> >> >> >> Hi all, >> >> >> >> >> >> >> >> When building shared extensions for PHP for the purpose of pack= aging >> >> >> >> and distributing the builds, the build environment obviously ne= eds PHP >> >> >> >> installed in the destination directory structure (for headers, = phpize, >> >> >> >> and so forth). >> >> >> >> >> >> >> >> But the resulting archive of the built extension should only co= ntain >> >> >> >> 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 wit= h >> >> >> >> /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 P= HP'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= \ >> >> >> >> =E2=80=A6 (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'. >> >> >> >> =E2=80=A6 >> >> >> >> Considering target file '/app/.heroku/php/include/php/m= ain/php.h'. >> >> >> >> File '/app/.heroku/php/include/php/main/php.h' does no= t 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/p= hp/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/p= hp.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 o= f the >> >> >> >> change? I couldn't find anything insightful when browsing the G= it >> >> >> >> logs. >> >> >> >> >> >> >> >> The workaround is to >> >> >> >> >> >> >> >> make INSTALL_ROOT=3D$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 >> >> >> >>