[Buildroot] Problems building SDL, SDL_image, SDL_ttf, SDL_gfx via buildroot-2013.11

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Thu Jan 9 08:25:17 UTC 2014


Hello Peter,

Le Wed, 8 Jan 2014 20:38:10 -0700,
Peter Thompson <peter.macleod.thompson at gmail.com> a écrit :

> I used the following before cross-compiling my application.   I do have SDL
> on my host so for pkg-config to work, the felabs path has to appear first
> in the path list
> export CROSS_COMPILE=arm-linux-

Unneeded.

> export ARCH=arm

Unneeded.

> export PATH=/usr/local/xtools/arm-unknown-linux-uclibcgnueabi/bin:$PATH

Unneeded, and potentially harmful, as if the order of things in the
PATH is not correct, or the toolchain prefix you use is not correct,
you might end up using directly the external toolchain, instead of
using the toolchain wrappers that Buildroot creates in
output/host/usr/bin.

> export
> PATH=/home/peter/Documents/felabs/sysdev/buildsdl/buildroot-2013.11/output/host/usr/bin:$PATH

This is the only thing that is needed.

> the combo of SDL + SDL_image + SDL_ttf + SDL_gfx using
> arm-linux-g++  -o oz         \
>     /home/peter/Documents/oz3/display/main.cpp    \
>         ....(list of about 10 files)
>     /home/peter/Documents/oz4/keyboard/ttfopen.c        \
>     -lSDL -lSDL_image -lSDL_gfx -lSDL_ttf                   \
>     $(pkg-config --libs --cflags sdl SDL_image SDL_gfx      \
>            SDL_ttf)
> 
> doesn't seem to work.
> 
> The dynamic .so cross-compiles ok

.so ? The command you show above certainly does *not* build a .so. It
builds an application, dynamically linked against the various SD
libraries.

Also, your command is kind of wrong: there is no need to pass -l<foo>
if you're also using pkg-config to get the necessary compiler and
linker flags.

> but has a seg fault part way through when
> running on IGEPv2.   The source is complex so I haven't figured out the
> point of error but I suspect a .so error.   I am preparing a simpler
> version for testing to track it down.

Isn't that a bug in your application? Please do:

	ulimit -c unlimited

on the target, before running your application. It will generate a core
file. Then use it with gdb to get a backtrace of when the segfault
occurred.

If you want us to help on this, then yes please provide a simple test
case that exhibits the problem.

> The static won't cross-compile because for some reason SDL_image.a is
> missing from
> /home/peter/Documents/felabs/sysdev/buildsdl/buildroot-2013.11/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib

Humm, that's a bug. For some reason, our sdl_image package passes
--disable-static. It has had this option passed since the sdl_image
package was introduced in 2008, for an unknown reason. It would worth
removing this --disable-static option and see if it causes a problem or
not (it should not). This would get you SDL_image.a.

> I tried copying SDL_image.a from a different library I had cross-compiled
> from-scratch but that didn't seem to help.

This is potentially dangerous: are you sure you've built this
SDL_image.a manually with the same toolchain? Same floating-point
strategy?

Just removing --disable-static from package/sdl_image/sdl_image.mk
seems like a better idea.

Best regards,

Thomas

-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


More information about the buildroot mailing list