HEX
Server: nginx/1.16.1
System: Linux ecs-04358622 4.19.90-2107.6.0.0100.oe1.bclinux.x86_64 #1 SMP Wed Dec 1 19:59:44 CST 2021 x86_64
User: nginx (994)
PHP: 8.0.0
Disabled: NONE
Upload Files
File: //usr/share/gtk-doc/html/glib/glib-cross-compiling.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Cross-compiling the GLib package: GLib Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
<link rel="home" href="index.html" title="GLib Reference Manual">
<link rel="up" href="glib.html" title="GLib Overview">
<link rel="prev" href="glib-building.html" title="Compiling the GLib package">
<link rel="next" href="glib-programming.html" title="Writing GLib Applications">
<meta name="generator" content="GTK-Doc V1.33.1 (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" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts"></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="glib.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="glib-building.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="glib-programming.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="glib-cross-compiling"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle">Cross-compiling the GLib package</span></h2>
<p>Cross-compiling the GLib Package — 
How to cross-compile GLib
</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<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
        <a class="ulink" href="http://mesonbuild.com/Cross-compilation.html" target="_top">meson</a>
        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 meson via a ‘cross file’.
      </p>
<p>
        As an example of using a cross file, to cross compile for
        the ‘MingW32’ Win64 runtime environment on a Linux system,
        create a file <code class="filename">cross_file.txt</code> with the following
        contents:
      </p>
<pre class="programlisting"> 
[host_machine]
system = 'windows'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'

[properties]
c_args = []
c_link_args = []

[binaries]
c = 'x86_64-w64-mingw32-gcc'
cpp = 'x86_64-w64-mingw32-g++'
ar = 'x86_64-w64-mingw32-ar'
ld = 'x86_64-w64-mingw32-ld'
objcopy = 'x86_64-w64-mingw32-objcopy'
strip = 'x86_64-w64-mingw32-strip'
pkgconfig = 'x86_64-w64-mingw32-pkg-config'
windres = 'x86_64-w64-mingw32-windres'
      </pre>
<p>
        Then execute the following commands:
      </p>
<pre class="programlisting">
meson --cross-file cross_file.txt builddir
      </pre>
<p>
        The complete list of cross properties follows. Most
         of these won't need to be set in most cases.
      </p>
</div>
<div class="refsect1">
<a name="cross-properties"></a><h2>Cross properties</h2>
<p><b>have_[function]. </b>
           When meson checks if a function is supported, the test can be
           overridden by setting the
           <code class="literal">have_<em class="replaceable"><code>function</code></em></code> property
           to <code class="constant">true</code> or <code class="constant">false</code>.
           For example </p>
<pre class="programlisting">Checking for function "fsync" : YES</pre>
<p>
           can be overridden by setting </p>
<pre class="programlisting">have_fsync = false</pre>
<p>
        </p>
<p><b>growing_stack=[true/false]. </b>
           Whether the stack grows up or down. Most places will want
           <code class="constant">false</code>.
           A few architectures, such as PA-RISC need <code class="constant">true</code>.
        </p>
<p><b>have_strlcpy=[true/false]. </b>
            Whether you have <code class="function">strlcpy()</code> that matches 
            OpenBSD. Defaults to <code class="constant">false</code>, which is safe,
            since GLib uses a built-in version in that case.
	</p>
<p><b>va_val_copy=[true/false]. </b>
            Whether <span class="type">va_list</span> can be copied as a pointer. If set 
            to <code class="constant">false</code>, then <code class="function">memcopy()</code>
            will be used. Only matters if you don't have
            <code class="function">va_copy()</code> or <code class="function">__va_copy()</code>.
            (So, doesn't matter for GCC.)
            Defaults to <code class="constant">true</code> which is slightly more common
            than <code class="constant">false</code>.
        </p>
<p><b>have_c99_vsnprintf=[true/false]. </b>
            Whether you have a <code class="function">vsnprintf()</code> 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 <code class="constant">false</code>.
         </p>
<p><b>have_c99_snprintf=[true/false]. </b>
            Whether you have a <code class="function">snprintf()</code> 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 <code class="constant">false</code>.
         </p>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.33.1</div>
</body>
</html>