This repository has been archived by the owner. It is now read-only.

php72 install libjpeg.8.dylib not found #4358

Closed
roelvanhintum opened this Issue Aug 7, 2017 · 44 comments

Comments

Projects
None yet
@roelvanhintum
Copy link

roelvanhintum commented Aug 7, 2017

Description

After a clean install of php72 (or php71) it says libjpeg 8 is not loaded when i run php.
edit: libjpeg 9b is installed instead

Context and Logs

php -v
dyld: Library not loaded: /usr/local/opt/jpeg/lib/libjpeg.8.dylib
  Referenced from: /usr/local/bin/php
  Reason: image not found
Abort trap: 6
Parameter Value
macOS version: 10.12.6
Homebrew 1.3.0
Homebrew/homebrew-core (git revision 760c1; last commit 2017-08-07)
php 7.2 (as installed: brew install homebrew/php/php72)
Xcode 8.3.3
Build version 8E3004b

Output of gcc -v:

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/c++/4.2.1
Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Output of php -v:

dyld: Library not loaded: /usr/local/opt/jpeg/lib/libjpeg.8.dylib
  Referenced from: /usr/local/bin/php
  Reason: image not found
Abort trap: 6

Build logs: Link to public gist created with brew gist-logs my-formula

Error: No logs.
@benargo

This comment has been minimized.

Copy link

benargo commented Aug 7, 2017

Confirmed, same configuration as above. It seems to have happened after the libjpeg library got upgraded to version 9 with Homebrew.

@cburschka-pwc

This comment has been minimized.

Copy link

cburschka-pwc commented Aug 7, 2017

Confirmed here too.

I can't figure out how to install old homebrew versions, but as a temporary fix I compiled the old version of libjpeg manually: https://stackoverflow.com/questions/32703296/dyld-library-not-loaded-usr-local-lib-libjpeg-8-dylib-homebrew-php

Downloading the source for 8d, then compiling it and installing it to the default location (/usr/local/lib) lets PHP find it and removes the error.

@ruchee

This comment has been minimized.

Copy link

ruchee commented Aug 7, 2017

Confirmed

macOS 10.12.6 and brew install php71

php -v
dyld: Library not loaded: /usr/local/opt/jpeg/lib/libjpeg.8.dylib
  Referenced from: /usr/local/bin/php
  Reason: image not found
Abort trap: 6
@vyuldashev

This comment has been minimized.

Copy link

vyuldashev commented Aug 7, 2017

Confirmed.

dyld: Library not loaded: /usr/local/opt/jpeg/lib/libjpeg.8.dylib
  Referenced from: /usr/local/bin/php
  Reason: image not found
[1]    24171 abort      php -v
@aurimasniekis

This comment has been minimized.

Copy link
Contributor

aurimasniekis commented Aug 7, 2017

Fixed the problem by switching libjpeg to 8d using this:

$ brew switch libjpeg 8d
@andygrunwald

This comment has been minimized.

Copy link

andygrunwald commented Aug 7, 2017

Can confirm the issue.

@aurimasniekis

$ brew switch libjpeg 8d
Error: libjpeg does not have a version "8d" in the Cellar.
Versions available: 9b

Any idea to get different versions?

@cburschka-pwc

This comment has been minimized.

Copy link

cburschka-pwc commented Aug 7, 2017

@aurimasniekis

Fixed the problem by switching libjpeg to 8d

Newbie to homebrew here; is there a way to get the version back if you have already used brew cleanup and removed it? (I ended up doing this instead: #4358 (comment))

@roelvanhintum

This comment has been minimized.

Copy link

roelvanhintum commented Aug 7, 2017

@cburschka-pwc as far as i know of, no. I am running into that issue, so i'm really hoping for a quick fix of this issue.

@aurimasniekis

This comment has been minimized.

Copy link
Contributor

aurimasniekis commented Aug 7, 2017

@andygrunwald I think you have run cleanup like @cburschka-pwc thats why u dont have previous version on your machine

@hpuac

This comment has been minimized.

Copy link

hpuac commented Aug 7, 2017

I fixed it with sudo ln -s /usr/local/Cellar/jpeg/8d/lib/libjpeg.8.dylib /usr/local/opt/jpeg/lib/libjpeg.8.dylib

@aurimasniekis

This comment has been minimized.

Copy link
Contributor

aurimasniekis commented Aug 7, 2017

@jack992 u could just run switch because u have previous version on your machine

@clozed2u

This comment has been minimized.

Copy link

clozed2u commented Aug 7, 2017

Confirmed.

php --version
dyld: Library not loaded: /usr/local/opt/jpeg/lib/libjpeg.8.dylib
  Referenced from: /usr/local/bin/php
  Reason: image not found
[1]    65779 abort      php --version
@schanzel

This comment has been minimized.

Copy link
Contributor

schanzel commented Aug 7, 2017

Same issue here

php -v
dyld: Library not loaded: /usr/local/opt/jpeg/lib/libjpeg.8.dylib
  Referenced from: /usr/local/bin/php
  Reason: image not found
fish: 'php -v' terminated by signal SIGABRT (Abort)

Unfortunately, I brew cleanup'd as well after the upgrade of libjpeg.

brew info jpeg
jpeg: stable 9b (bottled)
Image manipulation library
http://www.ijg.org
/usr/local/Cellar/jpeg/9b (20 files, 724KB) *
  Poured from bottle on 2017-08-07 at 13:11:39
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/jpeg.rb

Anyone has an easy fix, aside from manually installing the old libjpeg files?

@GeorgThomassen

This comment has been minimized.

Copy link

GeorgThomassen commented Aug 7, 2017

also ran cleanup 👎

@ruchee

This comment has been minimized.

Copy link

ruchee commented Aug 7, 2017

Can fixed by this

wget -c http://www.ijg.org/files/jpegsrc.v8d.tar.gz
tar xzf jpegsrc.v8d.tar.gz
cd jpeg-8d
./configure
make
cp ./.libs/libjpeg.8.dylib /usr/local/opt/jpeg/lib
@boday

This comment has been minimized.

Copy link

boday commented Aug 7, 2017

@ruchee Thx, this is good fix.

@Maxador

This comment has been minimized.

Copy link

Maxador commented Aug 7, 2017

You can fix it by reinstalling php with brew, it will recompile with the new version of libjpeg.
Tested with PHP 7.1
brew reinstall php71

I think it would be interesting if the compiled version referenced an general name like /usr/local/opt/jpeg/lib/libjpeg.dylib.

@freost

This comment has been minimized.

Copy link

freost commented Aug 7, 2017

Still failing for me after running brew reinstall php71.

@cburschka-pwc

This comment has been minimized.

Copy link

cburschka-pwc commented Aug 7, 2017

Unfortunately I can't confirm that (#4358 (comment)); brew update; brew reinstall php71 still installs 7.1.7_19, which still breaks if libjpeg 8 is not installed.

@Maxador

This comment has been minimized.

Copy link

Maxador commented Aug 7, 2017

I'm using PHP 7.1 --with-httpd24 option and I think it force php to compile from sources (it took me a good 8 minutes to compile).

I can see in my libphp7.so a reference to libjpeg 9. However, it might be an hassle for you to change all your apache setup. @ruchee solution might be better for you.

@byCedric

This comment has been minimized.

Copy link

byCedric commented Aug 7, 2017

This is because libjpeg has been updated in the homebrew core, see this comment.

... as a workaround, you can use brew reinstall --build-from-source ... - ilovezfs

@alcaeus

This comment has been minimized.

Copy link
Contributor

alcaeus commented Aug 7, 2017

Installing from bottles causes the same error over and over again because PHP has been compiled against the old version. Reinstalling from source works: brew reinstall -s php71.

  • For PHP 7.1, the error will be fixed once #4353 has been merged as that causes a recompile of the bottles.
  • For PHP 7.2, I'll create a pull request that bumps the core formula revision, again causing the bottles to be recompiled.
@jbylsma

This comment has been minimized.

Copy link

jbylsma commented Aug 7, 2017

If you've cleaned up, you can manually switch homebrew-core to the hash pre-9d. I used brew log jpeg to find the 9d install, which was 1fee4a326dd7144e192027705fa82d86e4676837.

cd $(brew --prefix)/Homebrew/Library/Taps/homebrew/homebrew-core
git co --detach 1fee4a326dd7144e192027705fa82d86e4676837~
HOMEBREW_NO_AUTO_UPDATE=1 brew install jpeg
git co master
brew switch jpeg 8d

You may have to fuss around with removing jpeg first, and maybe ignoring dependencies. Could get yucky.

@alcaeus alcaeus referenced this issue Aug 7, 2017

Closed

php72: bump revision #4361

3 of 3 tasks complete
@RandomDSdevel

This comment has been minimized.

Copy link

RandomDSdevel commented Aug 8, 2017

I've seen the same issue with PHP v5.6.x, particularly v5.6.30, the version currently carried here in Homebrew PHP. Rebuilding from source should, as mentioned as a workaround, fix this, but the fact that I have to do this probably means that every version of PHP hosted here should have its revision bumped. (Admittedly, I should probably update to the latest non-development version of PHP, but I'd need to either make sure doing so wouldn't affect any currently installed dependent software first or, if it did, figure out how to deal with the resulting breakage, and I haven't done either kind of analysis yet.)

@alcaeus

This comment has been minimized.

Copy link
Contributor

alcaeus commented Aug 8, 2017

@RandomDSdevel There's a pull request open for PHP 5.6.31, which causes a rebuild of bottles. If you need an older version of PHP, feel free to create a PR with a revision bump (see PR linked above) yourself.

@SrihariThalla SrihariThalla referenced this issue Aug 8, 2017

Closed

php55: Bump revision #4365

3 of 3 tasks complete
@RandomDSdevel

This comment has been minimized.

Copy link

RandomDSdevel commented Aug 8, 2017

@alcaeus: Ah, I wasn't aware that a new version of PHP's 5.6 series was going to be available in the foreseeable future. I don't need anything older than that, and I guess you could say making sure my local web development setup can survive an update of PHP to v7.1.x (or v7.2.x, when that comes out of beta) is on my bottomless to-do list. In the meantime, I rebuilt PHP from source.

@sankalp-khare

This comment has been minimized.

Copy link

sankalp-khare commented Aug 9, 2017

@ruchee grateful for your excellent fix! My emacs broke and I would've been in deep shit if not for your solution. THANKS.

@muchar

This comment has been minimized.

Copy link

muchar commented Aug 9, 2017

None of these fixes work for me. I get this kind of error:

clangclang: : error: linker command failed with exit code 1 (use -v to see invocation)error
: linker command failed with exit code 1 (use -v to see invocation)
make: *** [sapi/cli/php] Error 1
make: *** Waiting for unfinished jobs....
make: *** [sapi/cgi/php-cgi] Error 1
Undefined symbols for architecture x86_64:
  "_syslog$DARWIN_EXTSN", referenced from:
      _php_mail in mail.o
      _php_mail_log_to_syslog in mail.o
      _zif_syslog in syslog.o
      _php_log_err in main.o
      _zlog_ex in zlog.o
ld: symbol(s) not found for architecture x86_64```
@muchar

This comment has been minimized.

Copy link

muchar commented Aug 9, 2017

Ok, what I've done to make this work. I switched to libjpeg.8d (thanks @jbylsma). Then I installed BOTTLED version of PHP. Unfortunately it doesn't create apache module :-(

@javian

This comment has been minimized.

Copy link
Member

javian commented Aug 10, 2017

@muchar It doesn't seem related to the original post so open a separate issue if you can't install the apache module when compiling from source.

@muchar

This comment has been minimized.

Copy link

muchar commented Aug 13, 2017

@javian I made separate issue #4378. I see that I'm not alone with this. The same is in #4381.

@mtangoo

This comment has been minimized.

Copy link

mtangoo commented Aug 15, 2017

@andygrunwald solution worked nicely here

@enderandpeter

This comment has been minimized.

Copy link

enderandpeter commented Aug 15, 2017

I got this error soon after installing imagemagick through homebrew. I'm sure something about that messed up the libjpeg dependency. Running the brew switch libjpeg 8d command got things working again.

@mtangoo

This comment has been minimized.

Copy link

mtangoo commented Aug 15, 2017

So here is a bit of explanation of what happens. You installed PHP** and it found libjpeg-8d installed and so it built and linked with it: happy day!

Next you installed xxyyzz package and it installed brew switch libjpeg-9b and switched whole brew packages to it: Crash!. So two options you have. The first is to run brew switch libjpeg 8d and switch default back to 8d.

This works if you didn't cleanup after installation. The better solution is to switch to latest: brew switch libjpeg 9b and then run cleanup with brew cleanup.

When old stuffs are gone, go ahead and remove PHP with brew uninstall php71 if you installed 7.1. If you installed 7.0 use php7.0 instead. After uninstall is complete, reinstall it with brew install php71 and the Elephant will be happy again!

@martykelly

This comment has been minimized.

Copy link

martykelly commented Aug 25, 2017

@ruchee Thanks a ton for you fix!! Much appreciated.

@bklossner

This comment has been minimized.

Copy link

bklossner commented Aug 25, 2017

Unlinking all php versions then running brew upgrade solved the problem for me. Upgrade downloaded newer versions of php70 and php71 (I installed with --with-httpd24 if that makes any difference). I was then able to brew link php71 and php70 without any errors.

Thank you all for the insanely quick and informative help.

@ronpeled

This comment has been minimized.

Copy link

ronpeled commented Sep 1, 2017

Guys! what a mess. None of these options worked for me. I need to use php70 and some of these packages will default to require php71 so now when I reinstalled php70 it reinstalled some packages which are now also requiring php71.

any solutions?

@DannyUK

This comment has been minimized.

Copy link

DannyUK commented Sep 4, 2017

@ruchee - Fix worked for me. Thanks!

@HongPong

This comment has been minimized.

Copy link

HongPong commented Sep 5, 2017

@Maxador solution worked for me. the following sequence;

brew switch libjpeg 9b
brew unlink php70
 brew reinstall php71
@ronpeled

This comment has been minimized.

Copy link

ronpeled commented Sep 6, 2017

ok, no dice here. I tried to remove everything again, unlink php70. Then trying to reinstall. Still getting this error:

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/opt/php70-imagick/imagick.so' - dlopen(/usr/local/opt/php70-imagick/imagick.so, 9): image not found in Unknown on line 0

@ronpeled

This comment has been minimized.

Copy link

ronpeled commented Sep 7, 2017

ok, these steps fixed it:

  • brew unistall all php70* packages
  • brew update
  • brew upgrade
  • brew install all php70* packages needed
  • brew reinstall -s php70-imagick

Thanks all!

@RandomDSdevel

This comment has been minimized.

Copy link

RandomDSdevel commented Sep 7, 2017

@Homebrew/maintainers: And I think it's well past time this issue got locked. (Hopefully I spelled that '@' mention correctly; lately, it doesn't seem like GitHub's been picking up on that specific one…)

@joelday

This comment has been minimized.

Copy link

joelday commented Sep 7, 2017

@RandomDSdevel Seems to me that @ronpeled's suggestion is likely to be helpful and that was 18 hours ago.

@josegonzalez

This comment has been minimized.

Copy link
Contributor

josegonzalez commented Sep 7, 2017

This has veered off what the original question was - a libjpeg8 dynamic library no longer being available - and there are a few solutions - basically update/upgrade brew and reinstall your packages - so I'm closing and locking. If you find you have a similar problem, please open a new issue and we'll be happy to look into it.

@Homebrew Homebrew locked and limited conversation to collaborators Sep 7, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.