View Single Post
Old 11-16-2008, 09:57 AM   #1
vschmidt
Junior Member
vschmidt began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Nov 2008
Device: IRex Iliad
Compile GTK application on Iliad. Help

I have bought my Iliad about 1 month ago. I have expereance in programming in some areas and would like to develop some utils for Iliad, that are absent or are not convinient for my opinion (language dictionary by book reading etc).

Thanks this site I did first steps (registration and updating kernel for developer) and can compile and start "text-mode" programms. But I have some problems with gtk applications. Can somebody help me with it?

1. My work platform is Windows. To compile programs under Ubuntu I use VirtualBox.
2. Kernel version in my Iliad is 2.12
3. I have downloaded toolchain (http://developer.irexnet.com/pub/iLi...091648.tar.bz2) and unpack it on Ubuntu in root directory.
4. I made makefile (see under) follow olny my expereance with correct paths.
5. I wrote simple programm test (see under) based on main.c from contentLister. I tried to write it following gtk tutorial, but it didn't work also.
6. I wrote test.sh (see under) based on run.sh from mrxvt
7. Copy test.sh, test in mrxvt directory on MMC card

Results:
Programm is compilable. If I use only text-mode (without GTK), it works very well. But for GTK there are some problems. I start test.sh on my Iliad, light indicator blinks and progress bar shows progress. And so on. It stays at the same state for long long time without any result.

Sorry for my english. I didn't have a great practice in it. Answers in german and russian are also possible to receive

Code:
# Make option
BASE_DIR1 = /usr/local/arm/oe/arm-linux/include/
BASE_DIR2 = /usr/local/arm/oe/arm-linux/lib
INCLUDE = -I$(BASE_DIR1)/gtk-2.0 -I$(BASE_DIR1)/glib-2.0 -I$(BASE_DIR2)/glib-2.0/include/ -I$(BASE_DIR1)/pango-1.0 -I$(BASE_DIR1)/atk-1.0 -I$(BASE_DIR2)/gtk-2.0/include/ -I$(BASE_DIR1)/libxml2
LIB     = -L$(BASE_DIR2)/ -lgtk-x11-2.0 -lglib-2.0 -lgdk-x11-2.0 -lgdk_pixbuf-2.0 -lX11 -lpangoxft-1.0 -lpangox-1.0 -lpango-1.0 -latk-1.0 -lgobject-2.0 -lgmodule-2.0 -lgcrypt -lXrandr -lXext -lXft -lfreetype -lz -lfontconfig -lXfixes -lXcursor -lXrender -lXau -lpangoft2-1.0 -lgpg-error -lexpat -lm -lpango-1.0 -lgthread-2.0

# Modules
OBJECTS = 2.o
SOURCE_DIR = .
OUTFILE = test

#Compiler option
GCC = /usr/local/arm/oe/bin/arm-linux-gcc

# Make commands
$(OUTFILE) : $(OBJECTS)
	$(GCC) $(LIB) -o $(OUTFILE) $(OBJECTS)

$(OBJECTS): %.o: $(SOURCE_DIR)/%.cpp
	$(GCC) $(INCLUDE) -c $< -o $@
Code:
#include <gtk/gtk.h>
#include <glib.h>

int main(int argc, char *argv[])
{
    GtkWidget *window;

    /* init threads */
    g_thread_init(NULL);
    gdk_threads_init();
    gdk_threads_enter();

    gtk_init(&argc, &argv);

    // create the main, top level, window 
    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title(GTK_WINDOW(window), "Title");
    gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
    gtk_container_set_border_width(GTK_CONTAINER(window), 0);
    gtk_widget_set_size_request(GTK_WIDGET(window), 768, 1024);
    gtk_window_set_modal(GTK_WINDOW(window), TRUE);
    gtk_window_set_resizable(GTK_WINDOW(window), FALSE);

    gtk_main();
    gdk_threads_leave();

    return 0;
}
Code:
export DISPLAY=:0
export scriptdir=`/usr/bin/dirname $0`
cd $scriptdir
./test
vschmidt is offline   Reply With Quote