-1

I'm already desperate, I know there are a lot of similar questions but no solution helped me, so I'll try a new question.

I'm trying to activate Imagick but I get this error

Warning: PHP Startup: Unable to load dynamic library 'imagick.so' (tried: /opt/homebrew/lib/php/pecl/20210902/imagick.so (dlopen(/opt/homebrew/lib/php/pecl/20210902/imagick.so, 0x0009): symbol not found in flat namespace '_AcquireAlignedMemory'), /opt/homebrew/lib/php/pecl/20210902/imagick.so.so (dlopen(/opt/homebrew/lib/php/pecl/20210902/imagick.so.so, 0x0009): tried: '/opt/homebrew/lib/php/pecl/20210902/imagick.so.so' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/lib/php/pecl/20210902/imagick.so.so' (no such file), '/opt/homebrew/lib/php/pecl/20210902/imagick.so.so' (no such file))) in Unknown on line 0

I've installed it with this order:

brew install imagemagick
brew install pkg-config
pecl install imagick

Also in php.ini I have it enabled:

extension="imagick.so"

Imagick is installed correctly:

convert --version                                                                                                                                  127 ✘  11:39:56
Version: ImageMagick 7.1.1-12 Q16-HDRI aarch64 21239 https://imagemagick.org
Copyright: (C) 1999 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenMP(5.0)
Delegates (built-in): bzlib fontconfig freetype gslib heic jng jp2 jpeg jxl lcms lqr ltdl lzma openexr png ps raw tiff webp xml zlib
Compiler: gcc (4.2)

And imagick.so is placed correctly:

-rw-r--r--  1 jklimcik  admin  494967 Jul 14 10:08 /opt/homebrew/lib/php/pecl/20210902/imagick.so

What am I missing or what's wrong? I am using MacOS 13.4, Apple M1 Pro. I'm also using Laravel Valet, but I don't think it's related to this issue.

hakre
  • 193,403
  • 52
  • 435
  • 836
Jaroslav Klimčík
  • 4,548
  • 12
  • 39
  • 58
  • The actual error message is: dlopen(/opt/homebrew/lib/php/pecl/20210902/imagick.so, 0x0009): symbol not found in flat namespace '_AcquireAlignedMemory' -- are you missing that? – hakre Jul 14 '23 at 11:18
  • @hakre sorry but what it means? – Jaroslav Klimčík Jul 14 '23 at 11:29
  • A symbol is missing. From my (limited) understanding this can have multiple reasons, one is that the .so file is not compatible with the php version and another is that a library is missing (can not be found in the ld path). Perhaps you should [edit] your quesiton and add a table of the trouble-shooting and your analysis that you tried so far, so that it become more visible where you locate the problem already and what you excluded so far. Just fyi: I don't have MacOS 13.4, Apple M1 Pro so I can not reproduce. You may want to share the PHP version and how you installed/obtained PHP. – hakre Jul 14 '23 at 11:34
  • Please also see this remarkable comment / Q&A:: https://stackoverflow.com/questions/35006614/what-does-symbol-not-found-expected-in-flat-namespace-actually-mean#comment66199948_35006614 – hakre Jul 14 '23 at 11:53
  • 1
    You need to instal the imagemagick PHP extension in addition to imagemagick itself. The extension won't get installed automatically – apokryfos Jul 14 '23 at 14:51

1 Answers1

0

So I solved it after a few hours and thanks to @hakre's poke. The problem was my migration to the M1 chip. As it has a different architecture (arm) it caused a lot of problems. In the end I had to remove everything related to homebrew and install everything from scratch. I keep it here as it may be useful for others if they have a similar problem.

Jaroslav Klimčík
  • 4,548
  • 12
  • 39
  • 58