Quoting David C. Jedynak:
> I am trying to compile an app static after getting it to run
> successfully dynamic. I am getting the "no system found" error, as
> noted in other posts.
That's because the "fbdev" (or "sdl") system wasn't linked into the executable.
> I have tried using the "directfb-config" program as well as portions of
> the "dfb_static_build_example" to constuct the makefile.
>
> First of all, I am bewildered as to the usage of "-u" to the linker -
> why are we "undefining" these symbols?
The module system of DirectFB uses so called "constructor" functions.
Each module has one constructor that is called before main() gets entered
in case of a static binary. Dynamic linking causes the constructor to be
called during dlopen(). The declaration looks like this:
#define DFB_CORE_SYSTEM(shortname) \
__attribute__((constructor)) void directfb_##shortname(); \
\
void \
directfb_##shortname() \
{ \
direct_modules_register( &dfb_core_systems, \
DFB_CORE_SYSTEM_ABI_VERSION, \
#shortname, &system_funcs ); \
}
The problem with static linking is that it strips out any unreferenced symbols.
Though the constructor functions are not referenced, they are required to stay
in the executable. Therefore we have to "mark" these functions using "-u".
> Also, are there any known issues with uclibc?
The uclibc is required to support "constructor" functions which are put into
the ".ctors" section. I don't know exactly how and by whom they get called.
> BTW, The app is single application core, so fusion should not be needed
> at all, correct?
Yes.
> Based on other user experience, how small could this app get built
> static (not glibc) my main program .o is only 56KB.
It heavily depends on the image providers and fonts you are using,
because libz, libpng, libjpeg and libfreetype are quite big.
Without any other libraries, but with one graphics driver and two or
three input drivers, you should get an executable around 200k-300k.
> LIBDIRECTFB=-L/usr/local/arm-linux-uclibc/lib -Wl,-udirectfb -ldirectfb
>
> DIRECTFBSYS=-L/usr/local/arm-linux-uclibc/lib/directfb-0.9.20/systems
> -Wl,-udirectfb_fbdev
You are missing -ldirectfb_fbdev here.
Recent CVS versions also require:
-L/usr/local/arm-linux-uclibc/lib/directfb-0.9.20/wm
-Wl,-udirectfbwm_default -ldirectfbwm_default
> DIRECTFBGFX=-L/usr/local/arm-linux-uclibc/lib/directfb-0.9.20/gfxdrivers
> -ldirectfb_epson -Wl,-udirectfb_epson
> DIRECTFBFT2=-L/usr/local/arm-linux-uclibc/lib/directfb-0.9.20/interfaces
> /IDirectFBFont -lidirectfbfont_ft2 -Wl,-uIDirectFBFont_FT2 -lfreetype
> DIRECTFBIMG=-L/usr/local/arm-linux-uclibc/lib/directfb-0.9.20/interfaces
> /IDirectFBImageProvider -lidirectfbimageprovider_jpeg
> -Wl,-uIDirectFBImageProvider_JPEG -ljpeg -lidirectfbimageprovider_png
> -Wl,-uIDirectFBImageProvider_PNG -lpng -lz -lm
>
> DIRECTFBLIB=-L/usr/local/arm-linux-uclibc/lib -ldirectfb -lpthread
>
>
> DFB = $(DFBCONF) --graphics=epson --font=ft2 --imageprovider=jpeg,png
You won't need this line if you specify everything yourself like above.
Also, this call is missing the "--libs" argument that includes the wm
and system module IIRC.
--
Best regards,
Denis Oliver Kropp
.------------------------------------------.
| DirectFB - Hardware accelerated graphics |
| http://www.directfb.org/ |
"------------------------------------------"
Convergence GmbH