dyld: Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib
Referenced from: /Users/sam/.phpbrew/php/php-7.1.20/bin/php
Reason: no suitable image found. Did find:
/usr/local/opt/readline/lib/libreadline.7.dylib: stat() failed with errno=20
No warnings
Paste your phpbrew install command here (be sure to install with --debug flag, e.g. phpbrew --debug install)
phpbrew -d install php-7.1.20 +default+mysql +cli +bcmath +calendar +ctype +dom +fileinfo +filter +ipc +json +phar +posix +readline +sockets +tokenizer +xml +curl +zip +openssl=/usr/local/Cellar/openssl/1.0.2l +session +soap +xml_all +exif +zts +iconv="$(brew --prefix libiconv)" +bz2="$(brew --prefix bzip2)" +zlib="$(brew --prefix zlib)" -- --with-gd=shared
OS: OS X 10.13
Running PHP:
php-7.1.20
Installing PHP:
n/a
I started getting warnings in bash after updating my local homebrew.
dyld: Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib
Referenced from: /Users/sam/.phpbrew/php/php-7.1.20/bin/php
Reason: image not found
Looking through the brew output I see:
Removing: /usr/local/Cellar/readline/7.0.3_1
readline is at version 8.0 and phpbrew is unusable. I was thinking I could reinstall it, but the instructions seem to just retrieve the binary and place it in my /usr/local/bin which is done. I do not find where I can set my local phpbrew to use the new readline 8.0.
I have pulled my readline 7.0.3 from backup and established the alias of /usr/local/opt/readline/ back to the readline ver 7, opened a new terminal window and got this modified message:
dyld: Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib
Referenced from: /Users/sam/.phpbrew/php/php-7.1.20/bin/php
Reason: no suitable image found. Did find:
/usr/local/opt/readline/lib/libreadline.7.dylib: stat() failed with errno=20
So phpbrew noticed the older readline but I cannot find how to resolve it by asking it to use the newer readline, or how to resolve it back to this older version that seemed to be working until I updated homebrew.
running this on version 8
brew info readline
For compilers to find readline you may need to set:
export LDFLAGS="-L/usr/local/opt/readline/lib"
export CPPFLAGS="-I/usr/local/opt/readline/include"
For pkg-config to find readline you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/readline/lib/pkgconfig"
and I have run these commands in my bash.
How to use readline 8 or pointer to fix my phpbrew to understand libreadline ver 7.
Yes, apparently phpbrew is not likely to support readline.8. Thankfully I have a backup and created symbolic link that phpbrew is expecting to the older readline.7 directory.
Leaving this for future visitors:
It's not like phpbrew has any dependency on readline.
head -2 /usr/local/bin/phpbrew
#!/usr/bin/env php
<?php
Phpbrew is actually a normal PHP program, so it runs using _some_ PHP binary. In your case, this PHP: /Users/sam/.phpbrew/php/php-7.1.20/bin/php doesn't work. That's the one being dependant on readline.
Anyhow, you need to make _some_ working setup of PHP (like the system one) and use that one. E.g. prepend $PATH with /usr/bin just temporarily, so that system PHP is going to be the first one in $PATH. This way you're back with working phpbrew to... reinstall PHP's.
Yeah, that's so convoluted when you create a php manager in php.
Working on MacOS 10.15.3 (Catalina) and using phpbrew 1.26.0, I had similar problem with readline 8 installed by brew, couldn't compile php 5.6.40, the error was:
Undefined symbols for architecture x86_64:
"_append_history", referenced from:
_readline_shell_run in readline_cli.o
"_history_list", referenced from:
_zif_readline_list_history in readline.o
"_rl_done", referenced from:
_zif_readline_info in readline.o
"_rl_mark", referenced from:
_zif_readline_info in readline.o
"_rl_pending_input", referenced from:
_zif_readline_info in readline.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [sapi/cli/php] Error 1
So I managed to compile using libedit instead:
brew install libedit zlib
phpbrew install 5.6.40 +default +zlib="$(brew --prefix zlib)" -- --with-libedit=$(brew --prefix libedit)
In case it helps someone.
Most helpful comment
Working on MacOS 10.15.3 (Catalina) and using phpbrew 1.26.0, I had similar problem with readline 8 installed by brew, couldn't compile php 5.6.40, the error was:
So I managed to compile using libedit instead:
In case it helps someone.