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

Add php-8.4 modules #34683

Merged
merged 10 commits into from
Nov 21, 2024
Merged

Add php-8.4 modules #34683

merged 10 commits into from
Nov 21, 2024

Conversation

smoser
Copy link
Member

@smoser smoser commented Nov 20, 2024

First, just add the modules, copying from 8.3 versions.

$ for p in php-8.3-*.yaml; do
  sed -e 's,epoch: .*,epoch: 0,' \
      -e 's,name: php-8.3-,name: php-8.4-,' \
     "$p" > php-8.4${p#php-8.3};
done

Then fix some to build with 8.4, cherry picking from upstream.

  • php-8.4-pecl-mcrypt - cherry-pick a PR to build for 8.4
    Grab use php_mt_rand_range for 8.4 php/pecl-encryption-mcrypt#19
    which just uses php_mt_rand_range rather than now-removed php_rand.

  • php-8.4-imagick - cherry pick pr to build for 8.4
    Grab Fix removed "php_strtolower" for PHP 8.4 Imagick/imagick#690
    to replace php_strlower with zend_str_tolower

  • php-8.4-xdebug - cherry pick several upstream changes
    NOTE: I have very low confidence in this, other than it builds.
    xdebug is active and likely to release a 3.4.0 release soon
    that has php 8.4 support properly.

    By adding php-8.4-xdebug with updates enabled, we will get
    a PR automatically made and hopefully landed just by dropping
    the cherry-picks here.

  • Drop php-8.4-swoole - not supported upstream yet.

    Several changes would be needed to make the 5.1.5
    version of swoole build with php 8.4.
    Upstream explicitly removed support from
    the 5.1 branch [5.1]remove php8.4 support swoole/swoole-src#5525

    There is likely 6.0.0 release coming soon (beta released 2024-10-17).
    We will have to manually re-add at that point in time.

  • php-8.4-memcached and php-8.4-redis are separated out to another PR
    as they are dependent on php-8.4-igbinary output.

Copy link
Contributor

octo-sts bot commented Nov 20, 2024

Gen AI suggestions to solve the build error:

• Detected Error:

/home/build/imagick.c:606:49: error: implicit declaration of function 'php_strtolower'; did you mean 'php_strtok_r'? [-Wimplicit-function-declaration]

• Error Category: Build/Compilation

• Failure Point: C compilation of imagick.c during make install

• Root Cause Analysis:
The error occurs because the php_strtolower() function declaration is missing. This is likely due to PHP 8.4 changing internal API functions or header locations. The php_strtolower() function was previously available but may have been moved or renamed in PHP 8.4.

• Suggested Fix:

  1. Include the correct header file that contains php_strtolower():
#include "ext/standard/php_string.h"
  1. Or replace php_strtolower() with zend_str_tolower():
zend_str_tolower(Z_STRVAL_P(retval), Z_STRLEN_P(retval));

• Explanation:
PHP 8.4 is still in development (alpha/beta), and internal APIs may have changed. The zend_str_tolower() function is the preferred method in newer PHP versions for string case conversion. This change aligns with PHP's internal API evolution.

• Additional Notes:

  • This is a common issue when PHP extensions need to be updated for newer PHP versions
  • The fix using zend_str_tolower() is more future-proof as it's part of the stable Zend API
  • Similar issues have occurred in other extensions during PHP 8.x transitions

• References:

Submit a patch to the Imagick repository to fix this compatibility issue with PHP 8.4, as this is likely affecting other users trying to build with PHP 8.4 as well.

Copy link
Contributor

octo-sts bot commented Nov 20, 2024

Gen AI suggestions to solve the build error:

• Detected Error: "error getting package dependencies: solving 'php-8.4-igbinary-dev' constraint: could not find package that provides php-8.4-igbinary-dev in indexes"

• Error Category: Dependency

• Failure Point: Environment setup phase when trying to install build dependencies

• Root Cause Analysis: The build is failing because it cannot find the php-8.4-igbinary-dev package in the configured repositories. PHP 8.4 is currently in development/alpha, so its extensions and development packages may not be available yet.

• Suggested Fix:

  1. Remove php-8.4-igbinary-dev from environment.contents.packages temporarily
  2. Add build flag to disable igbinary support in the Configure step:
  - name: Configure
    runs: ./configure --disable-memcached-igbinary

• Explanation: The igbinary extension is an optional serializer for memcached. Since PHP 8.4 is still in development, we can build the memcached extension without igbinary support initially. This will allow the package to build while waiting for the igbinary extension to become available for PHP 8.4.

• Additional Notes:

  • Once php-8.4-igbinary-dev becomes available, the igbinary support can be re-enabled
  • This is a common pattern when dealing with PHP alpha/beta releases where not all extensions are immediately available
  • The memcached extension will still function, just without igbinary serialization support

• References:

Copy link
Contributor

octo-sts bot commented Nov 20, 2024

Gen AI suggestions to solve the build error:

• Detected Error:

fatal error: ext/standard/php_lcg.h: No such file or directory
   15 | #include "ext/standard/php_lcg.h"

• Error Category: Dependency/Build Configuration

• Failure Point: Compilation of php_http_misc.c and php_http_message_body.c failing due to missing header file

• Root Cause Analysis:
The build is failing because it cannot find the PHP standard extension header file php_lcg.h. This file is part of PHP's standard extension development files and needs to be available during compilation.

• Suggested Fix:
Add php-${{vars.phpMM}}-dev-standard to the environment packages:

environment:
  contents:
    packages:
      - php-${{vars.phpMM}}-dev
      - php-${{vars.phpMM}}-dev-standard   # Add this line

• Explanation:
The PECL HTTP extension requires access to PHP's internal standard extension headers for compilation. The php_lcg.h file is part of these standard headers. Adding the dev-standard package will provide the necessary header files.

• Additional Notes:

  • The build system appears to be using PHP 8.4
  • Several curl deprecation warnings are present but not causing build failures
  • The standard extension headers are required for PHP extension development
  • This is a common requirement for PHP extensions that interact with PHP's core functionality

• References:

Copy link
Contributor

octo-sts bot commented Nov 20, 2024

Gen AI suggestions to solve the build error:

• Detected Error:

/home/build/mcrypt.c:41:10: fatal error: ext/standard/php_rand.h: No such file or directory
   41 | #include "ext/standard/php_rand.h"

• Error Category: Dependency/Build

• Failure Point: Compilation of mcrypt.c during make step

• Root Cause Analysis: The build is failing because it cannot find the PHP standard extension header file php_rand.h. This typically means the PHP development files are not properly installed or the include paths are not correctly set.

• Suggested Fix:

  1. Add php-8.4-standard-dev to the environment packages:
environment:
  contents:
    packages:
      - php-${{vars.phpMM}}-dev
      - php-${{vars.phpMM}}-standard-dev  # Add this line

• Explanation:
The mcrypt extension requires headers from PHP's standard extension. While php-8.4-dev provides core PHP development files, the standard extension headers are packaged separately in php-8.4-standard-dev. Adding this package will provide the missing php_rand.h header file.

• Additional Notes:

  • This is a common issue when building PHP extensions that depend on headers from other PHP extensions
  • The standard extension is part of PHP core but its development files are often packaged separately
  • Similar issues can occur with other PHP extensions that depend on standard extension headers

• References:

Copy link
Contributor

octo-sts bot commented Nov 20, 2024

Gen AI suggestions to solve the build error:

• Detected Error: "error getting package dependencies: solving 'php-8.4-igbinary-dev' constraint: could not find package that provides php-8.4-igbinary-dev in indexes"

• Error Category: Dependency

• Failure Point: Environment setup phase when installing build dependencies

• Root Cause Analysis: The build is failing because it cannot find the php-8.4-igbinary-dev package in the configured repositories. This is likely because PHP 8.4 is still in development/alpha and not yet available in the Wolfi repositories.

• Suggested Fix:

  1. Modify the package to use PHP 8.3 instead:
vars:
  phpMM: "8.3"
  phpPriority: 803
  1. Update all references to PHP 8.4 in the package name and dependencies accordingly:
package:
  name: php-8.3-redis

• Explanation: PHP 8.4 is currently in development (alpha stage) and its packages are not yet available in Wolfi repositories. PHP 8.3 is the latest stable version and should be used instead. The redis extension is compatible with PHP 8.3, and this change will allow the package to build successfully.

• Additional Notes:

  • PHP 8.4 is scheduled for release in Q4 2024
  • The package can be updated to PHP 8.4 once it's officially released and available in Wolfi
  • The redis extension maintains compatibility with PHP's stable releases

• References:

Copy link
Contributor

octo-sts bot commented Nov 20, 2024

Gen AI suggestions to solve the build error:

Based on the build error output, I'll provide a detailed analysis and solution:

• Detected Error:

/home/build/ext-src/swoole_coroutine.cc:994:57: error: 'ZEND_EXIT' was not declared in this scope
/home/build/ext-src/swoole_redis_server.cc:159:5: error: 'php_strtolower' was not declared in this scope

• Error Category: Build/Dependency

• Failure Point: Compilation of swoole extension source files

• Root Cause Analysis:

  1. Missing PHP development headers or incompatible PHP version
  2. The code is trying to use PHP internals that have changed in PHP 8.4
  3. Swoole 5.1.5 may not be fully compatible with PHP 8.4

• Suggested Fix:
Add the following dependencies to the environment section:

environment:
  contents:
    packages:
      - autoconf
      - brotli-dev
      - build-base
      - busybox
      - php-${{vars.phpMM}}
      - php-${{vars.phpMM}}-dev
      - php-pecl-dev  # Add this
      - php-dev      # Add this
      - libc-dev     # Add this
      - linux-headers # Add this

• Explanation:
The build errors indicate missing PHP development headers and changed internal APIs. The additional packages will provide the necessary development files and headers needed for building PHP extensions against PHP 8.4.

• Additional Notes:

  • Swoole 5.1.5 may need patches for full PHP 8.4 compatibility
  • Consider adding configure flags for PHP 8.4 compatibility:
  - name: Configure
    runs: |
      set -x
      ./configure --enable-swoole-curl --enable-http2 --enable-sockets --enable-openssl

• References:

Would you like me to provide any additional details about any part of this solution?

Copy link
Contributor

octo-sts bot commented Nov 20, 2024

Gen AI suggestions to solve the build error:

• Detected Error: "configure: error: not supported. Need a PHP version >= 8.0.0 and < 8.4.0 (found 8.4.0)"

• Error Category: Version/Compatibility

• Failure Point: Configure step during build process

• Root Cause Analysis: The xdebug 3.3.2 package has explicit version constraints that don't support PHP 8.4.0. The package currently only supports PHP versions from 8.0.0 up to, but not including, 8.4.0.

• Suggested Fix:

  1. Wait for xdebug to release a version supporting PHP 8.4
  2. In the meantime, update the package name and dependencies to use PHP 8.3:
package:
  name: php-8.3-xdebug
  # ... other fields remain same

vars:
  phpMM: "8.3"

• Explanation:
The error is a straightforward version compatibility issue. Xdebug 3.3.2 hasn't been updated yet to support PHP 8.4, which is very new. PHP 8.4 was just released and extension maintainers typically need time to update their compatibility.

• Additional Notes:

  • PHP 8.4 is currently in alpha/beta stage
  • Xdebug typically releases new versions to support new PHP versions
  • Consider tracking xdebug's GitHub repository for updates on PHP 8.4 support
  • For now, maintaining the package for PHP 8.3 is the most stable approach

• References:

@smoser smoser changed the title Add php-8.4 Add php-8.4 modules Nov 20, 2024
Copy link
Contributor

octo-sts bot commented Nov 20, 2024

Gen AI suggestions to solve the build error:

Based on the build output, I don't actually see any errors - the build appears to have completed successfully. The package was built and the APK files were generated without any failures.

Let me break this down:

• Detected Error: None - the build completed successfully
• Status: Success
• Output Analysis:

  • Configure stage completed without errors
  • Make/compilation completed without errors
  • Installation completed without errors
  • Generated APK packages:
    • php-8.4-memcached-3.3.0-r0.apk
    • php-8.4-memcached-config-3.3.0-r0.apk
    • php-8.4-memcached-dev-3.3.0-r0.apk

The only minor warning in the output was:

mkdir: can't create directory '.libs': File exists

But this is harmless as it just means the directory already existed.

If you're seeing a CI failure, it may be:

  1. In a different stage of the pipeline
  2. Related to testing rather than building
  3. A policy/validation check rather than a build error

Could you share the specific CI failure message you're seeing? That would help identify if there's an actual issue that needs to be addressed.

Additional Notes:

  • The package successfully built against PHP 8.4
  • All dependencies were properly resolved
  • The build included SASL support
  • Generated valid APK packages with proper dependencies

Copy link
Contributor

octo-sts bot commented Nov 20, 2024

Gen AI suggestions to solve the build error:

Based on the build log, I don't actually see any build errors - the build appears to have completed successfully. The package was built and the APK files were generated without any failures.

• Detected Error: None - build completed successfully
• Error Category: N/A
• Failure Point: N/A
• Root Cause Analysis: The build process finished normally, generating three APK packages:

  • php-8.4-redis-6.1.0-r0.apk
  • php-8.4-redis-config-6.1.0-r0.apk
  • php-8.4-redis-dev-6.1.0-r0.apk

• Suggested Fix: No fix needed as there is no error to resolve. The package built successfully.

• Explanation: The build log shows:

  1. All configuration steps completed
  2. All compilation steps succeeded
  3. Installation completed properly
  4. Package generation finished successfully
  5. APK index was updated correctly

• Additional Notes:
There was one minor warning during configure about terminal sequences, but this is cosmetic and doesn't affect the build:

shtool:echo:Warning: unable to determine terminal sequence for bold mode

• References: N/A

If you're seeing a failure in CI that isn't shown in this build log, please provide that error message for further analysis.

Copy link
Contributor

octo-sts bot commented Nov 20, 2024

Gen AI suggestions to solve the build error:

Based on the build log, I don't actually see a build error - the build appears to have completed successfully. The log shows the package was built and the APK files were generated correctly:

• Built packages:

  • php-8.4-memcached-3.3.0-r0.apk
  • php-8.4-memcached-config-3.3.0-r0.apk
  • php-8.4-memcached-dev-3.3.0-r0.apk

The only minor warning in the log was:

./configure: line 7685: /usr/bin/file: not found

But this didn't affect the build outcome since it completed successfully.

If you're seeing a CI failure, it may be:

  1. In a different stage of the pipeline
  2. Related to testing rather than building
  3. A policy/lint check failure

Could you please share the specific CI failure message you're seeing? That would help identify the actual issue that needs to be addressed.

Additional Notes:

  • The configure and make steps completed without errors
  • All package files were generated successfully
  • Dependencies were resolved correctly
  • The build system appears to be working as expected

Without seeing the actual error message from CI, I can't provide more specific guidance on what needs to be fixed.

Copy link
Contributor

octo-sts bot commented Nov 20, 2024

Gen AI suggestions to solve the build error:

• Detected Error: /bin/sh: bash: not found

• Error Category: Dependency

• Failure Point: Pipeline step during execution of packagize.sh script

• Root Cause Analysis: The build environment is missing the bash shell which is required to execute the packagize.sh script. While busybox provides a basic shell, the script specifically requires bash.

• Suggested Fix: Add bash to the environment packages list:

environment:
  contents:
    packages:
      - autoconf
      - automake
      - bash        # Add this line
      - binutils
      - build-base
      [...]

• Explanation: The packagize.sh script uses bash-specific features and has a bash shebang. Adding bash as a build dependency will provide the required shell interpreter for executing the script.

• Additional Notes:

  • The error occurs early in the build process during the setup phase
  • Busybox's sh implementation is not sufficient for this script
  • This is a common issue when scripts explicitly require bash features
  • The fix maintains the ephemeral nature of the build environment while providing the necessary tool

• References:

Copy link
Contributor

octo-sts bot commented Nov 20, 2024

Gen AI suggestions to solve the build error:

Based on the build log, I don't see any actual build errors - the build appears to have completed successfully. The packages were built and indexed without errors.

• Detected Error: None - the build completed successfully
• Error Category: N/A
• Failure Point: N/A
• Root Cause Analysis: The build process ran through all steps successfully:

  • Configure completed
  • Make build completed
  • Make install completed
  • Package generation completed
  • APK index generation completed

• Suggested Fix: No fix needed as the build was successful. The output shows:

  • Successfully built php-8.4-redis-6.1.0-r0.apk
  • Successfully built php-8.4-redis-config-6.1.0-r0.apk
  • Successfully built php-8.4-redis-dev-6.1.0-r0.apk

• Explanation: The build log shows all steps completed without errors:

  • Git checkout succeeded
  • Configure ran successfully
  • Make build completed
  • Make install completed
  • Package generation and indexing completed

• Additional Notes:

  • There was a non-critical warning about "file" command not found during configure but this did not impact the build
  • All required dependencies were installed correctly
  • The extension was built successfully against PHP 8.4
  • Tests were suggested to run but not required for the build

If you're seeing a CI failure, it may be in another part of the pipeline not shown in this build log, as the actual package build process completed successfully.

Copy link
Contributor

octo-sts bot commented Nov 21, 2024

Gen AI suggestions to solve the build error:

• Detected Error: "could not find package that provides php-8.4-igbinary-dev in indexes"

• Error Category: Dependency

• Failure Point: Environment setup phase when trying to install build dependencies

• Root Cause Analysis: The build is failing because it cannot find the php-8.4-igbinary-dev package in the configured repositories. This is likely because PHP 8.4 is still in development/alpha and the igbinary extension hasn't been built for it yet.

• Suggested Fix:

  1. Remove php-8.4-igbinary-dev dependency temporarily until it's available
  2. Modify the environment section:
environment:
  contents:
    packages:
      - autoconf
      - build-base
      - busybox
      - libmemcached-dev
      - php-${{vars.phpMM}}
      - php-${{vars.phpMM}}-dev
      - zlib-dev

• Explanation:
PHP 8.4 is currently in development and not all extension packages are available yet. The memcached extension can be built without igbinary support initially, and igbinary support can be added back once the package becomes available.

• Additional Notes:

  • PHP 8.4 is currently in alpha stage
  • igbinary is an optional optimization for memcached serialization
  • The package can be rebuilt with igbinary support once the dependency becomes available
  • Consider adding a configure flag to explicitly disable igbinary support:
  - name: Configure
    runs: ./configure --disable-memcached-igbinary

• References:

Copy link
Contributor

octo-sts bot commented Nov 21, 2024

Gen AI suggestions to solve the build error:

• Detected Error: "failed to build package: unable to build guest: unable to generate image: installing apk packages: error getting package dependencies: solving "php-8.4-igbinary-dev" constraint: could not find package that provides php-8.4-igbinary-dev in indexes"

• Error Category: Dependency

• Failure Point: Environment setup phase when installing build dependencies

• Root Cause Analysis: The build system cannot find the php-8.4-igbinary-dev package in the configured repositories. This is likely because PHP 8.4 is still in development/alpha and the igbinary extension hasn't been built for it yet.

• Suggested Fix:

  1. Change the PHP version to 8.3 which is the current stable release:
package:
  name: php-8.3-redis
  version: 6.1.0

And update all references from 8.4 to 8.3 in the environment and dependencies sections.

• Explanation:

  • PHP 8.4 is currently in alpha/development
  • The igbinary extension package likely hasn't been built for PHP 8.4 yet
  • PHP 8.3 is the current stable release and should have all required dependencies available
  • The redis extension is compatible with PHP 8.3

• Additional Notes:

  • Once PHP 8.4 becomes stable and the igbinary extension is available for it, this package can be updated
  • Consider adding a check in the update automation to verify dependency availability
  • Monitor PHP 8.4 release schedule to plan the version bump accordingly

• References:

smoser added a commit to smoser/wolfi-os that referenced this pull request Nov 21, 2024
These were split from wolfi-dev#34683
due to failing to pass c-i. that seemed to be due to
the fact that these two packages depend on php-8.4-igbinary.

They're just copy and 'sed'it from the php-8.3-<module> name.
```
for p in php-8.3-*.yaml; do
  sed -e 's,epoch: .*,epoch: 0,' -e 's,name: php-8.3-,name: php-8.4-,' \
     "$p" > php-8.4${p#php-8.3};
done
```
Grab php/pecl-encryption-mcrypt#19
which just uses php_mt_rand_range rather than now-removed php_rand.
Several changes would be needed to make the 5.1.5
version of swoole build with php 8.4.

Upstream explicitly removed support from
the 5.1 branch swoole/swoole-src#5525

There is likely 6.0.0 release coming soon (beta released 2024-10-17).

We will have to manually re-add at that point in time.
@smoser smoser enabled auto-merge (squash) November 21, 2024 20:12
Copy link
Member

@dannf dannf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I diff'd the modules that exist for both 8.3 and 8.4 and those changes look straightfoward. I didn't double-check the cherry-picks, but I trust the given justifications.

@smoser smoser merged commit 5e8fde5 into wolfi-dev:main Nov 21, 2024
14 of 15 checks passed
smoser added a commit that referenced this pull request Nov 21, 2024
These were split from #34683 due to
failing to pass c-i. that seemed to be due to the fact that these two
packages depend on php-8.4-igbinary.

They're just copy and 'sed'it from the php-8.3-<module> name.
@smoser smoser mentioned this pull request Nov 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants