Skip to content
This repository was archived by the owner on May 21, 2025. It is now read-only.
This repository was archived by the owner on May 21, 2025. It is now read-only.

Missing libgomp prevents imagick from loading #32

@netsensei

Description

@netsensei

Description

The Docker image pulls Imagick 3.5.0 via PECL. However, the PHP extension requires a dependency on a shared library which isn't included in the Dockerfile. As a result, PHP will throw PHP core warnings and CraftCMS will yield PHP errors both via PHP-FPM as well as via the CLI.

Steps to reproduce

  1. Set up a fresh environment and use the Dockerfile to build an image. (I use Docker Compose)
  2. In my case, I try to restore a SQL dump using the craft command via the docker CLI tool:
$ docker exec -it project_name php craft db/restore /var/www/storage/backups/project--
2021-06-30-084743--v3.6.15.sql

I get these errors:

PHP Warning:  PHP Startup: Unable to load dynamic library 'imagick' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20190902/imagick (Error loading shared library /usr/local/lib/php/extensions/no-debug-non-zts-20190902/imagick: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20190902/imagick.so (Error loading shared library libgomp.so.1: No such file or directory (needed by /usr/local/lib/php/extensions/no-debug-non-zts-20190902/imagick.so))) in Unknown on line 0
Restoring database backup ... done
PHP Core Warning 'yii\base\ErrorException' with message 'PHP Startup: Unable to load dynamic library 'imagick' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20190902/imagick (Error loading shared library /usr/local/lib/php/extensions/no-debug-non-zts-20190902/imagick: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20190902/imagick.so (Error loading shared library libgomp.so.1: No such file or directory (needed by /usr/local/lib/php/extensions/no-debug-non-zts-20190902/imagick.so)))'

in ./Unknown:0

Stack trace:
#0 [internal function]: yii\base\ErrorHandler->handleFatalError()
#1 {main}

This caught my eye: Error loading shared library libgomp.so.1: No such file or directory (needed by /usr/local/lib/php/extensions/no-debug-non-zts-20190902/imagick.so)

So I added libgomp to the Dockerfile, like below, and rebuild the image. That solved the issue for me.

RUN set -ex && \
    apk --no-cache add \
    ...
    libjpeg-turbo \
    libgomp \
    freetype-dev \
    ...

Additional info

  • Craft version: Not relevant
  • PHP version: 7.4
  • Database driver & version: not relevant
  • Plugins & versions: Imagick 3.5.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions