Discussion:
[directfb-users] DirectFB cross-compiled for iMX.53 - crash on startup
Julian Hall
2012-10-11 01:07:54 UTC
Permalink
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 (|arm-linux-gnueabi-gcc (Debian
4.3.2-1.1) 4.3.2|). 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.

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:

|TOP=`realpath ../..`
PKG_CONFIG_PATH=${TOP}/ext/libpng-1.5.13/ \
LIBPNG_CFLAGS=-I${TOP}/include \
LIBPNG_LDFLAGS="-L${TOP}/libs -lpng15 -lz" \
FREETYPE_CFLAGS=-I${TOP}/include \
FREETYPE_LIBS="-L${TOP}/libs -lfreetype" \
LIBS="-lgcc_s -lgcc -ldl -lstdc++ -lz" \
CFLAGS="-march=armv7-a" \
CXXFLAGS="-march=armv7-a" \
./configure CC=arm-linux-gnueabi-gcc CPPFLAGS=-I${TOP}/include LDFLAGS=-L${TOP}/lib \
--build=i686-linux --host=arm-linux-gnueabi \
--enable-static --disable-shared \
--disable-freetype --enable-fbdev --disable-x11 \
--with-gfxdrivers=none --with-inputdrivers=none
|

This successfully builds, and I can compile and link a sample
application based on the simple tutorial application
athttp://directfb.org/docs/DirectFB_Tutorials/simple.html--
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.

Here is a stack trace of my test application crashing (when run with
command line arg "--dfb:fbdev=/dev/fb0"):

|#0 direct_map_lookup (map=0x0, key=0xdfd70) at map.c:298
#1 0x000b2d9c in direct_config_set (name=0xdfd70 "fbdev",
value=0xdfd76 "/dev/fb0") at conf.c:542
#2 0x0009edc0 in dfb_config_set (name=0xdfd70 "fbdev",
value=0xdfd76 "/dev/fb0") at conf.c:2024
#3 0x000a2dcc in parse_args (args=0x7ea80d53 "fbdev=/dev/fb0") at conf.c:297
#4 0x000a305c in dfb_config_init (argc=0x7ea80968, argv=0x7ea80964)
at conf.c:2159
#5 0x0000cd58 in Display::Display ()
#6 0x0000ba94 in main ()
|

For reference, the only directfb-related code to execute in the
application prior to the crash is directly copied from the tutorial code:

|Display::Display(int argc, char ** argv)
{
DFBSurfaceDescription dsc;
DFBCHECK (DirectFBInit (&argc, &argv));
// ... crash occurs during execution of the line above
}
|

This is called directly from my main function, passing the original
unmodified argc and argv.

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.

Any suggestions what I've done wrong?
Julian Hall
2012-10-15 03:48:29 UTC
Permalink
Post by Julian Hall
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 (|arm-linux-gnueabi-gcc (Debian
4.3.2-1.1) 4.3.2|). 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.
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
|TOP=`realpath ../..`
PKG_CONFIG_PATH=${TOP}/ext/libpng-1.5.13/ \
LIBPNG_CFLAGS=-I${TOP}/include \
LIBPNG_LDFLAGS="-L${TOP}/libs -lpng15 -lz" \
FREETYPE_CFLAGS=-I${TOP}/include \
FREETYPE_LIBS="-L${TOP}/libs -lfreetype" \
LIBS="-lgcc_s -lgcc -ldl -lstdc++ -lz" \
CFLAGS="-march=armv7-a" \
CXXFLAGS="-march=armv7-a" \
./configure CC=arm-linux-gnueabi-gcc CPPFLAGS=-I${TOP}/include
LDFLAGS=-L${TOP}/lib \
--build=i686-linux --host=arm-linux-gnueabi \
--enable-static --disable-shared \
--disable-freetype --enable-fbdev --disable-x11 \
--with-gfxdrivers=none --with-inputdrivers=none
|
This successfully builds, and I can compile and link a sample
application based on the simple tutorial application
athttp://directfb.org/docs/DirectFB_Tutorials/simple.html--
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.
Here is a stack trace of my test application crashing (when run with
|#0 direct_map_lookup (map=0x0, key=0xdfd70) at map.c:298
#1 0x000b2d9c in direct_config_set (name=0xdfd70 "fbdev",
value=0xdfd76 "/dev/fb0") at conf.c:542
#2 0x0009edc0 in dfb_config_set (name=0xdfd70 "fbdev",
value=0xdfd76 "/dev/fb0") at conf.c:2024
#3 0x000a2dcc in parse_args (args=0x7ea80d53 "fbdev=/dev/fb0") at conf.c:297
#4 0x000a305c in dfb_config_init (argc=0x7ea80968, argv=0x7ea80964)
at conf.c:2159
#5 0x0000cd58 in Display::Display ()
#6 0x0000ba94 in main ()
|
For reference, the only directfb-related code to execute in the
|Display::Display(int argc, char ** argv)
{
DFBSurfaceDescription dsc;
DFBCHECK (DirectFBInit (&argc, &argv));
// ... crash occurs during execution of the line above
}
|
This is called directly from my main function, passing the original
unmodified argc and argv.
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.
Any suggestions what I've done wrong?
OK, I managed to solve the problem. For reference of anyone else seeing
this, it is caused by attempting to statically link directfb -- the
initialisation of the config map is performed by code that is run by the
dynamic linker, which doesn't happen if you statically link the
library. I've seen some references to a script that can set up a
working static link, but it no longer appears to be part of the
distribution, so I'm going to assume at this point that the static build
is no longer supported. I switched to dynamic linking and everything
worked flawlessly.

Loading...