shivammathur / setup-php

GitHub action to set up PHP with extensions, php.ini configuration, coverage drivers, and various tools.
https://setup-php.com
MIT License
2.91k stars 340 forks source link

PHP8.3 + gd: Unable to load dynamic library 'gd.so' #775

Closed jasonvarga closed 11 months ago

jasonvarga commented 11 months ago

Describe the bug

Same as described in https://github.com/shivammathur/setup-php/issues/767, I'm seeing the warning during the setup-php task.

==> Setup Extensions
Run shivammathur/setup-php@v2
/usr/bin/bash /home/runner/work/_actions/shivammathur/setup-php/v2/src/scripts/run.sh

==> Setup PHP
✓ PHP Installed PHP 8.3.0-dev (81e236cde56ff006d9c661140790b42f40ffc43b)

==> Setup Extensions
PHP Warning:  PHP Startup: Unable to load dynamic library 'gd.so' (tried: /usr/lib/php/20230831/gd.so (/usr/lib/php/20230831/gd.so: undefined symbol: gdImageCreateFromAvif), /usr/lib/php/20230831/gd.so.so (/usr/lib/php/20230831/gd.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
✓ dom Enabled
✓ curl Enabled
✓ libxml Enabled
✓ mbstring Enabled
✓ zip Enabled
✓ pcntl Enabled
✓ pdo Enabled
✓ sqlite3 Enabled
✓ pdo_sqlite Enabled
✓ bcmath Enabled
✓ soap Enabled
✓ intl Enabled
PHP Warning:  PHP Startup: Unable to load dynamic library 'gd.so' (tried: /usr/lib/php/20230831/gd.so (/usr/lib/php/20230831/gd.so: undefined symbol: gdImageCreateFromAvif), /usr/lib/php/20230831/gd.so.so (/usr/lib/php/20230831/gd.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'gd.so' (tried: /usr/lib/php/20230831/gd.so (/usr/lib/php/20230831/gd.so: undefined symbol: gdImageCreateFromAvif), /usr/lib/php/20230831/gd.so.so (/usr/lib/php/20230831/gd.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
✓ gd Installed and enabled
✓ exif Enabled
✓ iconv Enabled
✓ imagick Enabled
✓ fileinfo Enabled

Version

Runners

Operating systems

Ubuntu 22.04.3

PHP versions

8.3

To Reproduce

Entire workflow file: https://github.com/statamic/cms/actions/runs/6694693364/workflow?pr=8845 Relevant lines:

  - name: Setup PHP
    uses: shivammathur/setup-php@v2
    if: steps.should-run-tests.outputs.result == 'true'
    with:
      php-version: ${{ matrix.php }}
      extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
      coverage: none

Expected behavior

Should install PHP with no warnings.

Screenshots/Logs

Here's the workflow run: https://github.com/statamic/cms/actions/runs/6694693364/job/18195065968?pr=8845 The "Setup PHP" step shows the warnings.

Additional context We have strange test failures on GitHub Actions which we can't recreate locally. I'm trying to rule out a problem with the GitHub PHP installation itself being the issue by getting rid of the warnings.

This warning was already reported and apparently fixed mentioned in https://github.com/shivammathur/setup-php/issues/767

Are you willing to submit a PR?

Unfortunately not, I wouldn't know where to begin.

shivammathur commented 11 months ago

@jasonvarga

Please replace the apt-spy2 step as it breaks package lists. As a result, it is not able to install the required libgd version from ppa:ondrej/php.

You can still ensure that your lists are updated and there are no broken packages using apt.

- name: Update apt sources
  if: steps.should-run-tests.outputs.result == 'true' && matrix.os == 'ubuntu-latest'
  run: |
    sudo apt-get check || sudo apt --fix-broken install -y
    sudo apt-get update
jasonvarga commented 11 months ago

I had that line in there as per the recommendation of https://github.com/actions/runner-images/issues/675#issuecomment-1419388451 but apt-get update is probably enough.

The warnings are now gone, and my tests even pass.

Thanks very much!