<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="fr">
	<id>https://wikiold.home.tartarefr.eu/index.php?action=history&amp;feed=atom&amp;title=CPP%2FCrossCompilation</id>
	<title>CPP/CrossCompilation - Historique des versions</title>
	<link rel="self" type="application/atom+xml" href="https://wikiold.home.tartarefr.eu/index.php?action=history&amp;feed=atom&amp;title=CPP%2FCrossCompilation"/>
	<link rel="alternate" type="text/html" href="https://wikiold.home.tartarefr.eu/index.php?title=CPP/CrossCompilation&amp;action=history"/>
	<updated>2026-07-07T05:48:46Z</updated>
	<subtitle>Historique des versions pour cette page sur le wiki</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://wikiold.home.tartarefr.eu/index.php?title=CPP/CrossCompilation&amp;diff=3132&amp;oldid=prev</id>
		<title>Didier le 5 janvier 2016 à 09:48</title>
		<link rel="alternate" type="text/html" href="https://wikiold.home.tartarefr.eu/index.php?title=CPP/CrossCompilation&amp;diff=3132&amp;oldid=prev"/>
		<updated>2016-01-05T09:48:02Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;a href=&quot;https://wikiold.home.tartarefr.eu/index.php?title=CPP/CrossCompilation&amp;amp;diff=3132&amp;amp;oldid=3129&quot;&gt;Voir les modifications&lt;/a&gt;</summary>
		<author><name>Didier</name></author>
	</entry>
	<entry>
		<id>https://wikiold.home.tartarefr.eu/index.php?title=CPP/CrossCompilation&amp;diff=3129&amp;oldid=prev</id>
		<title>Didier : Page créée avec « Pour générer un exécutable windows depuis linux, il faut recourir à ce qu’on appelle la cross-compilation: compiler sur un système pour un autre système. On va par... »</title>
		<link rel="alternate" type="text/html" href="https://wikiold.home.tartarefr.eu/index.php?title=CPP/CrossCompilation&amp;diff=3129&amp;oldid=prev"/>
		<updated>2016-01-04T14:31:35Z</updated>

		<summary type="html">&lt;p&gt;Page créée avec « Pour générer un exécutable windows depuis linux, il faut recourir à ce qu’on appelle la cross-compilation: compiler sur un système pour un autre système. On va par... »&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Nouvelle page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Pour générer un exécutable windows depuis linux, il faut recourir à ce qu’on appelle la cross-compilation: compiler sur un système pour un autre système.&lt;br /&gt;
On va partir d’un simple “Hello world”. A ce propos, j’ai découvert une collection d’hello world sur Github.&lt;br /&gt;
&lt;br /&gt;
== Sources ==&lt;br /&gt;
&lt;br /&gt;
Le fichier source en C&lt;br /&gt;
&lt;br /&gt;
{{Admon/file|main.c|&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#include&amp;lt;stdio.h&amp;gt;&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
  printf(&amp;quot;Hello World !\n&amp;quot;);&lt;br /&gt;
  return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Le fichier source en C++&lt;br /&gt;
{{Admon/file|main.cpp|&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
using namespace std;&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
  cout &amp;lt;&amp;lt; &amp;quot;Hello World !&amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
  return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
== Compilation ==&lt;br /&gt;
=== GNU/Linux ===&lt;br /&gt;
&lt;br /&gt;
Pour GNU/Linux, le fichier C serait compilé avec la commande&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
gcc -O0 -Wall -g -o helloc main.c&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
et le fichier C++&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
g++ -O0 -Wall -g -o hellocpp main.cpp&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Wind@uze ===&lt;br /&gt;
&lt;br /&gt;
On va se servir des compilateurs mingw&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
dnf install mingw32-gcc mingw32-gcc-c++ mingw32-binutils mingw64-gcc mingw64-gcc-c++ mingw64-binutils&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Version 32 bits ====&lt;br /&gt;
&lt;br /&gt;
le fichier C sera compilé avec la commande&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
i686-w64-mingw32-gcc -O0 -Wall -g -o helloc32.exe main.c&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
et le fichier C++&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
i686-w64-mingw32-g++ -O0 -Wall -g -o hellocpp32.exe main.cpp&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
En testant le binaire généré à partir du C++ avec wine, on se rend compte qu’il ne fonctionne pas (absence de DLLs).&lt;br /&gt;
&lt;br /&gt;
{{color|red|err:module:import_dll Library libstdc++-6.dll (which is needed by L&amp;quot;V:\\hello32.exe&amp;quot;) not found}}&lt;br /&gt;
&lt;br /&gt;
Pour résoudre ce problème, il va falloir copié quelques DLLs dans le même répertoire que l’exécutable&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cp /usr/i686-w64-mingw32/sys-root/mingw/bin/libstdc++-6.dll .&lt;br /&gt;
cp /usr/i686-w64-mingw32/sys-root/mingw/bin/libgcc_s_sjlj-1.dll .&lt;br /&gt;
cp /usr/i686-w64-mingw32/sys-root/mingw/bin/libwinpthread-1.dll .&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Version 64 bits ====&lt;br /&gt;
&lt;br /&gt;
le fichier C sera compilé avec la commande&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
x86_64-w64-mingw32-gcc -O0 -Wall -g -o helloc64.exe main.c&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
et le fichier C++&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
x86_64-w64-mingw32-g++ -O0 -Wall -g -o hellocpp64.exe main.cpp&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pour résoudre le même problème que la version 32 bits, il va falloir copié quelques DLLs dans le même répertoire que l’exécutable.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libstdc++-6.dll .&lt;br /&gt;
cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libgcc_s_seh-1.dll .&lt;br /&gt;
cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libwinpthread-1.dll .&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Didier</name></author>
	</entry>
</feed>