Mac OS build fails to load libpng15.15.dylib

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
MrBluewoods
Posts: 6
Joined: 2016-08-22T12:55:51-07:00
Authentication code: 1151

Mac OS build fails to load libpng15.15.dylib

Post by MrBluewoods »

I am trying to make a small command line tool that performs a few image editing routines using ImageMagick. Because it is a single-use, throaway tool, I want it to be packaged with ImageMagick so that it doesn't require users to install it.

When I try to use ImageMagick on Mac OS after extracting it from the Mac OS build package and setting the environment variables, I get the following error:

Code: Select all

 hostname:imtool username$ magick logo: logo.gif
dyld: Library not loaded: /opt/X11/lib/libpng15.15.dylib
  Referenced from: /Users/username/Documents/imtool/resources/3rdparty/ImageMagick/macos/ImageMagick-7.0.1/bin/magick
  Reason: image not found
Trace/BPT trap: 5
Using find, I found that I had a library with the same name in /usr/X11/lib:

Code: Select all

/usr/X11/lib/libpng15.15.dylib
I am using the latest version of ImageMagick for Mac OS:
ImageMagick-x86_64-apple-darwin15.4.0.tar.gz

Here are the commands I have used from the imtool directory:

Code: Select all

tar xvfz ImageMagick-x86_64-apple-darwin15.4.0.tar.gz
mv ImageMagick-7.0.1 ./resources/3rdparty/ImageMagick/macos/
export MAGICK_HOME="$PWD/resources/3rdparty/ImageMagick/macos/ImageMagick-7.0.1"
export PATH="$MAGICK_HOME/bin:$PATH"
export DYLD_LIBRARY_PATH="$MAGICK_HOME/lib/"
magick logo: logo.gif
I currently have no workaround, so any temporary solution would be appreciated.

Thank you.
Last edited by MrBluewoods on 2016-08-22T15:05:59-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Mac OS build fails to load libpng15.15.dylib

Post by fmw42 »

What do you get from

Code: Select all

convert -version
MrBluewoods
Posts: 6
Joined: 2016-08-22T12:55:51-07:00
Authentication code: 1151

Re: Mac OS build fails to load libpng15.15.dylib

Post by MrBluewoods »

I get the exact same error message.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Mac OS build fails to load libpng15.15.dylib

Post by fmw42 »

To MrBluewoods

Cannot help without further information about IM version details and platform. Please read top-most post in this forum at viewtopic.php?f=1&t=9620

What do you get from

Code: Select all

convert -version
MrBluewoods
Posts: 6
Joined: 2016-08-22T12:55:51-07:00
Authentication code: 1151

Re: Mac OS build fails to load libpng15.15.dylib

Post by MrBluewoods »

Hi fmw42,

I have linked to the package I am using in my post. It is the latest Mac OS release available for download on the download page:
https://www.imagemagick.org/script/binary-releases.php

I am attempting to use Version 7.0.1.
The platform is Mac OS 10.11 El Captain.
Last edited by MrBluewoods on 2016-08-22T15:41:06-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Mac OS build fails to load libpng15.15.dylib

Post by fmw42 »

Please answer my question:

What do you get from

convert -version

I need to see your Features and Delegates

Are you saying that convert -version does not work?

If so, you install was improper.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Mac OS build fails to load libpng15.15.dylib

Post by fmw42 »

Try

magick -version
MrBluewoods
Posts: 6
Joined: 2016-08-22T12:55:51-07:00
Authentication code: 1151

Re: Mac OS build fails to load libpng15.15.dylib

Post by MrBluewoods »

Yes, convert -version and magick -version do not work. None of the ImageMagick binaries will work because they are linked to libraries that do not exist on my system. My problem is that following the installation steps written on the ImageMagick download page did not work.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Mac OS build fails to load libpng15.15.dylib

Post by fmw42 »

Try with the latest IM 7 (7.0.2.x) at http://www.imagemagick.org/script/binar ... php#macosx or use Homebrew or MacPort, if they have IM 7 downloads.

Or install from source. This is what I do, see viewtopic.php?f=1&t=21502&p=88202&hilit ... rts#p88202
MrBluewoods
Posts: 6
Joined: 2016-08-22T12:55:51-07:00
Authentication code: 1151

Re: Mac OS build fails to load libpng15.15.dylib

Post by MrBluewoods »

Hi fmw42. This would not solve my problem unfortunately.

You see, I am trying to make a software package that would bundle ImageMagick in its 3rd party resources subfolder and make it run without it or any additional library being installed on the user's machine. This is why I'm trying to make ImageMagick work without installing it using Homebrew or MacPort. Since the instructions in the official ImageMagick documentation on how to install the build without Homebrew/MacPort simply instruct to extract the package then set a few environment variables, I figured doing so in my application's scripts would allow it to use ImageMagick from its own subdirectories without installing anything else.

Unfortunately it seems to be linking to libraries that are neither bundled with ImageMagick, nor preloaded in Mac OS, which I think might be a bug. If it is not a bug, then I think the documentation should specify which libraries need to be installed.

The link you have provided me is the one I followed. Although it says 7.0.2 on the webpage, it says 7.0.1 inside the package directories. Whichever it is, we are talking about the same release.

Thanks.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Mac OS build fails to load libpng15.15.dylib

Post by fmw42 »

Others have asked about standalone versions having similar trouble. So far I do not recall anyone getting this solved for Mac OSX. But I am not a programmer, so I cannot help you over this hurdle. You would need to hear back from someone who has solved this or from one of the IM developers.
trzecieu
Posts: 1
Joined: 2016-09-26T05:24:50-07:00
Authentication code: 1151

Re: Mac OS build fails to load libpng15.15.dylib

Post by trzecieu »

Hi, I would like to add some information to this topic, since I'm struggling with this issue also:
My script: convert.sh

Code: Select all

MAGICK_HOME=`dirname $0`
if [ "${MAGICK_HOME:0:1}" != "/" ]
    then MAGICK_HOME=$(pwd)/$MAGICK_HOME
fi

export DYLD_LIBRARY_PATH="$MAGICK_HOME/lib"
export MAGICK_HOME=$MAGICK_HOME
MAGICK_PATH=$MAGICK_HOME/bin

$MAGICK_PATH/convert "$@"
Try to execute it:

Code: Select all

$ ./convert.sh -version
dyld: Library not loaded: /opt/X11/lib/libpng15.15.dylib
  Referenced from: /Users/trzecieu/resource_pipeline/bin/osx/ImageMagick/./bin/convert
  Reason: image not found
./convert.sh: line 13:  3285 Trace/BPT trap: 5       $MAGICK_PATH/convert "$@"
So that, I've pulled sources to libPNG 1.5.27 and I compiled them and I put them to 'lib' folder. This looks that fixes a problem with invocation because:

Code: Select all

$ ./convert.sh -version
Version: ImageMagick 7.0.1-4 Q16 x86_64 2016-05-15 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2016 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI
Delegates (built-in): bzlib freetype jng jpeg lcms png
Issue potentially could be marked as done but:
* Why convert refers to libpng15 even if it was compiled with libpng16?

Code: Select all

$ ./convert.sh -list configure

Path: [built-in]

Name           Value
-------------------------------------------------------------------------------
FEATURES
NAME           ImageMagick
QuantumDepth   16

Path: configure.xml

Name           Value
-------------------------------------------------------------------------------
CC             clang
CFLAGS         -I/usr/local/include/libpng16  -I/usr/local/include  -I/usr/local/include/freetype2    -g -O2 -Wall -mtune=westmere -fexceptions -D_FORTIFY_SOURCE=0 -D_THREAD_SAFE -pthread -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16
CODER_PATH     /ImageMagick-7.0.1/lib/ImageMagick-7.0.1/modules-Q16HDRI/coders
CONFIGURE      ./configure  '--disable-dependency-tracking' '--disable-installed' '--enable-delegate-build' '--enable-shared' '--disable-static' '--without-x' '--without-frozenpaths' '--prefix=/ImageMagick-7.0.1' 'CC=clang' 'CXX=clang++' 'PKG_CONFIG_PATH=/usr/local/lib/pkgconfig'
CONFIGURE_PATH /ImageMagick-7.0.1/etc/ImageMagick-7/
COPYRIGHT      Copyright (C) 1999-2016 ImageMagick Studio LLC
CPPFLAGS       -I/ImageMagick-7.0.1/include/ImageMagick-7
CXX            clang++
CXXFLAGS       -g -O2 -D_THREAD_SAFE -pthread
DEFS           -DHAVE_CONFIG_H
DELEGATES      bzlib mpeg freetype jng jpeg lcms png
DISTCHECK_CONFIG_FLAGS 'CC=clang' 'CXX=clang++'  --disable-deprecated  --disable-installed  --with-quantum-depth=16  --with-jemalloc=no  --with-umem=no  --with-autotrace=no  --with-gslib=no  --with-fontpath=  --with-rsvg=no  --with-perl=no
DOCUMENTATION_PATH /ImageMagick-7.0.1/share/doc/ImageMagick-7
EXEC-PREFIX    /ImageMagick-7.0.1
EXECUTABLE_PATH /ImageMagick-7.0.1/bin
FEATURES       DPC HDRI Cipher
FILTER_PATH    /ImageMagick-7.0.1/lib/ImageMagick-7.0.1/modules-Q16HDRI/filters
GIT_REVISION   10879
HOST           x86_64-apple-darwin15.4.0
INCLUDE_PATH   /ImageMagick-7.0.1/include/ImageMagick-7
LDFLAGS        -L/ImageMagick-7.0.1/lib  -L/Users/cristy/ImageMagick-7.0.1-4/magick/.libs -L/Users/cristy/ImageMagick-7.0.1-4/magick -L/Users/cristy/ImageMagick-7.0.1-4/wand/.libs -L/Users/cristy/ImageMagick-7.0.1-4/wand
LIB_VERSION    0x701
LIB_VERSION_NUMBER 7,0,1,4
LIBRARY_PATH   /ImageMagick-7.0.1/lib/ImageMagick-7.0.1
LIBS             -L/usr/local/lib -llcms2   -L/usr/local/lib -lfreetype   -ljpeg   -L/usr/local/lib -lpng16                -lbz2         -lm
NAME           ImageMagick
PCFLAGS        -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16
PREFIX         /ImageMagick-7.0.1
QuantumDepth   16
RELEASE_DATE   2016-05-15
SHARE_PATH     /ImageMagick-7.0.1/share/ImageMagick-7
SHAREARCH_PATH /ImageMagick-7.0.1/lib/ImageMagick-7.0.1/config-Q16HDRI
TARGET_CPU     x86_64
TARGET_OS      darwin15.4.0
TARGET_VENDOR  apple
VERSION        7.0.1
WEBSITE        http://www.imagemagick.org
* This version tends to throw much more exceptions

Code: Select all

2230 Abort trap: 6
than previous one used.

BTW:
* Do you have an archived version of bins of image magick for macOS? Binary distribution that is available on http://www.imagemagick.org/download/binaries/ has only binaries for the latest ImageMagick 7.0.1, and I can't find old one for 6.5.9-10 (It's probably due a missing version in binary name ImageMagick-x86_64-apple-darwin15.4.0.tar.gz, so that each new version overrides old version)

I would really appreciate any help solving issue with 7.0.1 or helping me getting binaries for macOS of ImageMagick 6.5.9-10

Cheers,
Piotr

----

Update: I found that http://www.imagemagick.org/download/binaries/ != http://www.imagemagick.org/download/releases/ and in releases portal it's an old version's sources and the most recent one. I'll try to them in meantime.
32d2d7ee
Posts: 11
Joined: 2016-09-19T01:00:08-07:00
Authentication code: 1151

Re: Mac OS build fails to load libpng15.15.dylib

Post by 32d2d7ee »

I have exactly the same issue.

This is what I did. I downloaded the latest version from the downloads page and extracted the ImageMagick in the Downloads folder.
I'm on El Capitan

I also would like to add ImageMagick as a third party tool in a software bundle.

Code: Select all

MacBook-Air-van-DGP:~ MyComputer$ cd $HOME/Downloads/ImageMagick
MacBook-Air-van-DGP:ImageMagick MyComputer$ pwd
/Users/MyComputer/Downloads/ImageMagick
Listing the contents of this folder

Code: Select all

MacBook-Air-van-DGP:ImageMagick MyComputer$ ls
bin	etc	include	lib	share
show the environment variables before changing as described on the Downloads page

Code: Select all

MacBook-Air-van-DGP:ImageMagick MyComputer$ export
declare -x Apple_PubSub_Socket_Render="/private/tmp/com.apple.launchd.nJo6FuacQr/Render"
declare -x HOME="/Users/MyComputer"
declare -x LC_CTYPE="UTF-8"
declare -x LOGNAME="MyComputer"
declare -x OLDPWD="/Users/MyComputer"
declare -x PATH="/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
declare -x PWD="/Users/MyComputer/Downloads/ImageMagick"
declare -x SHELL="/bin/bash"
declare -x SHLVL="1"
declare -x SSH_AUTH_SOCK="/private/tmp/com.apple.launchd.9WqeOSPAmp/Listeners"
declare -x TERM="xterm-256color"
declare -x TERM_PROGRAM="Apple_Terminal"
declare -x TERM_PROGRAM_VERSION="361.1"
declare -x TERM_SESSION_ID="4B2052EB-E117-4C4A-8B2A-CC3881152564"
declare -x TMPDIR="/var/folders/96/59pfclvj5yq7g_tt0bfm9l800000gn/T/"
declare -x USER="MyComputer"
declare -x XPC_FLAGS="0x0"
declare -x XPC_SERVICE_NAME="0"
declare -x __CF_USER_TEXT_ENCODING="0x1F5:0x0:0x0"
Setting the environment variables as described:

Code: Select all

MacBook-Air-van-DGP:ImageMagick MyComputer$ export MAGICK_HOME="$HOME/Downloads/ImageMagick"
MacBook-Air-van-DGP:ImageMagick MyComputer$ export PATH="$MAGICK_HOME/bin:$PATH"
MacBook-Air-van-DGP:ImageMagick MyComputer$ export DYLD_LIBRARY_PATH="$MAGICK_HOME/lib/"
Listing the environment variables after executing the export commands

Code: Select all

MacBook-Air-van-DGP:ImageMagick MyComputer$ export
declare -x Apple_PubSub_Socket_Render="/private/tmp/com.apple.launchd.nJo6FuacQr/Render"
declare -x DYLD_LIBRARY_PATH="/Users/MyComputer/Downloads/ImageMagick/lib/"
declare -x HOME="/Users/MyComputer"
declare -x LC_CTYPE="UTF-8"
declare -x LOGNAME="MyComputer"
declare -x MAGICK_HOME="/Users/MyComputer/Downloads/ImageMagick"
declare -x OLDPWD="/Users/MyComputer"
declare -x PATH="/Users/MyComputer/Downloads/ImageMagick/bin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
declare -x PWD="/Users/MyComputer/Downloads/ImageMagick"
declare -x SHELL="/bin/bash"
declare -x SHLVL="1"
declare -x SSH_AUTH_SOCK="/private/tmp/com.apple.launchd.9WqeOSPAmp/Listeners"
declare -x TERM="xterm-256color"
declare -x TERM_PROGRAM="Apple_Terminal"
declare -x TERM_PROGRAM_VERSION="361.1"
declare -x TERM_SESSION_ID="4B2052EB-E117-4C4A-8B2A-CC3881152564"
declare -x TMPDIR="/var/folders/96/59pfclvj5yq7g_tt0bfm9l800000gn/T/"
declare -x USER="MyComputer"
declare -x XPC_FLAGS="0x0"
declare -x XPC_SERVICE_NAME="0"
declare -x __CF_USER_TEXT_ENCODING="0x1F5:0x0:0x0"
Showing the version information with Magick

Code: Select all

MacBook-Air-van-DGP:ImageMagick MyComputer$ magick -version
dyld: Library not loaded: /opt/X11/lib/libpng15.15.dylib
  Referenced from: /Users/MyComputer/Downloads/ImageMagick/bin/magick
  Reason: image not found
Trace/BPT trap: 5
Showing the version information with convert

Code: Select all

MacBook-Air-van-DGP:ImageMagick MyComputer$ convert -version
dyld: Library not loaded: /opt/X11/lib/libpng15.15.dylib
  Referenced from: /Users/MyComputer/Downloads/ImageMagick/bin/convert
  Reason: image not found
Trace/BPT trap: 5
MacBook-Air-van-DGP:ImageMagick MyComputer$ 
Hope this helps analyzing this issue.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Mac OS build fails to load libpng15.15.dylib

Post by fmw42 »

I do not know if this is relevant, but libpng requires zlib. Did you instal that as well?
32d2d7ee
Posts: 11
Joined: 2016-09-19T01:00:08-07:00
Authentication code: 1151

Re: Mac OS build fails to load libpng15.15.dylib

Post by 32d2d7ee »

No, I only downloaded the binaries from the downloads page http://imagemagick.org/script/binary-releases.php and followed the instructions:
Alternatively, you can download the ImageMagick Mac OS X distribution we provide:
The final phrase
Finally, to verify ImageMagick is working properly, type the following on the command line:
at the end of the instructions clearly suggest that, having done these steps, the commands following should provide a working situation, without the need of installing, compiling etc.

I tried these steps on two Mac's and on both I got the same error.
Post Reply