<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Error building with Raspberry Pi Debug Build</title>
		<link>http://www.allegro.cc/forums/view/616481</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Sat, 17 Sep 2016 22:14:24 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hi,</p><p>Seem to have an issue (RPI with 5.2.0.0) whereby linking with &#39;RelWithDebInfo&#39; Allegro build works fine,<br />but if I build the &#39;Debug&#39; version of Allegro and then try linking with it I get the following error (building<br />in this case ex_acodec - the first example file) -</p><p>Undefined references to `glGetCompressedTexImage&#39; and `glPopClientAttrib&#39;</p><div class="source-code"><div class="toolbar"><span class="button numbers"><b>#</b></span><span class="button select">Select</span><span class="button expand">Expand</span></div><div class="inner"><span class="number"> 1</span><span class="k3">/</span>pi<span class="k3">/</span>dev<span class="k3">/</span>allegro-5.2.0.0<span class="k3">/</span>build_rpid<span class="k3">/</span>examples <span class="k3">&amp;</span><span class="k3">&amp;</span> <span class="k3">/</span>usr<span class="k3">/</span>bin<span class="k3">/</span>cmake <span class="k3">-</span>E cmake_link_script CMakeFiles<span class="k3">/</span>ex_acodec.dir<span class="k3">/</span>link.txt <span class="k3">-</span><span class="k3">-</span>verbose<span class="k3">=</span>no
<span class="number"> 2</span>..<span class="k3">/</span>lib<span class="k3">/</span>liballegro-debug-static.a<span class="k2">(</span>ogl_bitmap.c.o<span class="k2">)</span><span class="k2">:</span> In function `ogl_lock_compressed_region<span class="s">':</span>
<span class="number"> 3</span><span class="s">/pi/dev/allegro-5.2.0.0/src/opengl/ogl_bitmap.c:792: undefined reference to `glGetCompressedTexImage'</span>
<span class="number"> 4</span><span class="k3">/</span>pi<span class="k3">/</span>dev<span class="k3">/</span>allegro-5.2.0.0<span class="k3">/</span>src<span class="k3">/</span>opengl<span class="k3">/</span>ogl_bitmap.c:836: undefined reference to `glPopClientAttrib<span class="s">'</span>
<span class="number"> 5</span><span class="s">collect2: error: ld returned 1 exit status</span>
<span class="number"> 6</span><span class="s">examples/CMakeFiles/ex_acodec.dir/build.make:123: recipe for target '</span>examples<span class="k3">/</span>ex_acodec<span class="s">' failed</span>
</div></div><p>

CMAKE commands used -</p><p>OKAY: cmake .. -DSHARED=off -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-raspberrypi.cmake<br />FAILS: cmake .. -DSHARED=off -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-raspberrypi.cmake -DCMAKE_BUILD_TYPE=Debug</p><p>Any ideas..?</p><p>Guess the debug build includes (or excludes) something that causes this issue..?<br />Specific library..?<br />_____________________________________________________________</p><p>EDIT: <br />Just tried also with 5.2.1.1 release - same issue..  <img src="http://www.allegro.cc/forums/smileys/huh.gif" alt="???" /></p><p>EDIT2: <br />Changing the &#39;link.txt&#39; to use the non-debug version liballegro-static.a (rather than the debug version) means it links. <br />So it&#39;s something (probably unsurprisingly) to do with the makeup of liballegro-debug-static.a ...</p><p>include/allegro5/platform/alplatf.h are identical on each build (ie OPENGL(ES) defines).</p><p>EDIT3:<br />Adding -lGL to the link lines for examples allows them to build..<br />However if I add the same to my (working without debug allegro) build, it crashes with an opengl extensions error (print_extensions) .. <br />So don&#39;t think this is the answer.. All I want is a build with the allegro.log output so I can check whether the bitmaps are accelerated, etc..</p><p>Looks to me that enabling the DEBUG build causes some other compiler switch that means I need these other functions (which I guess aren&#39;t available with GLES?).<br />_____________________________________________________________</p><p>Kev
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Kev Callahan)</author>
		<pubDate>Wed, 14 Sep 2016 14:43:05 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>This is concerning, but if the only thing you want is <span class="source-code">allegro.log</span>, you can turn that on even in the release binary. Just do <span class="source-code"><a href="http://www.allegro.cc/manual/al_set_config_value"><span class="a">al_set_config_value</span></a><span class="k2">(</span><a href="http://www.allegro.cc/manual/al_get_system_config"><span class="a">al_get_system_config</span></a><span class="k2">(</span><span class="k2">)</span>, <span class="s">"trace"</span>, <span class="s">"level"</span>, <span class="s">"debug"</span><span class="k2">)</span><span class="k2">)</span></span> somewhere before <span class="source-code"><a href="http://www.allegro.cc/manual/al_init"><span class="a">al_init</span></a></span> (or maybe just after, I forget).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (SiegeLord)</author>
		<pubDate>Thu, 15 Sep 2016 20:08:03 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Ah that&#39;s useful, thanks SiegeLord, will investigate that.</p><p>Yeah a bit concerning, hoped someone else could at least verify the issue.. It may just be one of my libraries has an issue I suppose, but can&#39;t see why it would manifest like this... </p><p>I&#39;m using a yocto build.., would be good if someone who uses raspbian or whatever could check. </p><p>EDIT:<br />Using nm on /opt/vc/lib/libGLESv2.so (where I was expecting glGetCompressedTexImage to be defined) there appears no mention of it...</p><p>So it looks like enabling Debug is pulling in the OpenGL A5 file ogl_bitmap.c<br />Does the RelWithDebInfo one not ..</p><p>Aarrgghh .. Look..! First one &#39;normal&#39;, second one &#39;debug&#39;</p><div class="source-code"><div class="toolbar"><span class="button numbers"><b>#</b></span><span class="button select">Select</span><span class="button expand">Expand</span></div><div class="inner"><span class="number"> 1</span><span class="k2">[</span>root<span class="k2">]</span> <span class="n">21</span><span class="k2">:</span><span class="n">31</span><span class="k2">:</span><span class="n">45</span> allegro-5.2.0.0 nm .<span class="k3">/</span>build_rpi<span class="k3">/</span>CMakeFiles<span class="k3">/</span>allegro.dir<span class="k3">/</span>src<span class="k3">/</span>opengl<span class="k3">/</span>ogl_bitmap.c.o  <span class="k3">|</span> grep CompressedTex
<span class="number"> 2</span>         U glCompressedTexSubImage2D
<span class="number"> 3</span><span class="k2">[</span>root<span class="k2">]</span> <span class="n">21</span><span class="k2">:</span><span class="n">31</span><span class="k2">:</span><span class="n">56</span> allegro-5.2.0.0 nm .<span class="k3">/</span>build_rpid<span class="k3">/</span>CMakeFiles<span class="k3">/</span>allegro.dir<span class="k3">/</span>src<span class="k3">/</span>opengl<span class="k3">/</span>ogl_bitmap.c.o  <span class="k3">|</span> grep CompressedTex
<span class="number"> 4</span>         U glCompressedTexSubImage2D
<span class="number"> 5</span>         U glGetCompressedTexImage <span class="k3">&lt;</span><span class="k3">-</span><span class="k3">-</span><span class="k3">-</span><span class="k3">!</span>
</div></div><p>

EDIT2:<br />Okay.. Why are these so different between RelWithDebInfo and Debug?</p><pre>
[root] 21:41:45 allegro-5.2.0.0 diff ./build_rpi/CMakeFiles/allegro.dir/flags.make
                                     ./build_rpid/CMakeFiles/allegro.dir/flags.make
5c5
&lt; C_FLAGS = <b>-march=armv6 -mfpu=vfp -mfloat-abi=hard</b> 
            -W -Wall -Wpointer-arith -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes 
            <b>-O2</b> 
            -g -DNDEBUG 
            -I/opt/vc/include 
            -I/opt/vc/include/interface/vcos/pthreads 
            -I/opt/vc/include/interface/vmcs_host/linux 
            -I/vend/allegro-5.2.0.0/include 
            -I/vend/allegro-5.2.0.0/build_rpid/include       
            -DALLEGRO_SRC -DALLEGRO_STATICLINK -DALLEGRO_LIB_BUILD
---
&gt; C_FLAGS =  -W -Wall -Wpointer-arith -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes 
             -g -DDEBUGMODE=1 -DD3D_DEBUG_INFO 
             -I/opt/vc/include 
             -I/opt/vc/include/interface/vcos/pthreads 
             -I/opt/vc/include/interface/vmcs_host/linux 
             -I/vend/allegro-5.2.0.0/include 
             -I/vend/allegro-5.2.0.0/build_rpid/include     
             -DALLEGRO_SRC -DALLEGRO_STATICLINK -DALLEGRO_LIB_BUILD</pre><p>

Starting to look like an issue with the TOOLCHAIN incorrect on the debug build..?<br />I&#39;ll do a complete fresh cmake tomorrow for both and report back - hopefully it&#39;s all just me being an idiot. <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /></p><p>** UPDATE:<br />Rebuilt completely via cmake and the same problem, so it&#39;s (probably) not my setup.<br />diff between the CMakeCache.txt files all look sensible (ie pathnames and CMAKE_BUILD_TYPE as expected).</p><p>The flags.make differences are few now (ie -DNDEBUG as opposed to -DDEBUGMODE=1 -DD3D_DEBUG_INFO) - I guess these are sensible (although don&#39;t know why RPI needs -DD3D_DEBUG_INFO).</p><p>So issue not yet resolved.<br />Any ideas what else is worth looking at anyone..?<br />My reason for this investigation is not so desperate now, but happy to follow it up if it helps A5 development).</p><p><i>
[ Out of interest, the original issue that I was investigating is now not a problem - I was losing major FPS when in portrait mode and it&#39;s not A5, but using &#39;display_rotate=1&#39; in /boot/config.txt kills FPS. Apparently due to the non-GPU way it does it &quot;when the display is portrait, the HVS doesn&#39;t composite on-the-fly. It has to write a landscape buffer to memory. It then has to use the transposer hardware to convert the landscape image to a portrait image, involving another memory read and write. It then finally fetches this portrait image and outputs to the display.&quot; ]
</i>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Kev Callahan)</author>
		<pubDate>Thu, 15 Sep 2016 22:44:18 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Perhaps what&#39;s happening is that <span class="source-code"><span class="k3">-</span>O2</span> removes the unused function call, thus removing the need to link to that function. I filed an issue about it: <a href="https://github.com/liballeg/allegro5/issues/677">https://github.com/liballeg/allegro5/issues/677</a></p><p>What you could do in the short term is to add <span class="source-code"><span class="k3">!</span>defined ALLEGRO_RASPBERRY_PI</span> on line 720, so this function isn&#39;t compiled in.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (SiegeLord)</author>
		<pubDate>Sat, 17 Sep 2016 08:29:18 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>That or when I get the opportunity (more than likely not till end of next week now unfortunately) I&#39;ll maybe add the optimisation flag to the debug build and see what effect that has.. Suppose it&#39;s a possibility...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Kev Callahan)</author>
		<pubDate>Sat, 17 Sep 2016 22:14:24 +0000</pubDate>
	</item>
</rss>
