{"id":4995,"date":"2014-03-30T17:40:37","date_gmt":"2014-03-30T17:40:37","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/directfb-cross-compiled-for-imx-53-crash-on-startup-collection-of-common-programming-errors\/"},"modified":"2014-03-30T17:40:37","modified_gmt":"2014-03-30T17:40:37","slug":"directfb-cross-compiled-for-imx-53-crash-on-startup-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/directfb-cross-compiled-for-imx-53-crash-on-startup-collection-of-common-programming-errors\/","title":{"rendered":"DirectFB cross-compiled for iMX.53 &#8211; crash on startup-Collection of common programming errors"},"content":{"rendered":"<p>Trying to get a working directfb for use in an embedded system based on an i.MX53 processor (which is an ARM Cortex-A8 core) running Linux 2.6.35.3 (as supplied by Freescale).<\/p>\n<p>I have installed a cross compiler on my i686 debian host system. The cross compiler came from the embedian.org archive, and is the gcc-4.3-arm-linux-gnueabi package (<code>arm-linux-gnueabi-gcc (Debian 4.3.2-1.1) 4.3.2<\/code>). This is supplied with glibc 2.7. This is a different version from the version on my target system, which is glibc 2.11, although my reading suggests that they should be compatible.<\/p>\n<p>After much experimentation with the libraries already existing on the system image, I have managed to successfully compile directfb 1.6.2. This was complicated by the fact that I do not have working pkg-config info for the already-installed libraries, but I eventually managed to persuade it to compile using the following configure command line:<\/p>\n<pre><code>TOP=`realpath ..\/..`\nPKG_CONFIG_PATH=${TOP}\/ext\/libpng-1.5.13\/ \\\nLIBPNG_CFLAGS=-I${TOP}\/include \\\nLIBPNG_LDFLAGS=\"-L${TOP}\/libs -lpng15 -lz\" \\\nFREETYPE_CFLAGS=-I${TOP}\/include \\\nFREETYPE_LIBS=\"-L${TOP}\/libs -lfreetype\" \\\nLIBS=\"-lgcc_s -lgcc -ldl -lstdc++ -lz\" \\\nCFLAGS=\"-march=armv7-a\" \\\nCXXFLAGS=\"-march=armv7-a\" \\\n.\/configure CC=arm-linux-gnueabi-gcc CPPFLAGS=-I${TOP}\/include LDFLAGS=-L${TOP}\/lib \\\n   --build=i686-linux --host=arm-linux-gnueabi \\\n   --enable-static --disable-shared \\\n   --disable-freetype --enable-fbdev --disable-x11 \\\n   --with-gfxdrivers=none --with-inputdrivers=none\n<\/code><\/pre>\n<p>This successfully builds, and I can compile and link a sample application based on the simple tutorial application at http:\/\/directfb.org\/docs\/DirectFB_Tutorials\/simple.html &#8212; unfortunately, when run on the target system, the application crashes with SIGSEGV. So too do some of the tools included with directfb, e.g. dfbinfo.<\/p>\n<p>Here is a stack trace of my test application crashing (when run with command line arg &#8220;&#8211;dfb:fbdev=\/dev\/fb0&#8221;):<\/p>\n<pre><code>#0  direct_map_lookup (map=0x0, key=0xdfd70) at map.c:298\n#1  0x000b2d9c in direct_config_set (name=0xdfd70 \"fbdev\",\n    value=0xdfd76 \"\/dev\/fb0\") at conf.c:542\n#2  0x0009edc0 in dfb_config_set (name=0xdfd70 \"fbdev\",\n    value=0xdfd76 \"\/dev\/fb0\") at conf.c:2024\n#3  0x000a2dcc in parse_args (args=0x7ea80d53 \"fbdev=\/dev\/fb0\") at conf.c:297\n#4  0x000a305c in dfb_config_init (argc=0x7ea80968, argv=0x7ea80964)\n    at conf.c:2159\n#5  0x0000cd58 in Display::Display ()\n#6  0x0000ba94 in main ()\n<\/code><\/pre>\n<p>For reference, the only directfb-related code to execute in the application prior to the crash is directly copied from the tutorial code:<\/p>\n<pre><code>Display::Display(int argc, char ** argv)\n{\n   DFBSurfaceDescription dsc;       \n   DFBCHECK (DirectFBInit (&amp;argc, &amp;argv));  \n   \/\/ ... crash occurs during execution of the line above\n}\n<\/code><\/pre>\n<p>This is called directly from my main function, passing the original unmodified argc and argv.<\/p>\n<p>I have installed the directfb libraries on the target system in \/usr\/local\/lib and binaries in \/usr\/local\/bin, and created \/usr\/local\/share\/directfb-1.6.2 (containing cursor.dat and decker.dgiff) as well as \/etc\/fb.modes as suggested in the documentation.<\/p>\n<p>Any suggestions as to what I&#8217;ve done wrong?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Trying to get a working directfb for use in an embedded system based on an i.MX53 processor (which is an ARM Cortex-A8 core) running Linux 2.6.35.3 (as supplied by Freescale). I have installed a cross compiler on my i686 debian host system. The cross compiler came from the embedian.org archive, and is the gcc-4.3-arm-linux-gnueabi package [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4995","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4995","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=4995"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4995\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4995"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4995"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4995"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}