glib-cross-compiling.html   [plain text]


<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Cross-compiling the GLib package</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="GLib Reference Manual"><link rel="up" href="glib.html" title="GLib Overview"><link rel="previous" href="glib-building.html" title="Compiling the GLib package"><link rel="next" href="glib-compiling.html" title="Compiling GLib Applications"><link rel="chapter" href="glib.html" title="GLib Overview"><link rel="refentry" href="glib-building.html" title="Compiling the GLib package"><link rel="refentry" href="glib-cross-compiling.html" title="Cross-compiling the GLib package"><link rel="refentry" href="glib-compiling.html" title="Compiling GLib Applications"><link rel="refentry" href="glib-running.html" title="Running GLib Applications"><link rel="refentry" href="glib-changes.html" title="Changes to GLib"><link rel="refentry" href="glib-resources.html" title="Mailing lists and bug reports"><link rel="chapter" href="glib-fundamentals.html" title="GLib Fundamentals"><link rel="refentry" href="glib-Basic-Types.html" title="Basic Types"><link rel="refentry" href="glib-Limits-of-Basic-Types.html" title="Limits of Basic Types"><link rel="refentry" href="glib-Standard-Macros.html" title="Standard Macros"><link rel="refentry" href="glib-Type-Conversion-Macros.html" title="Type Conversion Macros"><link rel="refentry" href="glib-Byte-Order-Macros.html" title="Byte Order Macros"><link rel="refentry" href="glib-Numerical-Definitions.html" title="Numerical Definitions"><link rel="refentry" href="glib-Miscellaneous-Macros.html" title="Miscellaneous Macros"><link rel="refentry" href="glib-Atomic-Operations.html" title="Atomic Operations"><link rel="chapter" href="glib-core.html" title="GLib Core Application Support"><link rel="refentry" href="glib-The-Main-Event-Loop.html" title="The Main Event Loop"><link rel="refentry" href="glib-Threads.html" title="
Threads"><link rel="refentry" href="glib-Thread-Pools.html" title="Thread Pools"><link rel="refentry" href="glib-Asynchronous-Queues.html" title="Asynchronous Queues"><link rel="refentry" href="glib-Dynamic-Loading-of-Modules.html" title="Dynamic Loading of Modules"><link rel="refentry" href="glib-Memory-Allocation.html" title="Memory Allocation"><link rel="refentry" href="glib-IO-Channels.html" title="IO Channels"><link rel="refentry" href="glib-Error-Reporting.html" title="Error Reporting"><link rel="refentry" href="glib-Warnings-and-Assertions.html" title="Message Output and Debugging Functions"><link rel="refentry" href="glib-Message-Logging.html" title="Message Logging"><link rel="chapter" href="glib-utilities.html" title="GLib Utilities"><link rel="refentry" href="glib-String-Utility-Functions.html" title="String Utility Functions"><link rel="refentry" href="glib-Character-Set-Conversion.html" title="Character Set Conversion"><link rel="refentry" href="glib-Unicode-Manipulation.html" title="Unicode Manipulation"><link rel="refentry" href="glib-I18N.html" title="Internationalization"><link rel="refentry" href="glib-Date-and-Time-Functions.html" title="Date and Time Functions"><link rel="refentry" href="glib-Random-Numbers.html" title="Random Numbers"><link rel="refentry" href="glib-Hook-Functions.html" title="Hook Functions"><link rel="refentry" href="glib-Miscellaneous-Utility-Functions.html" title="Miscellaneous Utility Functions"><link rel="refentry" href="glib-Lexical-Scanner.html" title="Lexical Scanner"><link rel="refentry" href="glib-Automatic-String-Completion.html" title="Automatic String Completion"><link rel="refentry" href="glib-Timers.html" title="Timers"><link rel="refentry" href="glib-Spawning-Processes.html" title="Spawning Processes"><link rel="refentry" href="glib-File-Utilities.html" title="File Utilities"><link rel="refentry" href="glib-Shell-related-Utilities.html" title="Shell-related Utilities"><link rel="refentry" href="glib-Glob-style-pattern-matching.html" title="Glob-style pattern matching"><link rel="refentry" href="glib-Simple-XML-Subset-Parser.html" title="Simple XML Subset Parser"><link rel="refentry" href="glib-Windows-Compatability-Functions.html" title="Windows Compatibility Functions"><link rel="chapter" href="glib-data-types.html" title="GLib Data Types"><link rel="refentry" href="glib-Memory-Chunks.html" title="Memory Chunks"><link rel="refentry" href="glib-Doubly-Linked-Lists.html" title="Doubly-Linked Lists"><link rel="refentry" href="glib-Singly-Linked-Lists.html" title="Singly-Linked Lists"><link rel="refentry" href="glib-Double-ended-Queues.html" title="Double-ended Queues"><link rel="refentry" href="glib-Trash-Stacks.html" title="Trash Stacks"><link rel="refentry" href="glib-Hash-Tables.html" title="Hash Tables"><link rel="refentry" href="glib-Strings.html" title="Strings"><link rel="refentry" href="glib-String-Chunks.html" title="String Chunks"><link rel="refentry" href="glib-Arrays.html" title="Arrays"><link rel="refentry" href="glib-Pointer-Arrays.html" title="Pointer Arrays"><link rel="refentry" href="glib-Byte-Arrays.html" title="Byte Arrays"><link rel="refentry" href="glib-Balanced-Binary-Trees.html" title="Balanced Binary Trees"><link rel="refentry" href="glib-N-ary-Trees.html" title="N-ary Trees"><link rel="refentry" href="glib-Quarks.html" title="Quarks"><link rel="refentry" href="glib-Keyed-Data-Lists.html" title="Keyed Data Lists"><link rel="refentry" href="glib-Datasets.html" title="Datasets"><link rel="refentry" href="glib-Relations-and-Tuples.html" title="Relations and Tuples"><link rel="refentry" href="glib-Caches.html" title="Caches"><link rel="refentry" href="glib-Memory-Allocators.html" title="Memory Allocators"><link rel="chapter" href="tools.html" title="GLib Tools"><link rel="refentry" href="glib-gettextize.html" title="glib-gettextize"><link rel="index" href="ix01.html" title="Index"><link rel="section" href="glib-cross-compiling.html#cross" title="Building the Library for a different architecture"><link rel="section" href="glib-cross-compiling.html#cache-file-variables" title="Cache file variables"><meta name="generator" content="GTK-Doc V1.2 (XML mode)"><link rel="stylesheet" href="style.css" type="text/css"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="glib-building.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-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-cross-compiling"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2><span class="refentrytitle">Cross-compiling the GLib package</span></h2><p>Cross-compiling the GLib Package &#8212; 
How to cross-compile GLib
</p></div><div class="refsect1" lang="en"><a name="cross"></a><h2>Building the Library for a different architecture</h2><p>
        Cross-compilation is the process of compiling a program or
        library on a different architecture or operating system then
        it will be run upon. GLib is slightly more difficult to 
        cross-compile than many packages because much of GLib is
        about hiding differences between different systems. 
      </p><p>
        These notes cover things specific to cross-compiling GLib;
        for general information about cross-compilation, see the
        <span class="application">autoconf</span> info pages.
      </p><p>
        GLib tries to detect as much information as possible about
        the target system by compiling and linking programs without
        actually running anything; however, some information GLib
        needs is not available this way. This information needs
        to be provided to the configure script via a "cache file"
        or by setting the cache variables in your environment.
      </p><p>
        As an example of using a cache file, to cross compile for
        the "MingW32" Win32 runtine environment on a Linux system,
        create a file 'win32.cache' with the following contents:
      </p><pre class="programlisting"> 
glib_cv_long_long_format=ll
glib_cv_stack_grows=no
      </pre><p>
        Then execute the following commands:
      </p><pre class="programlisting">
PATH=/path/to/mingw32-compiler/bin:$PATH
chmod a-w win32.cache   # prevent configure from changing it
./configure --cache-file=win32.cache --host=mingw32
      </pre><p>
        The complete list of cache file variables follows. Most
         of these won't need to be set in most cases.
      </p></div><div class="refsect1" lang="en"><a name="cache-file-variables"></a><h2>Cache file variables</h2><p><b>glib_cv_long_long_format=[ll/q/I64]. </b>
           Format used by <tt class="function">printf()</tt> and 
           <tt class="function">scanf()</tt> for 64 bit integers. "ll" is 
           the C99 standard, and what is used by the 'trio' library
           that GLib builds if your <tt class="function">printf()</tt> is 
           insufficiently capable.
           Doesn't need to be set if you are compiling using trio.
        </p><p><b>glib_cv_stack_grows=[yes/no]. </b>
           Whether the stack grows up or down. Most places will want "no",
           A few architectures, such as PA-RISC need "yes".
        </p><p><b>glib_cv_working_bcopy=[yes/no]. </b>
           Whether your <tt class="function">bcopy()</tt> can handle overlapping 
           copies. Only needs to be set if you don't have 
           <tt class="function">memmove()</tt>. (Very unlikely)
	</p><p><b>glib_cv_sane_realloc=[yes/np]. </b>  
            Whether your <tt class="function">realloc()</tt> conforms to ANSI C 
            and can handle <tt class="literal">NULL</tt> as the first argument. 
            Defaults to "yes" and probably doesn't need to be set.
	</p><p><b>glib_cv_have_strlcpy=[yes/no]. </b>
            Whether you have <tt class="function">strlcpy()</tt> that matches 
            OpenBSD. Defaults to "no", which is safe, since GLib uses a 
            built-in version in that case.
	</p><p><b>glib_cv_va_val_copy=[yes/no]. </b>
            Whether <span class="type">va_list</span> can be copied as a pointer. If set 
            to "no", then <tt class="function">memcopy()</tt> will be used. Only 
            matters if you don't have <tt class="function">va_copy()</tt> or 
            <tt class="function">__va_copy()</tt>. (So, doesn't matter for GCC.) 
            Defaults to "yes" which is slightly more common than "no".
	</p><p><b>glib_cv_rtldglobal_broken=[yes/no]. </b>
            Whether you have a bug found in OSF/1 v5.0. Defaults to "no".
         </p><p><b>glib_cv_uscore=[yes/no]. </b>
            Whether an underscore needs to be prepended to symbols when
            looking them up via <tt class="function">dlsym()</tt>. Only needs to 
            be set if your system uses
	    <tt class="function">dlopen()</tt>/<tt class="function">dlsym()</tt>.
	 </p><p><b>ac_cv_func_posix_getpwuid_r=[yes/no]. </b>
            Whether you have a getpwuid_r function (in your C library,
	    not your thread library) that conforms to the POSIX spec.
            (Takes a 'struct passwd **' as the final argument)
         </p><p><b>ac_cv_func_nonposix_getpwuid_r=[yes/no]. </b>
            Whether you have some variant of <tt class="function">getpwuid_r()</tt>
            that doesn't conform to to the POSIX spec, but GLib might be able
            to use (or might segfault.) Only needs to be set if 
	    <tt class="literal">ac_cv_func_posix_getpwuid_r</tt> is not set. It's 
            safest to set this to "no".
         </p><p><b>glib_cv_use_pid_surrogate=[yes/no]. </b>
            Whether to use a <tt class="function">setpriority()</tt> on the PID of 
            the thread as a method for setting the priority of threads. This 
            only needs to be set when using POSIX threads.
         </p><p><b>ac_cv_func_printf_unix98=[yes/no]. </b>
           Whether your <tt class="function">printf()</tt> family supports Unix98 
           style <tt class="literal">%N$</tt> positional parameters. Defaults to
	"no".
         </p><p><b>ac_cv_func_vsnprintf_c99=[yes/no]. </b>
            Whether you have a <tt class="function">vsnprintf()</tt> with C99 
            semantics. (C99 semantics means returning the number of bytes 
            that would have been written had the output buffer had enough 
            space.) Defaults to "no".
         </p></div></div><table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"><td align="left"><a accesskey="p" href="glib-building.html"><b>&lt;&lt; Compiling the GLib package</b></a></td><td align="right"><a accesskey="n" href="glib-compiling.html"><b>Compiling GLib Applications &gt;&gt;</b></a></td></tr></table></body></html>