root / ImageMagick / trunk / Install-unix.txt

Revision 7647, 25.7 kB (checked in by cristy, 11 months ago)
Line 
1UNIX/Cygwin/MinGW COMPILATION
2
3Note:
4
5  Platform specific notes regarding specific operating systems may be found
6  in the Platforms.txt file.  This document  provides generic instructions
7  which work in most common cases.  Additional notes regarding Cygwin &
8  MinGW are provided later in this file.
9
10Type:
11
12    gzip -dc ImageMagick-6.2.2.tar.gz | tar xvf -
13    cd ImageMagick-6.2.2
14
15If you do not have gzip(1), the source for the gzip package is available
16as a shell archive at
17
18    ftp://ftp.gnu.org/gnu/gzip/gzip-1.2.4a.shar
19
20or as a tar archive at
21
22    ftp://ftp.gnu.org/gnu/gzip/gzip-1.2.4a.tar
23
24Use the 'configure' script to automatically configure, build, and install
25ImageMagick.  The configure script may be executed from the ImageMagick source
26directory (e.g ./configure) or from a seperate build directory by specifying
27the full path to configure (e.g.  /src/ImageMagick-6.2.2/configure).  The
28advantage of using a seperate build directory is that multiple ImageMagick
29builds may share the same ImageMagick source directory while allowing each
30build to use a unique set of options.
31
32If you are willing to accept configure's default options, and build from
33within the source directory, type:
34
35    ./configure
36
37and watch the configure script output to verify that it finds everything
38that you think it should.  If it does not, then adjust your environment
39so that it does.
40
41By default,
42
43    make install
44
45will install the package's files in `/usr/local/bin', `/usr/local/lib', etc..
46You can specify an installation prefix other than `/usr/local' by giving
47`configure' the option `--prefix=PATH'.  This is valuable in case you don't
48have privileges to install under the default paths or if you want to install
49in the system directories instead.
50
51If you are not happy with configure's choice of compiler, compilation flags,
52or libraries, you can give `configure' initial values for variables by
53specifying them on the configure command line, e.g.:
54
55    ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
56
57Options which should be common to packages installed under the same directory
58heirarchy may be supplied via a 'config.site' file located under the
59installation prefix via the path ${prefix}/share/config.site where ${prefix} is
60the installation prefix.  This file is used for all packages installed under
61that prefix.  This is an example config.site file:
62
63    # Configuration values for all packages installed under this prefix
64    CC=gcc
65    CXX=c++
66    CPPFLAGS='-I/usr/local/include'
67    LDFLAGS='-L/usr/local/lib -R/usr/local/lib'
68
69When the 'config.site' file is being used to supply configuration options,
70configure will issue a message similar to:
71
72    configure: loading site script /usr/local/share/config.site
73
74The configure variables you should be aware of are:
75
76    CC          Name of C compiler (e.g. 'cc -Xa') to use
77    CXX         Name of C++ compiler to use (e.g. 'CC')
78    CFLAGS      Compiler flags (e.g. '-g -O2') to compile C code
79    CXXFLAGS    Compiler flags (e.g. '-g -O2') to compile C++ code
80    CPPFLAGS    Include paths (-I/somedir) to look for header files
81    LDFLAGS     Library paths (-L/somedir) to look for libraries
82                Systems that support the notion of a library run-path
83                may require an additional argument in order to find
84                shared libraries at run time. For example, the Solaris
85                linker requires an argument of the form '-R/somedir',
86                some Linux systems will work with '-rpath /somedir',
87                while some other Linux systems who's gcc does not pass
88                -rpath to the linker require an argument of the form
89                '-Wl,-rpath,/somedir'.
90    LIBS        Extra libraries (-lsomelib) required to link
91
92Any variable (e.g. CPPFLAGS or LDFLAGS) which requires a directory path must
93specify an absolute path rather than a relative path.
94
95Configure can usually find the X include and library files automatically, but
96if it doesn't, you can use the `configure' options `--x-includes=DIR' and
97`--x-libraries=DIR' to specify their locations.
98
99The configure script provides a number of ImageMagick specific options.  When
100disabling an option --disable-something is equivalent to specifying
101--enable-something=no and --without-something is equivalent to
102--with-something=no.  The configure options are as follows (execute 'configure
103--help' to see all options).
104
105Optional Features:
106 --enable-ccmalloc       enable 'ccmalloc' memory debug support (default disabled)
107 --enable-prof           enable 'prof' profiling support (default disabled)
108 --enable-gprof          enable 'gprof' profiling support (default disabled)
109 --enable-gcov           enable 'gcov' profiling support (default disabled)
110 --disable-installed     disable building an installed ImageMagick
111                         (default enabled)
112 --disable-largefile     disable support for large (64 bit) file offsets
113
114Optional Packages/Options:
115 --with-quantum-depth    number of bits in a pixel quantum (default 8)
116 --with-modules          enable support for dynamically loadable modules
117 --with-cache            set pixel cache threshhold (defaults to available memory)
118 --without-threads       disable threads support
119 --with-frozenpaths      enable frozen delegate paths
120 --without-magick-plus-plus disable build/install of Magick++
121 --without-perl          disable build/install of PerlMagick
122      or
123 --with-perl=PERL        use specified Perl binary to configure PerlMagick
124 --with-perl-options=OPTIONS  options to pass on command-line when
125                         generating PerlMagick's Makefile from Makefile.PL
126 --without-bzlib         disable BZLIB support
127 --without-dps           disable Display Postscript support
128 --with-fpx              enable FlashPIX support
129 --with-gslib            enable Ghostscript library support
130 --without-jbig          disable JBIG support
131 --without-jpeg          disable JPEG support
132 --without-jp2           disable JPEG v2 support
133 --without-lcms          disable LCMS support
134 --without-png           disable PNG support
135 --without-tiff          disable TIFF support
136 --without-ttf           disable TrueType support
137 --without-wmf           disable WMF support
138 --with-fontpath         prepend to default font search path
139 --with-gs-font-dir      directory containing Ghostscript fonts
140 --with-windows-font-dir directory containing MS-Windows fonts
141 --without-xml           disable XML support
142 --without-zlib          disable ZLIB support
143 --with-x                use the X Window System
144 --with-share-path=DIR   Alternate path to share directory
145                         (default share/ImageMagick)
146 --with-libstdc=DIR      use libstdc++ in DIR (for GNU C++)
147
148ImageMagick options represent either features to be enabled, disabled, or
149packages to be included in the build.  When a feature is enabled (via
150--enable-something), it enables code already present in ImageMagick.  When a
151package is enabled (via --with-something), the configure script will search for
152it, and if is is properly installed and ready to use (headers and built
153libraries are found by compiler) it will be included in the build.  The
154configure script is delivered with all features disabled and all packages
155enabled. In general, the only reason to disable a package is if a package
156exists but it is unsuitable for the build (perhaps an old version or not
157compiled with the right compilation flags).
158
159Several configure options require special note:
160
161  * --enable-shared: the shared libraries are built and support for
162    loading coder and process modules is enabled. Shared libraries are
163    preferred because they allow programs to share common code, making
164    the individual programs much smaller. In addition shared libraries
165    are required in order for PerlMagick to be dynamically loaded by an
166    installed PERL (otherwise an additional PERL (PerlMagick) must be
167    installed.
168
169    ImageMagick built with delegates (see MAGICK PLUG-INS below) can pose
170    additional challenges. If ImageMagick is built using static libraries (the
171    default without --enable-shared) then delegate libraries may be built as
172    either static libraries or shared libraries. However, if ImageMagick is
173    built using shared libraries, then all delegate libraries must also be
174    built as shared libraries.  Static libraries usually have the extension
175    .a, while shared libraries typically have extensions like .so, .sa, or
176    .dll. Code in shared libraries normally must compiled using a special
177    compiler option to produce Position Independent Code (PIC). The only time
178    this is not necessary is if the platform compiles code as PIC by default.
179
180    PIC compilation flags differ from vendor to vendor (gcc's is
181    -fPIC). However, you must compile all shared library source with the
182    same flag (for gcc use -fPIC rather than -fpic). While static libraries
183    are normally created using an archive tool like 'ar', shared libraries
184    are built using special linker or compiler options (e.g. -shared for gcc).
185
186    Building shared libraries often requires subtantial hand-editing of
187    Makefiles and is only recommended for those who know what they are doing.
188
189    If --enable-shared is not specified, a new PERL interpreter (PerlMagick)
190    is built which is statically linked against the PerlMagick extension. This
191    new interpreter is installed into the same directory as the ImageMagick
192    utilities. If --enable-shared is specified, the PerlMagick extension is
193    built as a dynamically loadable object which is loaded into your current
194    PERL interpreter at run-time. Use of dynamically-loaded extensions is
195    preferable over statically linked extensions so --enable-shared should
196    be specified if possible (note that all libraries used with ImageMagick
197    must be shared libraries!).
198
199  * --disable-static: static archive libraries (with extension .a)
200    are not built.  If you are building shared libraries, there is little
201    value to building static libraries. Reasons to build static libraries
202    include: 1) they can be easier to debug; 2) the clients do not have
203    external dependencies (i.e. libMagick.so); 3) building PIC versions
204    of the delegate libraries may take additional expertise and effort; 4)
205    you are unable to build shared libraries.
206
207  * --disable-installed: By default the ImageMagick build is
208    configured to formally install into a directory tree.  This is the
209    most secure and reliable way to install ImageMagick.  Specifying
210    --disable-installed configures ImageMagick so that it doesn't use
211    hard-coded paths and locates support files by computing an offset path
212    from the executable (or from the location specified by the MAGICK_HOME
213    environment variable. The uninstalled configuration is ideal for binary
214    distributions which are expected to extract and run in any location.
215
216  * --with-modules: image coders and process modules are built as
217    loadable modules which are installed under the directory
218    [prefix]/lib/ImageMagick-X.X.X/modules-QN (where 'N' equals 8, 16,
219    or 32 depending on the quantum depth) in the subdirectories 'coders'
220    and 'filters' respectively. The modules build option is only available
221    in conjunction with --enable-shared. If --enable-shared is not also
222    specified, then support for building modules is disabled.  Note that
223    if --enable-shared is specified, the module loader is active (allowing
224    extending an installed ImageMagick by simply copying a module into place)
225    but ImageMagick itself is not built using modules.
226
227  * --with-quantum-depth: This option allows the user to specify the
228    number of bits to use per pixel quantum (the size of the red, green,
229    blue, and alpha pixel components. For example, "--with-quantum-depth=8"
230    builds ImageMagick using 8-bit quantums.  Most computer display adaptors
231    use 8-bit quantums. Currently supported arguments are 8, 16, or 32. The
232    default is 8. This option is the most important option in determining
233    the overall run-time performance of ImageMagick.
234
235    The number of bits in a quantum determines how many values it may
236    contain. Each quantum level supports 256 times as many values as the
237    previous level. The following table shows the range available for
238    various quantum sizes.
239
240        QuantumDepth  Valid Range (Decimal)  Valid Range (Hex)
241              8            0-255                   00-FF
242             16           0-65535                0000-FFFF
243             32         0-4294967295         00000000-FFFFFFFF
244
245    Larger pixel quantums cause ImageMagick to run more slowly and to
246    require more memory. For example, using sixteen-bit pixel quantums
247    causes ImageMagick to run 15% to 50% slower (and take twice as much
248    memory) than when it is built to support eight-bit pixel quantums.
249
250    The amount of virtual memory consumed by an image can be computed by
251    the equation (QuantumDepth*Rows*Columns*5)/8. This is an important
252    consideration when resources are limited, particularly since processing
253    an image may require several images to be in memory at one time. The
254    following table shows memory consumption values for a 1024x768 image:
255
256        QuantumDepth  Virtual Memory
257            8              3MB
258           16              8MB
259           32             15MB
260
261  * --without-magick-plus-plus: Disable building Magick++, the C++
262    application programming interface to ImageMagick. A suitable C++
263    compiler is required in order to build Magick++. Specify the CXX
264    configure variable to select the C++ compiler to use (default "g++"),
265    and CXXFLAGS to select the desired compiler opimization and debug flags
266    (default "-g -O2"). Antique C++ compilers will normally be rejected by
267    configure tests so specifying this option should only be necessary if
268    Magick++ fails to compile.
269
270  * --with-frozenpaths: Normally external program names are substituted
271    into the delegates.xml file without full paths. Specify this option
272    to enable saving full paths to programs using locations determined by
273    configure. This is useful for environments where programs are stored
274    under multiple paths, and users may use different PATH settings than
275    the person who builds ImageMagick.
276
277  * --without-threads: By default, the ImageMagick library is compiled
278    with multi-thread support.  If this is undesireable, then specify
279    --without-threads.
280
281  * --with-cache: Specify a different image pixel cache threshold
282    using the --with-cache option. This sets the maximum amount of heap
283    memory that ImageMagick is allowed to consume before switching to using
284    memory-mapped temporary files to store raw pixel data.
285
286  * --disable-largefile: By default, ImageMagick is compiled with
287    support for large (> 2GB on a 32-bit CPU) files if the operating system
288    supports large files.  All applications which use the ImageMagick library
289    must then also include support for large files. By disabling support for
290    large files via --disable-largefile, dependent applications do not require
291    special compilation options for large files in order to use the library.
292
293  * --without-perl: By default, PerlMagick is conveniently compiled
294    and installed as part of ImageMagick's normal "configure", "make",
295    "make install" process.. When --without-perl is specified, you must
296    first install ImageMagick, change to the PerlMagick subdirectory, build,
297    and finally install PerlMagick. Note, PerlMagick is configured even if
298    --without-perl is specified. If the argument --with-perl=/path/to/perl
299    is supplied, then /path/to/perl will be taken as the PERL interpreter
300    to use. This is important in case the 'perl' executable in your PATH
301    is not PERL5, or is not the PERL you want to use.
302
303  * --with-perl-options: The PerlMagick module is normally installed
304    using the Perl interpreter's installation PREFIX, rather than
305    ImageMagick's. If ImageMagick's installation prefix is not the same
306    as PERL's PREFIX, then you may find that PerlMagick's 'make install'
307    step tries to install into a directory tree that you don't have write
308    permissions to. This is common when PERL is delivered with the operating
309    system or on Internet Service Provider (ISP) web servers. If you want
310    PerlMagick to install elsewhere, then provide a PREFIX option to PERL's
311    configuration step via "--with-perl-options=PREFIX=/some/place". Other
312    options accepted by MakeMaker are 'LIB', 'LIBPERL_A', 'LINKTYPE',
313    and 'OPTIMIZE'. See the ExtUtils::MakeMaker(3) manual page for more
314    information on configuring PERL extensions.
315
316   * --without-x: By default, ImageMagick uses the X11 delegate libraries if
317     they are available. When --without-x is specified, use of X11 is disabled.
318     The display, animate, and import sub-commands are not included. The
319     remaining sub-commands have reduced functionality such as no access to X11
320     fonts (consider using Postscript or TrueType fonts instead).
321
322  * --with-gs-font-dir: Specify the directory containing the
323    Ghostscript Postscript Type 1 font files (e.g. "n022003l.pfb") so
324    that they can be rendered using the FreeType library. If the font
325    files are installed using the default Ghostscript installation paths
326    (${prefix}/share/ghostscript/fonts), they should be discovered
327    automatically by configure and specifying this option is not
328    necessary. Specify this option if the Ghostscript fonts fail to be
329    located automatically, or the location needs to be overridden.
330
331  * --with-windows-font-dir: Specify the directory containing
332    MS-Windows-compatible fonts. This is not necessary when ImageMagick is
333    running under MS-Windows.
334
335----
336
337Mac OS X-specific Build instructions
338
339Perform these steps as an administrator or with the sudo command:
340
341    * Install Fink. The default setup creates a /sw folder on your main hard
342    * drive. Make sure /sw/bin is in your path.
343    * Install the latest Xcode from Apple.
344    * Create a symbolic link in /Developer/SDKs/MacOSX10.4u.sdk/ to /sw:
345
346        cd /Developer/SDKs/MacOSX10.4u.sdk
347        ln -s sw /sw
348
349    * Use Fink, or FinkCommander to install any delegate libraries you
350    * require, for example:
351
352        fink install libjpeg
353
354As a regular user or administrator:
355
356    * Download the ImageMagick source distribution.
357    * Unpack and change into the top-level ImageMagick directory:
358
359        tar xvfz ImageMagick-6.3.3-0.tar.gz
360        cd ImageMagick-6.3.3
361
362    * Choose an architecture and set your CFLAGS environment variable. Here we
363    * set CFLAGS for an Intel build:
364
365        export CFLAGS="-O -g -isysroot /Developer/SDKs/MacOSX10.4u.sdk/ -arch
366i386 -I/sw/include/"
367
368    * Set your LDFLAGS environment variable to:
369
370        export LDFLAGS="-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk/,-L/sw/lib/"
371
372    * Configure ImageMagick:
373
374        ./configure --prefix=/sw --with-quantum-depth=16 \
375          --disable-dependency-tracking --with-x=yes \
376          --x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib/ \
377          --without-perl
378
379    * Build ImageMagick:
380
381        make
382
383    * Install ImageMagick:
384
385        sudo make install
386
387    * To test the ImageMagick GUI, start X11 and in a new shell and type:
388
389        display -display :0
390
391An alterative method is to download and build ImageMagick with MacPorts.
392Download and install MacPorts and type the following command:
393
394  sudo port install ImageMagick
395
396This not only installs ImageMagick but includes many of the delegate libraries
397such as JPEG and FreeType.
398
399----
400
401Building under Cygwin
402
403  ImageMagick may be built under the Windows '95-XP Cygwin Unix-emulation
404  environment available for free from
405
406    http://www.cygwin.com/
407
408  X11R6 for Cygwin is available from
409
410    http://xfree86.cygwin.com/
411
412  We recommended that the X11R6 package be installed since this enables
413  ImageMagick's X11 support (animate, display, and import sub-commands will
414  work) and it includes the Freetype v2 DLL required to support TrueType
415  and Postscript Type 1 fonts. Make sure that /usr/X11R6/bin is in your PATH
416  prior to running the configure program.
417
418  If you are using Cygwin version 1.3.9 or later, you can specify the configure
419  option '--enable-shared' to build Cygwin DLLs.  This option is required if
420  you want to build PerlMagick under Cygwin because Cygwin does not provide the
421  libperl.a static library required to create a static PerlMagick.  Note that
422  since C++ exceptions do not currently work properly when thrown from a DLL,
423  the Magick++ library is always built as a static library. Be sure to not
424  specify --disable-static if you are building the Magick++ library since that
425  would surely lead to problems.
426
427----
428
429Building under MinGW & MSYS
430
431  ImageMagick may be built using the free MinGW ("Minimalistic GNU for
432  Windows") package version 1.1, available from
433
434    http://www.mingw.org
435
436  which consists of a GNU-based (e.g. gcc) compilation toolset plus headers
437  and libraries required to build programs which are entirely based on
438  standard Microsoft Windows DLLs. MSYS provides a Unix-like console shell
439  window with sufficient functionality to run the ImageMagick configure
440  script and execute make.
441
442  Unlike the Cygwin build which creates programs based on a Unix-emulation
443  DLL, and which uses Unix-style paths to access Windows files, the MinGW
444  build creates native Windows console applications similar to the Visual
445  C++ build.
446
447  Please note that since the MinGW build is very new, some aspects of the
448  installation may vary from Windows user's expectations, and that only a
449  static build (no DLLs or modules) is currently supported.
450
451  Once MinGW & MSYS have been installed, start the MSYS console (via the
452  MSYS icon on the Windows desktop) and follow the Unix configure and build
453  instructions. Note that the default installation prefix is "/usr/local"
454  which installs the package into a MSYS directory. To install outside
455  of the MSYS directory tree, you may specify an installation prefix like
456  "/c/ImageMagick" which causes the package to be installed under the Windows
457  directory "C:\ImageMagick". The installation directory structure will look
458  very much like the Unix installation layout (e.g. "C:\ImageMagick\bin",
459  "C:\ImageMagick\lib", "C:\ImageMagick\share", etc.). Any additional
460  delegate libraries (e.g. libpng) will need to be built under MinGW in
461  order to be used.
462
463----
464
465Dealing with configuration failures:
466
467  While configure is designed to ease installation of ImageMagick, it often
468  discovers problems that would otherwise be encountered later when compiling
469  ImageMagick. The configure script tests for headers and libraries by
470  executing the compiler (CC) with the specified compilation flags (CFLAGS),
471  pre-processor flags (CPPFLAGS), and linker flags (LDFLAGS). Any errors are
472  logged to the file 'config.log'. If configure fails to discover a header
473  or library please review this log file to determine why, however, please
474  be aware that *errors in the config.log are normal* because configure
475  works by trying something and seeing if it fails. An error in config.log
476  is only a problem if the test should have passed on your system. After
477  taking corrective action, be sure to remove the 'config.cache' file before
478  running configure so that configure will re-inspect the environment rather
479  than using cached values.
480
481  Common causes of configure failures are: 1) a delegate header is not in the
482  header include path (CPPFLAGS -I option); 2) a delegate library is not in
483  the linker search/run path (LDFLAGS -L/-R option); 3) a delegate library
484  is missing a function (old version?); 4) compilation environment is faulty.
485
486  If all reasonable corrective actions have been tried and the problem appears
487  be due to a flaw in the configure script, please send a bug report to the
488  ImageMagick Defect Support Forum at
489  http://studio.imagemagick.org/magick/viewforum.php?f=3.  All bug reports
490  should contain the operating system type (as reported by 'uname -a') and the
491  compiler/compiler-version. A copy of the configure script output and/or the
492  config.log file may be valuable in order to find the problem.  If you send a
493  config.log, please also send a script of the configure output and a
494  description of what you expected to see (and why) so the failure you are
495  observing can be identified and resolved.
496
497----
498
499Makefile Build Targets
500
501  Once ImageMagick is configured, these standard build targets are
502  available from the generated Makefiles:
503
504  * Build the package
505
506        make
507
508  * Install the package
509
510        make install
511
512  * Run tests using the installed ImageMagick ('make install' must be done
513    first!).
514
515        make check
516
517  * Remove everything in the build directory created by 'make'.
518
519        make clean
520
521  * Remove everything in the build directory created by 'configure' and 'make'.
522    This is useful if you want to start over from scratch.
523
524        make distclean
525
526  * Remove all files from the system which are (or would be) installed by
527    'make install' using the current configuration.  Note that this target is
528    imperfect for PerlMagick since Perl no longer supports an 'uninstall' target.
529
530        make uninstall
531
532----
533
534Build & Install:
535
536  Now that ImageMagick is configured, type
537
538     make
539
540  to build the package and
541
542     make install
543
544  to install it.
545
546----
547
548Verifying The Build:
549
550  To confirm your installation of the ImageMagick distribution was successful,
551  ensure that the installation directory is in your executable search path and
552  type:
553
554    display
555
556  The ImageMagick logo is displayed on your X11 display.
557
558  If the image colors are not correct use this command:
559
560    display -visual default
561
562  For a more serious test, you may run the ImageMagick test suite by
563  typing
564
565    make check
566
567  Note that due to differences between the developer's environment and
568  your own it is possible that some tests may be indicated as failed even
569  though the results are ok. Differences between the developer's environment
570  environment and your own may include the compiler, the CPU type, and the
571  library versions used. The ImageMagick developers use the current release
572  of all dependent libraries.
Note: See TracBrowser for help on using the browser.