|
|
#1 |
|
Member Retired
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 38
Karma: 134098
Join Date: Aug 2012
Device: kindle touch
|
here's how to compile a gtk native app for the kindle touch
install the package gcc-4.6-arm-linux-gnueabi this *should* install everything else that you need as well. You also need to install libgtk2.0-dev we'll be using this as a convienience for the headers, don't worry that you have somehow have gtk PC headers and you surely need gtk ARM headers regardless of platform they're all the same thing and in any case we'll be using an ARM compiler with them.... ( so let's not hear any more on the subject - you know who you are )make a place were we can set stuff up Code:
mkdir kindle-dev cd kindle-dev Code:
ssh root@kindle cd /usr tar -cpvzf /mnt/us/libs.tar.gz lib exit Code:
scp root@<your kindles ip address>:/mnt/us/libs.tar.gz . ssh root@<your kindles ip address> rm /mnt/us/libs.tar.gz tar zxvf libs.tar.gz alas some are NOT linked relative.... Code:
cd lib rm libglib-2.0.so rm libglib-2.0.so.0 ln -s libglib-2.0.so.0.2918.0 libglib-2.0.so ln -s libglib-2.0.so.0.2918.0 libglib-2.0.so.0 rm libgio-2.0.so rm libgio-2.0.so.0 ln -s libgio-2.0.so.0.2918.0 libgio-2.0.so ln -s libgio-2.0.so.0.2918.0 libgio-2.0.so.0 rm libgobject-2.0.so rm libgobject-2.0.so.0 ln -s libgobject-2.0.so.0.2918.0 libgobject-2.0.so ln -s libgobject-2.0.so.0.2918.0 libgobject-2.0.so.0 rm libffi.so rm libffi.so.5 ln -s libffi.so.5.0.10 libffi.so ln -s libffi.so.5.0.10 libffi.so.5 rm libgmodule-2.0.so rm libgmodule-2.0.so.0 ln -s libgmodule-2.0.so.0.2918.0 libgmodule-2.0.so ln -s libgmodule-2.0.so.0.2918.0 libgmodule-2.0.so.0 rm libgthread-2.0.so rm libgthread-2.0.so.0 ln -s libgthread-2.0.so.0.2918.0 libgthread-2.0.so ln -s libgthread-2.0.so.0.2918.0 libgthread-2.0.so.0 cd .. We're going to use this simple example to prove everything works, so plagiarise and paste errrm I mean copy and paste this into a file called test.c and save it to our work directory Code:
#include <gtk/gtk.h>
static void hello( GtkWidget *widget,gpointer data ) {
gtk_main_quit ();
}
static gboolean delete_event( GtkWidget *widget, GdkEvent *event, gpointer data ) {
g_print ("delete event occurred\n");
return FALSE; // we do want to quit
}
static void destroy( GtkWidget *widget, gpointer data ) {
gtk_main_quit ();
}
int main( int argc, char *argv[] ) {
GtkWidget *window;
GtkWidget *button;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (window, "delete-event", G_CALLBACK (delete_event), NULL);
g_signal_connect (window, "destroy", G_CALLBACK (destroy), NULL);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
button = gtk_button_new_with_label ("Hello World");
g_signal_connect (button, "clicked", G_CALLBACK (hello), NULL);
gtk_container_add (GTK_CONTAINER (window), button);
gtk_window_set_title ( GTK_WINDOW(window) , "L:A_N:application_ID:test");
gtk_widget_show_all (window);
gtk_main ();
return 0;
}
Code:
gcc test.c -o test `pkg-config gtk+-2.0 --cflags --libs` )one thing to note is that unlike most "normal" apps this one has been given a wierd title Code:
gtk_window_set_title ( GTK_WINDOW(window) , "L:A_N:application_ID:test"); So now to actually (finally!) compile a kindle executable :-o take a deep breath its a commmand and a half.... ![]() Code:
arm-linux-gnueabi-gcc-4.6 test.c -o test `pkg-config gtk+-2.0 --cflags` -L/usr/arm-linux-gnueabi/lib/ -L./lib/ -lgtk-x11-2.0 -lgdk-x11-2.0 -lXrender -lXinerama -lXext -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lXdamage -lXfixes -latk-1.0 -lcairo -lpixman-1 -lpng12 -lxcb-shm -lxcb-render -lX11 -lxcb -lXau -lXdmcp -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lfontconfig -lfreetype -lz -lexpat -lgobject-2.0 -lffi -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 Code:
LIBS = -lgtk-x11-2.0 -lgdk-x11-2.0 ... etc! bogus: bogus.c arm-linux-gnueabi-gcc-4.6 $(LIBS) .... Code:
scp test root@<your kindles ip address>:/mnt/us/ ssh root@<your kindles ip address> /mnt/us/test Amazon have played fast and loose with gtk in away I'm not too sure I'm terribly impressed with.... Taking it further - well ya on ya own ![]() I will not answer general questions about gcc not gtk programming, I will however gladly answer specifics to do with this method of creating a kindle native application.... Enjoy! |
|
|
|
|
|
#2 |
|
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Týr
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,143
Karma: 5328985
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI|K4|K3-3G|DXG|Ematic E6+E8|Rooted Nook Touch|NO K2!!
|
*patter of applause*
__________________
Audiophile and electron bully. My tunes (for free) soundcloud.com/twobob. DONATE TO KUAL BY CLICKING THIS SIMPLE LINK Kung-Fu. Hard work over time to accomplish skill. A painter can have kung-fu... The musician can have kung-fu, or the poet who paints pictures with words and makes emperors weep. This, too, is kung-fu. Formless, nameless, the true master dwells within. Only you can free him. The album I'm headlining on at the moment: s.beatport.com/OCp9dT - FREE: 2012 Award winning set Last edited by twobob; 12-20-2012 at 10:06 PM. |
|
|
|
|
Enthusiast
|
|
|
|
#3 |
|
Embedded Cheerleader
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,134
Karma: 3854695
Join Date: Feb 2012
Device: Intel 4004
|
ldconfig is usually used to update the **system** cache and library sym-links . . .
But it can also be used to create the proper sym-links of a manually specified directory. In this thread, it could be used in place of that long list of manually entered "ln -s ..." commands. Details in the ldconfig manual page. O.T: No number of simlies substitutes for public courtesy, even when you disagree with someone.
__________________
"Hack is just a four letter word." - - With apologies to B. Dylan Last edited by knc1; 08-29-2012 at 11:35 AM. |
|
|
|
|
|
#4 | |
|
Member Retired
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 38
Karma: 134098
Join Date: Aug 2012
Device: kindle touch
|
Quote:
I'd be interested in how you'd use ldconfig like this, would bad sym links need removing manually first? |
|
|
|
|
|
|
#5 |
|
Embedded Cheerleader
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,134
Karma: 3854695
Join Date: Feb 2012
Device: Intel 4004
|
No delete required, it will correct the soname conventions.
man ldconfig should give the details. Hmm... -v verbose (sounds nice) -n only process directories on the command line -N don't rebuild the cache -f conf use conf instead of /etc/ld.so.conf -r root change to and use root as the root directory All sound like likely members of a command to manually fix those links. There may be more info in the man page. Be sure to always use "-N" so you don't trash your system cache.
__________________
"Hack is just a four letter word." - - With apologies to B. Dylan |
|
|
|
|
|
#6 |
|
Member Retired
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 38
Karma: 134098
Join Date: Aug 2012
Device: kindle touch
|
I'd already read the man page before posting the tutorial - I was however unable to get it to work as I wanted - how would you do it?
|
|
|
|
|
|
#7 |
|
Embedded Cheerleader
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,134
Karma: 3854695
Join Date: Feb 2012
Device: Intel 4004
|
What did you do?
What where the results? Please be specific, we can't see the command(s) you are typing.
__________________
"Hack is just a four letter word." - - With apologies to B. Dylan |
|
|
|
|
|
#8 |
|
Junior Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6
Karma: 4348
Join Date: Jul 2012
Device: K4NT
|
ldconfig will create symlink only to soname attribute used in linker
if we have g++ -Wl,-soname,libmylib.so.2 -shared -o output/libmylib.so.2.0.1 -fPIC main.o ldconfig -N /some/place/lib will create libmylib.so.2 -> libmylib.so.2.0.1 libmylib.so will not be created automatically libmylib.so is not needed to run application it is needed only for linker P.S. Sorry for my english |
|
|
|
|
|
#9 |
|
Embedded Cheerleader
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,134
Karma: 3854695
Join Date: Feb 2012
Device: Intel 4004
|
That is correct.
-lmylib ==> libmylib.so for the linkage step of compiling. The Kindle system images have these "development" links removed from the shipped image. The O.P. was originally renaming the most specific name (actual file) to the development name.
__________________
"Hack is just a four letter word." - - With apologies to B. Dylan |
|
|
|
|
|
#10 | |
|
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Týr
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,143
Karma: 5328985
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI|K4|K3-3G|DXG|Ematic E6+E8|Rooted Nook Touch|NO K2!!
|
Step 1) me@dev ~/k3-dev $ CFLAGS="-U_FORTIFY_SOURCE -fno-stack-protector -O2 -fno-finite-math-only -ffast-math -march=armv6j -mtune=arm1136jf-s -mfpu=vfp -pipe -fomit-frame-pointer -fPIC" /opt/arm-2007q3/bin/arm-none-linux-gnueabi-gcc test.c -o test `~/GIT/buildroot-2012.03/output/host/usr/bin/pkg-config gtk+-2.0 --cflags` -L~/GIT/buildroot/output/host/usr/arm-unknown-linux-gnueabi/sysroot/lib/ -L./lib/ -lgtk-directfb-2.0 -lgdk-directfb-2.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lpixman-1 -lpng12 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lfontconfig -lfreetype -lz -lexpat -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -ljpeg -ldirectfb-1.2 -lfusion -ldirect-1.2
That works for a 3. will make okay 2007q3 TC, using "loaned" headers from another TC for those parts that 2007 can not build. Step 2) prep directfb [root@kindle bin]# cat > /tmp/root/.directfbrc no-vt linux-input-devices=/dev/input/event0,/dev/input/event1 Step 3) run it Quote:
for quick redraw testing. assumedly this could be shoved into a relevant repaint event. but a worker.
__________________
Audiophile and electron bully. My tunes (for free) soundcloud.com/twobob. DONATE TO KUAL BY CLICKING THIS SIMPLE LINK Kung-Fu. Hard work over time to accomplish skill. A painter can have kung-fu... The musician can have kung-fu, or the poet who paints pictures with words and makes emperors weep. This, too, is kung-fu. Formless, nameless, the true master dwells within. Only you can free him. The album I'm headlining on at the moment: s.beatport.com/OCp9dT - FREE: 2012 Award winning set Last edited by twobob; 12-21-2012 at 12:22 PM. |
|
|
|
|
![]() |
| Tags |
| k5 tools |
| Thread Tools | Search this Thread |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Kindle VNC viewer (native app, GPLv2) | hawhill | Kindle Developer's Corner | 395 | 04-26-2013 06:05 PM |
| What different between HTML5 APP(build by phonegap) & Native APP | sevenxtars | Android Developer's Corner | 1 | 06-29-2012 02:03 AM |
| Tablet Questions about NT's native reader app | bfollowell | Nook Color & Nook Tablet | 0 | 02-06-2012 02:18 PM |
| iLiad Compile GTK application on Iliad. Help | vschmidt | iRex Developer's Corner | 9 | 11-25-2008 01:49 AM |
| Compile application gtk+ with liberdm | Kiba | iRex | 1 | 07-05-2008 10:30 AM |