Building ImageMagick with JP2 delegate on Mac OS X - macos

I'm trying to install (build) ImageMagick (currently 6.9.0) on a Mac running OS X 10.9.5.
I need the JP2 support, and for some reasons, while enabling jp2 with configure, I got this warning:
configure: WARNING: unrecognized options: --with-jp2
and the delegates table leave me with a blank as a value:
JPEG-2000 --with-jp2=yes
and got that at the end:
CXXFLAGS = -g -O2 -D_THREAD_SAFE -pthread
FEATURES = DPC HDRI OpenMP
DELEGATES = bzlib mpeg fftw fontconfig freetype jng jpeg pango png ps tiff x zlib
I can build it like this but the JP2 won't work, I know it as I tried.
So I'm kinda stuck here, how can I force the jp2 delegate?
Thanks

If you are using homebrew then simply set the appropriate flag, in this case --with-openjpeg, so to install you simple do
brew install imagemagick --with-openjpeg
If imagemagick is already installed then use brew reinstall imagemagick --with-openjpeg or uninstall first. Also remember that you can always check the available brew options using brew info imagemagick (this holds for any package/formula).

Use brew uninstall ImageMagick. Make sure convert doesn't show anything and then brew install ImageMagick. Hope this helps! Worked for me!

Related

Newbie difficulties with graphicsmagick and jpeg decode delegates

I am having difficulty trying to get graphicsmagick to work. New to the coding world =]
I think I might have botched up my installation by not using brew to install.
I have an image on my /Desktop; 'sign.jpeg'
Here's what I get when I try to identify (or resize) the image:
Admins-iMac:Desktop admin$ gm identify sign.jpeg
gm identify: No decode delegate for this image format (sign.jpeg).
gm identify: Request did not return an image.
So I guess I will try unlinking and relinking:
Admins-iMac:Desktop admin$ brew unlink jpeg
Unlinking /usr/local/Cellar/jpeg/9b... 17 symlinks removed
Admins-iMac:Desktop admin$ brew link jpeg
Linking /usr/local/Cellar/jpeg/9b... 17 symlinks created
Hmm:
Admins-iMac:Desktop admin$ 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 2018-01-11 at 10:48:47
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/jpeg.rb
Alright so I guess I will try un/reinstalling graphicsmagick:
Admins-iMac:Desktop admin$ brew uninstall imagemagick graphicsmagick libpng jpeg
Error: No such keg: /usr/local/Cellar/imagemagick
Let me check the version info:
Admins-iMac:Desktop admin$ gm -version
GraphicsMagick 1.3.27 Q8 http://www.GraphicsMagick.org/
Copyright (C) 2002-2017 GraphicsMagick Group.
Additional copyrights and licenses apply to this software.
See http://www.GraphicsMagick.org/www/Copyright.html for details.
Feature Support:
Native Thread Safe yes
Large Files (> 32 bit) yes
Large Memory (> 32 bit) yes
BZIP yes
DPS no
FlashPix no
FreeType no
Ghostscript (Library) no
JBIG no
JPEG-2000 no
JPEG no
Little CMS no
Loadable Modules no
OpenMP no
PNG no
TIFF no
TRIO no
UMEM no
WebP no
WMF no
X11 no
XML yes
ZLIB yes
Host type: x86_64-apple-darwin16.7.0
Configured using the command:
./configure 'CC=clang' 'LDFLAGS=-L/usr/local/libjpeg/lib -L/usr/local/libpng/lib -L/usr/local/libtiff/lib' 'CPPFLAGS=-I/usr/local/libjpeg/include -I/usr/local/libpng/include -I/usr/local/libtiff/include' '--prefix=/usr/local/mac-dev-env/graphicsmagick-1.3.27'
Final Build Parameters:
CC = clang
CFLAGS = -g -O2 -Wall -D_THREAD_SAFE
CPPFLAGS = -I/usr/local/libjpeg/include -I/usr/local/libpng/include -I/usr/local/libtiff/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/libxml2
CXX = g++
CXXFLAGS = -D_THREAD_SAFE
LDFLAGS = -L/usr/local/libjpeg/lib -L/usr/local/libpng/lib -L/usr/local/libtiff/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib
LIBS = -lbz2 -lxml2 -lz -lm -lpthread
I am just not good with this terminal stuff quite yet, so I am mostly unsure how to interpret all these lines. I should have just used brew to install it in the first place D:
Any help would be appreciated!
Personally, I would recommend ImageMagick over GraphicsMagick, with reasons as in the comments above.
To sort out your current situation, I would do the following:
ensure my PATH is correct for homebrew
uninstall all the mentioned packages
install the necessary packages
check my setup
So, I'll cover each aspect of that with a separate section, and put a horizontal rule in between.
Edit your login profile, probably $HOME/.profile and make sure that /usr/local/bin is at the start because that is where homebrew installs stuff. So basically, you want a line near the end like:
export PATH=/usr/local/bin:$PATH
Exit Terminal, and then start a new Terminal and check your PATH starts correctly with /usr/local/bin by running:
echo $PATH
Now remove all the packages you have been playing with:
brew rm imagemagick jpeg libpng graphicsmagick
Now reinstall just the ones you want:
brew install jpeg libpng imagemagick
Now test that homebrew is happy, by running:
brew doctor
and following the good doctor's advice.
Then you should be able to run:
identify -version
convert -size 1024x768 gradient:red-blue first.jpg
You can see the created image by opening the Finder at the current directory:
open .
Then select the file with the mouse by tapping on it once, and press the SPACE bar to quick-look it.
I've been having issues with Homebrew's 1.3.27 version of GraphicsMagick - it doesn't seem to configure the delegates properly.
Downgrading to 1.3.26_2 has solved our issues.

gcc via homebrew has no --without-multilib option

I want to install xgboost in Python 3.5. This requires gcc to support -fopenmp option. Default gcc does not support it. So I am using
brew install gcc --without-multilib
But I get Warning: gcc: this formula has no '--without-multilib' option so it will be ignored! Any ideas?
The option no longer exists, since 8/2017. Many older 3rd-party xgboost instructions are outdated. Just do brew install gcc without options and be amazed that everything still works.

Cross-compiling libjpeg framework for MacOS 10.5 on macOS 10.12

I've tweaked a script for building libjpeg framework here. The key configuration is as follows,
../configure --target i386-apple-darwin9.0 --build i386-apple-darwin9.0 --prefix=$OSXPREFIXDIR/osx-build --disable-dependency-tracking --enable-static=yes --enable-shared=no CFLAGS="-isysroot $XCODE_ROOT/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.5.sdk"
I've been able to create the framework, However it is still built for macOS 10.12 when I use otool -l to check libjpeg object file. Could anyone share a thought?
I have no solution for your compilation problem but if you just want a working libjpeg binary for OS X 10.5+ then you can download it from libjpeg-turbo (either as a static library or as a dynamic one, and both libjpeg and libturbojpeg).
Check: https://libjpeg-turbo.org/Documentation/OfficialBinaries
You'll find a .dmg file on their SourceForge.
Try adding -mmacosx-version-min=10.5 to the CFLAGS. You may not need the target/build parameters, and it may be possible to compile against the latest SDK rather than needing the 10.5 SDK.

What does gcc without multilib mean?

I was trying to use the omh.h header file and I realized it was missing. I tried reinstalling gcc on my mac using brew. This is the message I got at the end of the installation.
..
GCC has been built with multilib support. Notably, OpenMP may not work:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60670
If you need OpenMP support you may want to
brew reinstall gcc --without-multilib
==> Summary
🍺 /usr/local/Cellar/gcc/4.9.2_1: 1156 files, 203M
It suggests that if I need OpenMP support I need to install brew reinstall gcc --without-multilib. I am not able to understand the meaning of --without-multilib. How is it different from simply installing gcc?
And apparently brew reinstall gcc --without-multilib takes forever to run and brew uninstall gcc && brew install gcc was lightning fast.
Multilib means support for multiple architectures, so you can compile binaries for them.
Given the bug you show, you should be safe as long you build binaries for AMD64 architecture (64-bit) and IA32, as that is what your machine is.
Otherwise, better to choose without multilib.

Since gcc on mac doesn't support openmp, what can I do to let it support?

At the first,I used the default gcc on my mac.but it does't support openmp.
using "gcc -v",I get gcc 4.2.1
So, I used brew to install gcc. When it is done, using the "gcc -v",it has no changes.
the brew give tips to me "openmp may not be supported,using "brew reinstall gcc --without-muli"??
I don't remember the "muli???" accurately.I try that,but It doesn't help.
So, this is my question: What can I do to make my gcc to support openmp in my macbook?
Brew will install gcc under a slightly different name to not clobber the existing gcc. The easiest way to check for other gcc's is to type gcc- and then hit the TAB key to see what completions there are. I believe brew's current gcc is 4.9.1, so after installing gcc with brew you should be able to access it with gcc-4.9.

Resources