Graphics programming - Cross-compiling issues

Hi,
I am a little new to the area of cross-compilers. So, I would be
thankful if anyone can help me out with the following problem.

I am trying to create a simple image viewer (coding in C) for use with
the beagle board so that we can use it in one of our experiments with
the Pico projector development kit. I am making use of the
svgalib-1.4.3 for the corresponding coding in C.

I have been using the ARM cross-compiler from Codesourcery for all our
cross-compilation till now. But, this doesn't seem to do the job when
I am making use of the graphics library --- svgalib-1.4.3 in my image
viewer. It looks like the Codesourcery cross-compiler doesn't support
the use of this graphics library and the corresponding header files --
vga.h and vgal.h.

It would be great if any of you could let me know about possible
solutions or probable sources of information to sort out these cross-
compilation issues and enable the cross-compiling of my graphics
program for the beagle board.

Thanks a ton again for all your help and suggestions, guys. This group
is really informative.

Regards
DB

I am not sure if you want to use SVGAlib. I use libSDL for any
graphics programming.
The SDL libraries are included in the Angstrom distribution. They are
easy to use
and can run under X11 or just the console. Also, you don't have to
code in C. PyGame
is also in Angstrom and provides a nice python approach to graphics
programming.
But if you must use the SVGA library make sure your include
directories are correct.
Maybe post the exact command you are using to compile and the errors
given.

Hi Jesse,

Thanks for the suggestions.
I will give the python approach a stab.

Anyways this is the exact command I give to cross-compile the graphics
program using svga libraries on my ubuntu host:
arm-none-linux-gnueabi-gcc sample.c -lvga

And, the errors thrown out is:
/home/vddinesh/Codesourcery/arm-2008q3/bin/../lib/gcc/arm-none-linux-
gnueabi/4.3.2/../../../../arm-none-linux-gnueabi/bin/ld: cannot find -
lvga
collect2: ld returned 1 exit status

Thanks again for your help. It would be helpful if you could help me
out in solving the above issue.

Regards
DB

Hi,

I don't seem to have Pygame in the version of Angstrom I have.
I do have Pycairo and Pygtk which I think should suit our needs.

However, there is another small hitch when using pycairo.
I am able to import pycairo and create a surface for my image, but I
am unable to display the surface on the screen.
I do a cairo.create_from_png to create a surface for the image. It
would be of help if you could let me know on what are the set of
commands to display the surface. I don't see any in the pycairo online
documentation.
Do we need pygame to actually display images on the screen? And if so,
with pygame not already part of my version of Angstrom, is it fine to
just download and import the pygame frameworks onto my SD card housing
the Angstrom image?

Thanks a ton for your help and comments guys.

Regards
DB

Sorry, I'm not familiar with cairo. But if pygame isn't installed try
installing
it with opkg. The beagle board needs to be connected to the internet
and
from it's command line run "opkg list | grep pygame" to see the
exact name of the package it is in and run "opkg install <package

"

to install it. I am fairly certain the command is "opkg install python-
pygame".
Once you get it installed, http://pygame.org/ has great tutorials on
how to use it.

As far as your compiling goes, your problem is that you aren't
providing
the correct library directory. you need to add "-L<Directory
containing library>".
For example, if "/home/user/cross-libs/" contains "libvga.so" then the
command
to compile and link with that library is

arm-none-linux-gnueabi-gcc sample.c -lvga -L/home/user/cross-libs -o
sample

I am pretty sure that should work for you. And try "man gcc" on your
linux machine (assuming you have gcc installed) to see the all you
need to know about the gcc compilers. It won't apply 100% but since
the
cross compiler is based on gcc it should help a lot.

Of course when you run the program on the beagle board, libvga.so
needs to be
in the runtime library search path (usually /usr/lib/)

-Jesse

hi,
    Actually, I also met the similar problem.

    the difference is that I use SDL instead of pygame.

    I am new in bitbake and Angstorm.

    So , I used the tradditional solution. Below is my operation:

    1. Download sdl, directfb source code and other related source
code. cross compile them using arm-none-linux-gnueabi-gcc. It takes me
two days to compile the final libsdl.so and other related *.so.
    2. Cross compile my own program using arm-none-linux-gnueabi-gcc.
    3. Copy my program and libsdl.so and other related *.so to SD
card.
    4. export LD_LIBRARY_PATH= where libsdl.so is , and run my own
program based on SDL, it is successful.

    Now I want to try Angstrom solution. but I have some puzzles.

    Below is what I did :

    1. git clone git://git.openembedded.net/openembedded .
    2. setup environment according wiki
    3. bitbake console-image.

    If I want to use my own program based on SDL on beagle board. How
could I do this?

    1. Let beagle board connected to internet . and opkg list | grep
sdl ;
        and opkg install sdl?
        This step seems to install sdl lib in beagle board?

    2. How to cross compile my program based SDL?
        Should I run "bitbake libsdl" and then arm-none-linux-gnueabi-
gcc myprogram.c -L directory of libsdl.so -l sdl -o myprogram?

        How could I get libsdl.so using Angstrom solution?

    The Last question is how to improve the performance of my program
based on SDL. How to use hardware accelerate.

    Thanks a ton for your help and comments guys. I will be very
appreciated for your help.

Regards.

Alex.yang

You sound like you are on the right track. I'm not 100% on what the
package name is,
but 'opkg install sdl' sounds right. If libSDL.so is in /usr/lib on
the beagle board you are
ready to run.
To use bitbake it seems you can do either
'bitbake libsdl-x11' or 'bitbake libsdl-directfb'
But I think the libsdl-x11 package is the default Angstrom uses, so
it's probably easier to use that.
If you do use the directfb package, you will have to install it
manually by copying over the ipk file
to the beagleboard and doing 'opkg install <packagefilename>.ipk' so
the right libraries are installed.

To compile it should be
arm-angstrom-linux-gnueabi-gcc test.c -I <include dir> -L <library

-lSDL -o test

This works on my machine after running 'bitbake libsdl-x11'

arm-angstrom-linux-gnueabi-gcc test.c -I /home/jesseb/oe/tmp/work/
armv7a-angstrom-linux-gnueabi/libsdl-x11-1.2.11-r7/image/usr/include/
SDL/ -L /home/jesseb/oe/tmp/work/armv7a-angstrom-linux-gnueabi/libsdl-
x11-1.2.11-r7/image/usr/lib/ -lSDL -o test

where test.c is
#include <stdio.h>
#include "SDL.h"
int main(void) {
    SDL_Surface* screen = SDL_SetVideoMode(800, 600, 32,
SDL_SWSURFACE);
}

As far as performance of SDL, thats really up to the video driver SDL
is using.
You may want to read through this http://www.libsdl.org/cgi/docwiki.cgi
But as far as I have seen, if you were thinking about using
SDL_HWSURFACE,
it does not help any, and actually seems to slow down my programs.

It would be great to use the power vr drivers with SDL but the current
version of SDL
does not support OpenGLES which is what the power vr drivers use. SDL
1.3 looks
promising though.

BTW pygame is built on SDL so you would essentially be using the same
libraries,
just from python instead of C.

-Jesse

Thanks for Jesse’s detail instruction!

Section I(compile problem):
I successfully run “bitbake libsdl-x11” and get the image of libsdl

But when I try to compile using "arm-angstrom-linux-gnueabi-gcc test.c -I -L <library

-lSDL -o test"

There are some error .
error info is below:
"
yl@alex:~/test_code/angstorm$ arm-none-linux-gnueabi-gcc -I /home/yl/test_code/angstorm/libsdl-x11-1.2.11-r7/image/usr/include/SDL/ -L /home/yl/test_code/angstorm/libsdl-x11-1.2.11-r7/image/usr/lib/ -l SDL -o test
/home/yl/omap_toolchain/arm-2007q3/bin/…/lib/gcc/arm-none-linux-gnueabi/4.2.1/…/…/…/…/arm-none-linux-gnueabi/bin/ld: warning: libts-1.0.so.0, needed by /home/yl/test_code/angstorm/libsdl-x11-1.2.11-r7/image/usr/lib//libSDL.so, not found (try using -rpath or -rpath-link)
/home/yl/omap_toolchain/arm-2007q3/bin/…/arm-none-linux-gnueabi/libc/usr/lib/crt1.o: In function _start': init.c:(.text+0x30): undefined reference to main’
/home/yl/test_code/angstorm/libsdl-x11-1.2.11-r7/image/usr/lib//libSDL.so: undefined reference to ts_close' /home/yl/test_code/angstorm/libsdl-x11-1.2.11-r7/image/usr/lib//libSDL.so: undefined reference to ts_config’
/home/yl/test_code/angstorm/libsdl-x11-1.2.11-r7/image/usr/lib//libSDL.so: undefined reference to ts_read' /home/yl/test_code/angstorm/libsdl-x11-1.2.11-r7/image/usr/lib//libSDL.so: undefined reference to ts_open’

"

It seems I need to compile libts.

I try to run " bitbake libts" ,it failed.

I think I typed the wrong command.

My question is ,How could I know what kind of command I should type when I want to get special package?

Section II(performance):

In my 2D program, there are a lot of *.png and blit operations.

And I try to run my program on omap3530.

It run very slow just using SDL (version 1.2.13). And the cpu occupancy rate is about 99.*% . If run on my PC, the occupancy is about 30%.( my PC is dual core 2.0G, ram 2GB)

So I have to use the hardware accelerator.

In order to improve performance, I intend to use NEON .

Is there any one could give me some clues about improving performance ?

And is there any introduction about neon instruction?

Thanks for your help again.

Best Regards

Alex.

I think you want "tslib" not "libts"