How to build 32bit version on OS X?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
xiexin36
Posts: 7
Joined: 2016-02-24T00:56:13-07:00
Authentication code: 1151

How to build 32bit version on OS X?

Post by xiexin36 »

Hi:
I need a 32bit version ImageMagick on OS X, but I found there's only x86_64 version on the download page. My OS X is 10.11.3. Xcode is 7.2.1,
So I tried to use Homebrew to install, with "brew install imagemagick", also I tried to use "brew install imagemagick --build-from-source",
It always install the x86_64 version.
Then I tried to build it from source code, I download the imagemagick-6.9.3-0.tar.xz from the website, but when I run ./configure, I got this error,

coders/msl.c:101:12: fatal error: 'libxml/parser.h' file not found
# include <libxml/parser.h>
^
1 error generated.

Then I tried to modify the home-brew 's ruby script, because the brew install it from source successful, here is the script
https://github.com/Homebrew/homebrew/bl ... emagick.rb
First I tried to set --host=i386-apple-darwin, it still make x86_64 version, I add --target=i386-apple-darwin, and --build=i386-apple-darwin,
it's still not work,

Then I read here http://www.imagemagick.org/script/advan ... lation.php, find this option --enable-osx-universal-binary, add it and
try again, I got a error,

checking size of long double... configure: error: in `/Library/Caches/Homebrew/ImageMagick-6.9.3-0':
configure: error: cannot compute sizeof (long double)
See `config.log' for more details,

About this option I searched on the discusses, I found this viewtopic.php?t=22406, but there's no answer.

Also I tried add CFLAGS=-m32, it still not work, and come with this error

checking for libltdl...
checking ltdl.h usability... yes
checking ltdl.h presence... yes
checking for ltdl.h... yes
checking for lt_dlinit in -lltdl... no
checking if libltdl package is complete... no -- some components failed test
configure: error: in `/private/tmp/imagemagick20160224-33062-1hzq8r/ImageMagick-6.9.3-0':
configure: error: libltdl is required for modules build
See `config.log' for more details

Please anyone can help me? I just want a 32bit imagemagick,
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to build 32bit version on OS X?

Post by fmw42 »

This is how I build IM on my Mac. I install all delegates from MacPorts, then install IM for whatever Q level and with/without HDRI from source. Works fine for me. See viewtopic.php?f=1&t=21502&p=88202&hilit ... rts#p88202

Change quantum-depth to 32 (though I mostly just use Q16 or Q16 HDRI). The Q16 HDRI gives you floating point accuracy. Q32 is 32-bit int and will not preserve fractional or negative values.
xiexin36
Posts: 7
Joined: 2016-02-24T00:56:13-07:00
Authentication code: 1151

Re: How to build 32bit version on OS X?

Post by xiexin36 »

fmw42 wrote:This is how I build IM on my Mac. I install all delegates from MacPorts, then install IM for whatever Q level and with/without HDRI from source. Works fine for me. See viewtopic.php?f=1&t=21502&p=88202&hilit ... rts#p88202

Change quantum-depth to 32 (though I mostly just use Q16 or Q16 HDRI). The Q16 HDRI gives you floating point accuracy. Q32 is 32-bit int and will not preserve fractional or negative values.

Thank you for your replay, I'm sorry, maybe I didn't ask the question clear, I want to build a i386 version, so the IM library can be used in 32bit program,
Not the Color Space. Any ideas?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to build 32bit version on OS X?

Post by fmw42 »

My notes have nothing to do with colorspace.

What I have provided is the mechanism to compile IM as any Q level. IM produces images that are restricted to positive integer values depending upon how IM is compiled. For Q8 (range 0 to 255), Q16 (range 0 to 65535), Q32 range 0 to 32-bit integer. If you need negative values or floating point values, then you should build IM as Q16 HDRI. These are the bit level ranges of any given channel (not of the whole RGB(A) image). If you build as Q16 or Q32, you can always specify -depth 8 in your command line to limit the output per channel graylevel range to 8 bits rather than 16 or 32 bits.

Depending upon what Q level you want, you need to change the ./configure command to specify --with-quantum-depth=16 (for Q16) or use 8 or 32 in place of 16. If you want HDRI Q16, then add --enable-hdri

Sorry, I do not know anything about i386 vs x86 or 32-bit vs 64-bit Mac versions.
xiexin36
Posts: 7
Joined: 2016-02-24T00:56:13-07:00
Authentication code: 1151

Re: How to build 32bit version on OS X?

Post by xiexin36 »

fmw42 wrote:My notes have nothing to do with colorspace.

What I have provided is the mechanism to compile IM as any Q level. IM produces images that are restricted to positive integer values depending upon how IM is compiled. For Q8 (range 0 to 255), Q16 (range 0 to 65535), Q32 range 0 to 32-bit integer. If you need negative values or floating point values, then you should build IM as Q16 HDRI. These are the bit level ranges of any given channel (not of the whole RGB(A) image). If you build as Q16 or Q32, you can always specify -depth 8 in your command line to limit the output per channel graylevel range to 8 bits rather than 16 or 32 bits.

Depending upon what Q level you want, you need to change the ./configure command to specify --with-quantum-depth=16 (for Q16) or use 8 or 32 in place of 16. If you want HDRI Q16, then add --enable-hdri

Sorry, I do not know anything about i386 vs x86 or 32-bit vs 64-bit Mac versions.
Thank you for your reply, How about "cross compile"? In 32-bit program, all the binary should be 32-bit, just like on the download page, it provide both ImageMagick-6.9.3-5.x86_64.rpm (64-bit)and ImageMagick-6.9.3-5.i386.rpm (32-bit), but for Mac, there's only ImageMagick-x86_64-apple-darwin15.2.0.tar.gz, I need a i386 version.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to build 32bit version on OS X?

Post by fmw42 »

Sorry, I do not know how to do that. I suspect there is some command that needs to be supplied to the ./configure that will do that. One of the IM developers would have to provide that information. Unfortunately, IM does not provide both as binaries, so you will have to compile from source. See http://www.imagemagick.org/script/insta ... e.php#unix and http://www.imagemagick.org/script/advan ... php#macosx
xiexin36
Posts: 7
Joined: 2016-02-24T00:56:13-07:00
Authentication code: 1151

Re: How to build 32bit version on OS X?

Post by xiexin36 »

fmw42 wrote:Sorry, I do not know how to do that. I suspect there is some command that needs to be supplied to the ./configure that will do that. One of the IM developers would have to provide that information. Unfortunately, IM does not provide both as binaries, so you will have to compile from source. See http://www.imagemagick.org/script/insta ... e.php#unix and http://www.imagemagick.org/script/advan ... php#macosx
Yes, those two documents I have read, and I wrote the steps what I have done before, you can check it, Unfortunately, it doesn't work.
So I asked here. Hope someone can help me.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to build 32bit version on OS X?

Post by fmw42 »

I expect that one of the IM developers can point you in the right direction.
xiexin36
Posts: 7
Joined: 2016-02-24T00:56:13-07:00
Authentication code: 1151

Re: How to build 32bit version on OS X?

Post by xiexin36 »

fmw42 wrote:I expect that one of the IM developers can point you in the right direction.
Thanks again, and anyone can help me?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How to build 32bit version on OS X?

Post by snibgo »

From ./configure, it seems you get i386 only if both host is *darwin* or *-macos10*, and enable_osx_universal_binary is set (./configure option "--enable-osx-universal-binary").

But I'm not an expert on configure or Macs.
snibgo's IM pages: im.snibgo.com
xiexin36
Posts: 7
Joined: 2016-02-24T00:56:13-07:00
Authentication code: 1151

Re: How to build 32bit version on OS X?

Post by xiexin36 »

snibgo wrote:From ./configure, it seems you get i386 only if both host is *darwin* or *-macos10*, and enable_osx_universal_binary is set (./configure option "--enable-osx-universal-binary").

But I'm not an expert on configure or Macs.
Yes, but if I set enable_osx_universal_binary it will get a error.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to build 32bit version on OS X?

Post by fmw42 »

Perhaps the OP should provide his full ./configure command.
xiexin36
Posts: 7
Joined: 2016-02-24T00:56:13-07:00
Authentication code: 1151

Re: How to build 32bit version on OS X?

Post by xiexin36 »

Anyone else can help me?
yothsoggoth
Posts: 1
Joined: 2016-09-28T04:40:42-07:00
Authentication code: 1151

Re: How to build 32bit version on OS X?

Post by yothsoggoth »

For what it's worth in case anyone else stumbles into this topic looking for help, I managed to get this working with the following configure command:

./configure --with-quantum-depth=16 --disable-dependency-tracking --without-perl CFLAGS="-arch i386" LDFLAGS="-arch i386" --enable-hdri=no --with-jpeg=yes --with-tiff=yes

However, having tried to modify the Homebrew script to use the same configure arguments did not work - in the end I just downloaded and built manually.
Post Reply