|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /usr/share/gtk-doc/html/glib/ |
Upload File : |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Compiling the GLib package</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
<link rel="start" href="index.html" title="GLib Reference Manual">
<link rel="up" href="glib.html" title="GLib Overview">
<link rel="prev" href="glib.html" title="GLib Overview">
<link rel="next" href="glib-cross-compiling.html" title="Cross-compiling the GLib package">
<meta name="generator" content="GTK-Doc V1.6 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="glib.html" title="GLib Overview">
<link rel="chapter" href="glib-fundamentals.html" title="GLib Fundamentals">
<link rel="chapter" href="glib-core.html" title="GLib Core Application Support">
<link rel="chapter" href="glib-utilities.html" title="GLib Utilities">
<link rel="chapter" href="glib-data-types.html" title="GLib Data Types">
<link rel="chapter" href="tools.html" title="GLib Tools">
<link rel="index" href="ix01.html" title="Index">
<link rel="index" href="ix02.html" title="Index of deprecated symbols">
<link rel="index" href="ix03.html" title="Index of new symbols in 2.2">
<link rel="index" href="ix04.html" title="Index of new symbols in 2.4">
<link rel="index" href="ix05.html" title="Index of new symbols in 2.6">
<link rel="index" href="ix06.html" title="Index of new symbols in 2.8">
<link rel="index" href="ix07.html" title="Index of new symbols in 2.10">
<link rel="index" href="ix08.html" title="Index of new symbols in 2.12">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
<td><a accesskey="p" href="glib.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="glib.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GLib Reference Manual</th>
<td><a accesskey="n" href="glib-cross-compiling.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry" lang="en">
<a name="glib-building"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle">Compiling the GLib package</span></h2>
<p>Compiling the GLib Package —
How to compile GLib itself
</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1" lang="en">
<a name="building"></a><h2>Building the Library on UNIX</h2>
<p>
On UNIX, GLib uses the standard GNU build system,
using <span class="application">autoconf</span> for package
configuration and resolving portability issues,
<span class="application">automake</span> for building makefiles
that comply with the GNU Coding Standards, and
<span class="application">libtool</span> for building shared
libraries on multiple platforms. The normal sequence for
compiling and installing the GLib library is thus:
</p>
<div class="literallayout"><p><br>
          <strong class="userinput"><code>./configure</code></strong><br>
          <strong class="userinput"><code>make</code></strong><br>
          <strong class="userinput"><code>make install</code></strong><br>
        </p></div>
<p>
</p>
<p>
The standard options provided by <span class="application">GNU
autoconf</span> may be passed to the
<span><strong class="command">configure</strong></span> script. Please see the
<span class="application">autoconf</span> documentation or run
<span><strong class="command">./configure --help</strong></span> for information about
the standard options.
</p>
<p>
The GTK+ documentation contains
<a href="../gtk/gtk-building.html" target="_top">further details</a>
about the build process and ways to influence it.
</p>
</div>
<div class="refsect1" lang="en">
<a name="dependencies"></a><h2>Dependencies</h2>
<p>
Before you can compile the GLib library, you need to have
various other tools and libraries installed on your
system. The two tools needed during the build process (as
differentiated from the tools used in when creating GLib
mentioned above such as <span class="application">autoconf</span>)
are <span><strong class="command">pkg-config</strong></span> and GNU make.
</p>
<div class="itemizedlist"><ul type="disc">
<li><p>
<a href="http://www.freedesktop.org/software/pkgconfig/" target="_top">pkg-config</a>
is a tool for tracking the compilation flags needed for
libraries that are used by the GLib library. (For each
library, a small <code class="literal">.pc</code> text file is
installed in a standard location that contains the compilation
flags needed for that library along with version number
information.) The version of <span><strong class="command">pkg-config</strong></span>
needed to build GLib is mirrored in the
<code class="filename">dependencies</code> directory
on the <a href="ftp://ftp.gtk.org/pub/gtk/v2.2/" target="_top">GTK+ FTP
site.</a>
</p></li>
<li><p>
The GTK+ makefiles will mostly work with different versions
of <span><strong class="command">make</strong></span>, however, there tends to be
a few incompatibilities, so the GTK+ team recommends
installing <a href="http://www.gnu.org/software/make" target="_top">GNU
make</a> if you don't already have it on your system
and using it. (It may be called <span><strong class="command">gmake</strong></span>
rather than <span><strong class="command">make</strong></span>.)
</p></li>
</ul></div>
<p>
GLib depends on a number of other libraries.
</p>
<div class="itemizedlist"><ul type="disc">
<li>
<p>
The <a href="http://www.gnu.org/software/libiconv/" target="_top">GNU
libiconv library</a> is needed to build GLib if your
system doesn't have the <code class="function">iconv()</code>
function for doing conversion between character
encodings. Most modern systems should have
<code class="function">iconv()</code>, however many older systems lack
an <code class="function">iconv()</code> implementation. On such systems,
you must install the libiconv library. This can be found at:
<a href="http://www.gnu.org/software/libiconv" target="_top">http://www.gnu.org/software/libiconv</a>.
</p>
<p>
If your system has an <code class="function">iconv()</code> implementation but
you want to use libiconv instead, you can pass the
--with-libiconv option to configure. This forces
libiconv to be used.
</p>
<p>
Note that if you have libiconv installed in your default include
search path (for instance, in <code class="filename">/usr/local/</code>), but
don't enable it, you will get an error while compiling GLib because
the <code class="filename">iconv.h</code> that libiconv installs hides the
system iconv.
</p>
<p>
If you are using the native iconv implementation on Solaris
instead of libiconv, you'll need to make sure that you have
the converters between locale encodings and UTF-8 installed.
At a minimum you'll need the SUNWuiu8 package. You probably
should also install the SUNWciu8, SUNWhiu8, SUNWjiu8, and
SUNWkiu8 packages.
</p>
<p>
The native iconv on Compaq Tru64 doesn't contain support for
UTF-8, so you'll need to use GNU libiconv instead. (When
using GNU libiconv for GLib, you'll need to use GNU libiconv
for GNU gettext as well.) This probably applies to related
operating systems as well.
</p>
</li>
<li><p>
The libintl library from the <a href="http://www.gtk.org/software/gettext" target="_top">GNU gettext
package</a> is needed if your system doesn't have the
<code class="function">gettext()</code> functionality for handling
message translation databases.
</p></li>
<li><p>
A thread implementation is needed, unless you want to compile GLib
without thread support, which is not recommended. The thread support
in GLib can be based upon several native thread implementations,
e.g. POSIX threads, DCE threads or Solaris threads.
</p></li>
</ul></div>
</div>
<div class="refsect1" lang="en">
<a name="extra-configuration-options"></a><h2>Extra Configuration Options</h2>
<p>
In addition to the normal options, the
<span><strong class="command">configure</strong></span> script in the GLib
library supports these additional arguments:
</p>
<div class="cmdsynopsis"><p><code class="command">configure</code> [[--enable-debug=[no|minimum|yes]]] [[--disable-gc-friendly] | [--enable-gc-friendly]] [[--disable-mem-pools] | [--enable-mem-pools]] [[--disable-threads] | [--enable-threads]] [[--with-threads=[none|posix|dce|win32]]] [[--disable-included-printf] | [--enable-included-printf]] [[--disable-visibility] | [--enable-visibility]] [[--disable-gtk-doc] | [--enable-gtk-doc]] [[--disable-man] | [--enable-man]]</p></div>
<p>
</p>
<p><b><code class="systemitem">--enable-debug</code>. </b>
Turns on various amounts of debugging support. Setting this to 'no'
disables g_assert(), g_return_if_fail(), g_return_val_if_fail() and
all cast checks between different object types. Setting it to 'minimum' disables only cast checks. Setting it to 'yes' enables
runtime debugging.
The default is 'minimum'.
Note that 'no' is fast, but dangerous as it tends to destabilize
even mostly bug-free software by changing the effect of many bugs
from simple warnings into fatal crashes. Thus
<code class="option">--enable-debug=no</code> should <span class="emphasis"><em>not</em></span>
be used for stable releases of GLib.
</p>
<p><b><code class="systemitem">--disable-gc-friendly</code> and
<code class="systemitem">--enable-gc-friendly</code>. </b>
By default, and with <code class="systemitem">--disable-gc-friendly</code>
as well, Glib does not clear the memory for certain objects before they
are freed. For example, Glib may decide to recycle GList nodes by
putting them in a free list. However, memory profiling and debugging tools like <a href="http://www.valgrind.org" target="_top">Valgrind</a> work better if an
application does not keep dangling pointers to freed memory (even
though these pointers are no longer dereferenced), or invalid pointers inside
uninitialized memory. The
<code class="systemitem">--enable-gc-friendly</code> option makes Glib clear
memory in these situations:
</p>
<div class="itemizedlist"><ul type="disc">
<li><p>
When shrinking a GArray, Glib will clear the memory no longer
available in the array: shrink an array from 10 bytes to 7, and
the last 3 bytes will be cleared. This includes removals of single and multiple elements.
</p></li>
<li><p>
</p></li>
<li><p>
When growing a GArray, Glib will clear the new chunk of memory.
Grow an array from 7 bytes to 10 bytes, and the last 3 bytes will be cleared.
</p></li>
<li><p>
The above applies to GPtrArray as well.
</p></li>
<li><p>
When freeing a node from a GHashTable, Glib will first clear
the node, which used to have pointers to the key and the value
stored at that node.
</p></li>
<li><p>
When destroying or removing a GTree node, Glib will clear the node,
which used to have pointers to the node's value, and the left and right subnodes.
</p></li>
</ul></div>
<p>
Since clearing the memory has a cost,
<code class="systemitem">--disable-gc-friendly</code> is the default.
</p>
<p><b><code class="systemitem">--disable-mem-pools</code> and
<code class="systemitem">--enable-mem-pools</code>. </b>
Many small chunks of memory are often allocated via collective pools
in GLib and are cached after release to speed up reallocations.
For sparse memory systems this behaviour is often inferior, so
memory pools can be disabled to avoid excessive caching and force
atomic maintenance of chunks through the <code class="function">g_malloc()</code>
and <code class="function">g_free()</code> functions. Code currently affected by
this:
</p>
<div class="itemizedlist"><ul type="disc">
<li><p>
<span class="structname">GList</span>, <span class="structname">GSList</span>,
<span class="structname">GNode</span>, <span class="structname">GHash</span>
allocations. The functions g_list_push_allocator(),
g_list_pop_allocator(), g_slist_push_allocator(),
g_slist_pop_allocator(), g_node_push_allocator() and
g_node_pop_allocator() are not available
</p></li>
<li><p>
<span class="structname">GMemChunk</span>s become basically non-effective
</p></li>
<li><p>
<span class="structname">GSignal</span> disables all caching (potentially
very slow)
</p></li>
<li><p>
<span class="structname">GType</span> doesn't honour the
<span class="structname">GTypeInfo</span>
<em class="structfield"><code>n_preallocs</code></em> field anymore
</p></li>
<li><p>
the <span class="structname">GBSearchArray</span> flag
<code class="literal">G_BSEARCH_ALIGN_POWER2</code> becomes non-functional
</p></li>
</ul></div>
<p>
</p>
<p><b><code class="systemitem">--disable-threads</code> and
<code class="systemitem">--enable-threads</code>. </b>
Do not compile GLib to be multi thread safe. GLib
will be slightly faster then. This is however not
recommended, as many programs rely on GLib being
multi thread safe.
</p>
<p><b><code class="systemitem">--with-threads</code>. </b>
Specify a thread implementation to use.
</p>
<div class="itemizedlist"><ul type="disc">
<li><p>
'posix' and 'dce' can be used interchangeable
to mean the different versions of Posix
threads. configure tries to find out, which
one is installed.
</p></li>
<li><p>
'none' means that GLib will be thread safe,
but does not have a default thread
implementation. This has to be supplied to
<code class="function">g_thread_init()</code> by the programmer.
</p></li>
</ul></div>
<p>
</p>
<p><b><code class="systemitem">--disable-included-printf</code> and
<code class="systemitem">--enable-included-printf</code>. </b>
By default the <span><strong class="command">configure</strong></span> script will try
to auto-detect whether the C library provides a suitable set
of <code class="function">printf()</code> functions. In detail,
<span><strong class="command">configure</strong></span> checks that the semantics of
<code class="function">snprintf()</code> are as specified by C99 and
that positional parameters as specified in the Single Unix
Specification are supported. If this not the case, GLib will
include an implementation of the <code class="function">printf()</code>
family.
These options can be used to explicitly control whether
an implementation fo the <code class="function">printf()</code> family
should be included or not.
</p>
<p><b><code class="systemitem">--disable-visibility</code> and
<code class="systemitem">--enable-visibility</code>. </b>
By default, GLib uses ELF visibility attributes to optimize
PLT table entries if the compiler supports ELF visibility
attributes. A side-effect of the way in which this is currently
implemented is that any header change forces a full
recompilation, and missing includes may go unnoticed.
Therefore, it makes sense to turn this feature off while
doing GLib development, even if the compiler supports ELF
visibility attributes. The <code class="option">--disable-visibility</code>
option allows to do that.
</p>
<p><b><code class="systemitem">--disable-gtk-doc</code> and
<code class="systemitem">--enable-gtk-doc</code>. </b>
By default the <span><strong class="command">configure</strong></span> script will try
to auto-detect whether the
<span class="application">gtk-doc</span> package is installed. If
it is, then it will use it to extract and build the
documentation for the GLib library. These options
can be used to explicitly control whether
<span class="application">gtk-doc</span> should be
used or not. If it is not used, the distributed,
pre-generated HTML files will be installed instead of
building them on your machine.
</p>
<p><b><code class="systemitem">--disable-man</code> and
<code class="systemitem">--enable-man</code>. </b>
By default the <span><strong class="command">configure</strong></span> script will try
to auto-detect whether <span class="application">xsltproc</span>
and the necessary Docbook stylesheets are installed. If
they are, then it will use them to rebuild the included
man pages from the XML sources. These options can be used
to explicitly control whether man pages should be rebuilt
used or not. The distribution includes pre-generated man
pages.
</p>
</div>
</div>
</body>
</html>