<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Trying to make static build in linux</title>
		<link>http://www.allegro.cc/forums/view/616652</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Sat, 07 Jan 2017 08:15:57 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hi, I need help to make static build of my program using allegro 4.</p><p>I compile with this command line:</p><p>g++ program.cpp  `allegro-config --libs` -o program</p><p>and have this as my first line in program:</p><p>#define ALLEGRO_STATICLINK</p><p>compiles but not static build, what do I need to do?</p><p>Running linux mint btw.</p><p>Thanks
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Pinbot)</author>
		<pubDate>Thu, 22 Dec 2016 07:19:22 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Try allegro-config --help. There should be a --static option that you pass into your commands to build statically.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Thu, 22 Dec 2016 23:34:32 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thanks Edgar</p><p>So running command line:</p><p>g++ program.cpp `allegro-config --libs --static` -o program</p><p>returns:</p><p>/usr/bin/ld: cannot find -lasound</p><p>I&#39;m thinking static libraries aren&#39;t built?<br />I&#39;m pretty new to linux and was previously using allegro<br />in windows with an IDE so not sure how to build the libraries if <br />thats the problem.<br />Thanks
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Pinbot)</author>
		<pubDate>Fri, 23 Dec 2016 23:15:29 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You need to install the dependencies too. I don&#39;t know what&#39;s required for linux.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Sat, 24 Dec 2016 00:16:04 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Check out <a href="https://wiki.allegro.cc/index.php?title=Install_Allegro5_From_Git/Linux/Debian">this article on the wiki</a> for a list of Linux (Debian variants) dependencies.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Eric Johnson)</author>
		<pubDate>Sat, 24 Dec 2016 01:53:03 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>He&#39;s using Allegro 4.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Sat, 24 Dec 2016 03:34:19 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>My mistake. <img src="http://www.allegro.cc/forums/smileys/embarassed.gif" alt=":-[" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Eric Johnson)</author>
		<pubDate>Sat, 24 Dec 2016 05:22:13 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>For -lasound you need to install libasound2-dev. I&#39;m not really sure what other libraries it needs to compile statically though.</p><p>I&#39;m having a similar problem with the --static option, but with -lXxf86dga missing.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (EliasYFGM)</author>
		<pubDate>Sat, 24 Dec 2016 08:35:48 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Search for libXxf86dga.a in your package manager&#39;s search function.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Sat, 24 Dec 2016 09:25:28 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thanks Edgar, Software manager didn&#39;t find &quot;libXxf86dga.a&quot; but did show<br />libXxf86dga-dev (already installed) and<br />libXxf86dg1 (also installed)<br />libXxf86dg1-dbg (debug package, not installed)</p><p>I reinstalled a allegro 4.4 from the source files. Previous install<br />was from mint package manager. Now it compiles without any messages<br />mentioned earlier but still not producing a static file.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Pinbot)</author>
		<pubDate>Sun, 25 Dec 2016 06:48:56 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Did you compile the static version of allegro? -DSHARED=Off Try passing -static before the allegro-config parameter as well.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Sun, 25 Dec 2016 07:49:44 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I have recompiled the allegro source with  -DSHARED=Off and the<br />static libraries are built liballeg.a etc, but the results are<br />the same.</p><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/616652/1027264#target">Edgar Reynaldo</a> said:</div><div class="quote"><p> Try passing -static before the allegro-config parameter as well. </p></div></div><p>

This will produce a bunch of LibX11 library errors.</p><p>if I try: </p><p>g++ program.cpp -lliballeg `allegro-config --libs --static` -o program</p><p>it returns: /usr/bin/ld: cannot find -liballeg</p><p>liballeg.a is in /usr/bin also copied it to /usr/lib and /usr/local/lib <br />also /usr/local/bin</p><p>and it still can&#39;t find it!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Pinbot)</author>
		<pubDate>Wed, 28 Dec 2016 07:45:18 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It&#39;s  <span class="source-code"><span class="k3">-</span>lalleg</span> not <span class="source-code"><span class="k3">-</span>liballeg</span>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Wed, 28 Dec 2016 07:52:26 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You don&#39;t need -lalleg if you&#39;re using allegro-config.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Wed, 28 Dec 2016 08:03:36 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Also that...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Wed, 28 Dec 2016 08:04:00 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Don&#39;t you need to pass --cflags to allegro-config as well?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Wed, 28 Dec 2016 08:22:39 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thanks guys
</p><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/616652/1027316#target">Thomas Fjellstrom</a> said:</div><div class="quote"><p>It&#39;s -lalleg not -liballeg</p></div></div><p>
You are correct thank you</p><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/616652/1027317#target">Edgar Reynaldo</a> said:</div><div class="quote"><p>You don&#39;t need -lalleg if you&#39;re using allegro-config. </p></div></div><p>
I know, I was linking outside of allegro-config to verify that it could <br />find the library, and now it does using -lalleg</p><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/616652/1027319#target">Edgar Reynaldo</a> said:</div><div class="quote"><p>Don&#39;t you need to pass --cflags to allegro-config as well?</p></div></div><p>
now using --cflags and still no static build.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Pinbot)</author>
		<pubDate>Wed, 28 Dec 2016 21:57:21 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You need to post the transcript of what it says. What do you mean, no static build? No build? Or a build that depends on dynamic libraries? You have to be clear, we can&#39;t read minds, and we can&#39;t help without information.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Thu, 29 Dec 2016 03:22:30 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>The program compiles fine, no messages.<br />Builds the same non static file thats made without the --static option.<br />I&#39;m strictly going by file size, programs file size is 53kb either way.<br />When compiled on windows machine --static built size is 1200kb.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Pinbot)</author>
		<pubDate>Thu, 29 Dec 2016 07:32:52 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Please post the output of `allegro-config --cflags --libs --static` by itself. You may need to use echo.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Fri, 30 Dec 2016 00:51:18 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>echo `allegro-config --cflags --libs --static`</p><p>-I/usr/local/include -L/usr/local/lib -lalleg -lm -lpthread -lrt -lSM -lICE -lX11 -lXext -lXext -lXcursor -lXcursor -lXpm -lXxf86vm -lXxf86dga -lSM -lICE -lX11 -lXext -ldl
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Pinbot)</author>
		<pubDate>Fri, 30 Dec 2016 10:35:23 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Now try using that same command line with &#39;-static&#39; in front of it. You may have to add in &#39;-shared&#39; and &#39;-static&#39; in-between some of the libs to get it to compile. The problem is that gcc dynamic links by default, so if there is a shared library with the same name, it will default to the shared library. When you use the -static flag it tells gcc to only link to static libs, and when you use -shared, it will only link to shared libs.</p><p>Static linking in Linux is always a pain, but you will have to explore and experiment a little bit to get it to work.</p><p>Post errors and or results.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Fri, 30 Dec 2016 11:14:49 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Ok, I tried that method a few dozen times with different variations (all producing lots of errors). I then installed a different linux (linux lite) on new partition,<br />then installed allegro4 from package manager, which worked dynamicly no problem.<br />The --static build would not work but did produce an error at least<br />  /usr/bin/ld: cannot find -lasound<br />  /usr/bin/ld: cannot find -lXxf86dga<br />  collect2: error: ld returned 1 exit status<br />I did have xf86dga-dev installed btw.<br />I then uninstalled allegro and reinstalled via sudo apt-get (not sure if they are the same) but the results were.<br />Then uninstalled that and downloaded and compiled source files and It worked!<br />I now have a 3100kb file vs 53kb. And no errors!<br />I still want to get it working on linux mint though.</p><p>BTW I installed allegro 5 on linux mint just to see if it would work<br />and I was able to make static build.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Pinbot)</author>
		<pubDate>Sun, 01 Jan 2017 08:03:22 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/616652/1027214#target">Pinbot</a> said:</div><div class="quote"><p>
/usr/bin/ld: cannot find -lasound
</p></div></div><p>

Problem here is that it&#39;s trying to statically link every library (not just allegro, but every library that you are passing to the linker). For some you only have the dynamic ones available.</p><p>You can try adding -static (or -Wl,-Bstatic, seems to be the same thing) before allegro and -dynamic before the rest.</p><p>For example:</p><div class="source-code snippet"><div class="inner"><pre><span class="k3">-</span>I<span class="k3">/</span>usr<span class="k3">/</span>local<span class="k3">/</span>include <span class="k3">-</span>L<span class="k3">/</span>usr<span class="k3">/</span>local<span class="k3">/</span>lib <span class="k3">-</span><span class="k1">static</span> <span class="k3">-</span>lalleg <span class="k3">-</span>dynamic <span class="k3">-</span>lm <span class="k3">-</span>lpthread <span class="k3">-</span>lrt <span class="k3">-</span>lSM <span class="k3">-</span>lICE <span class="k3">-</span>lX11 <span class="k3">-</span>lXext <span class="k3">-</span>lXext <span class="k3">-</span>lXcursor <span class="k3">-</span>lXcursor <span class="k3">-</span>lXpm <span class="k3">-</span>lXxf86vm <span class="k3">-</span>lXxf86dga <span class="k3">-</span>lSM <span class="k3">-</span>lICE <span class="k3">-</span>lX11 <span class="k3">-</span>lXext <span class="k3">-</span>ldl
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (amarillion)</author>
		<pubDate>Sun, 01 Jan 2017 17:45:43 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thanks amarillion.</p><p>Just to update, I have now tried building allegro 4<br />on several linux distros here is a summary of whats working<br />as far as static builds...</p><p>Linux Lite: working!<br />Mint Cinnamon: Fail! (shared builds only)<br />Mint Mate: Working!<br />Mint KDE: will build static build but file is 2.3mb(should be 3.1mb) exe not run<br />Zorin: Same results as Mint KDE
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Pinbot)</author>
		<pubDate>Sat, 07 Jan 2017 08:15:57 +0000</pubDate>
	</item>
</rss>
