![]() |
#1 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 87
Karma: 25608
Join Date: Sep 2022
Device: PW3, PW2, KT2, 2xKT, 2xK3G
|
Having A Pain Trying To Cross-Compile
Howdy,
I've been trying to set up a cross-compiler for my PW3, but I'm having trouble. I went here and grabbed the release for my kindle (kindlepw2.zip) and extracted it to my home folder and added the bin directory to my PATH. By running Code:
arm-kindlepw2-linux-gnueabi-gcc test.c -o test Next, using this command, Code:
arm-kindlepw2-linux-gnueabi-gcc test.c -o test `pkg-config gtk+-2.0 --cflags` -L./x-tools/arm-kindlepw2-linux-gnueabi/arm-kindlepw2-linux-gnueabi/lib -L./x-tools/arm-kindlepw2-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:
#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:
debian@debian11:~$ arm-kindlepw2-linux-gnueabi-gcc test.c -o test `pkg-config gtk+-2.0 --cflags` -L./x-tools/arm-kindlepw2-linux-gnueabi/arm-kindlepw2-linux-gnueabi/lib -L./x-tools/arm-kindlepw2-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 In file included from /usr/lib/x86_64-linux-gnu/glib-2.0/include/glibconfig.h:9, from /usr/include/glib-2.0/glib/gtypes.h:32, from /usr/include/glib-2.0/glib/galloca.h:32, from /usr/include/glib-2.0/glib.h:30, from /usr/include/glib-2.0/gobject/gbinding.h:28, from /usr/include/glib-2.0/glib-object.h:22, from /usr/include/glib-2.0/gio/gioenums.h:28, from /usr/include/glib-2.0/gio/giotypes.h:28, from /usr/include/glib-2.0/gio/gio.h:26, from /usr/include/gtk-2.0/gdk/gdkapplaunchcontext.h:30, from /usr/include/gtk-2.0/gdk/gdk.h:32, from /usr/include/gtk-2.0/gtk/gtk.h:32, from test.c:1: /usr/include/glib-2.0/glib/gtypes.h: In function '_GLIB_CHECKED_ADD_U64': /usr/include/glib-2.0/glib/gmacros.h:740:31: error: static assertion failed: "Expression evaluates to false" 740 | #define G_STATIC_ASSERT(expr) _Static_assert (expr, "Expression evaluates to false") | ^~~~~~~~~~~~~~ /usr/include/glib-2.0/glib/gtypes.h:463:3: note: in expansion of macro 'G_STATIC_ASSERT' 463 | G_STATIC_ASSERT(sizeof (unsigned long long) == sizeof (guint64)); | ^~~~~~~~~~~~~~~ In file included from /usr/include/gtk-2.0/gtk/gtkobject.h:37, from /usr/include/gtk-2.0/gtk/gtkwidget.h:36, from /usr/include/gtk-2.0/gtk/gtkcontainer.h:35, from /usr/include/gtk-2.0/gtk/gtkbin.h:35, from /usr/include/gtk-2.0/gtk/gtkwindow.h:36, from /usr/include/gtk-2.0/gtk/gtkdialog.h:35, from /usr/include/gtk-2.0/gtk/gtkaboutdialog.h:32, from /usr/include/gtk-2.0/gtk/gtk.h:33, from test.c:1: /usr/include/gtk-2.0/gtk/gtktypeutils.h: At top level: /usr/include/gtk-2.0/gtk/gtktypeutils.h:236:1: warning: 'GTypeDebugFlags' is deprecated [-Wdeprecated-declarations] 236 | void gtk_type_init (GTypeDebugFlags debug_flags); | ^~~~ In file included from /usr/include/glib-2.0/gobject/gobject.h:24, from /usr/include/glib-2.0/gobject/gbinding.h:29, from /usr/include/glib-2.0/glib-object.h:22, from /usr/include/glib-2.0/gio/gioenums.h:28, from /usr/include/glib-2.0/gio/giotypes.h:28, from /usr/include/glib-2.0/gio/gio.h:26, from /usr/include/gtk-2.0/gdk/gdkapplaunchcontext.h:30, from /usr/include/gtk-2.0/gdk/gdk.h:32, from /usr/include/gtk-2.0/gtk/gtk.h:32, from test.c:1: /usr/include/glib-2.0/gobject/gtype.h:679:1: note: declared here 679 | { | ^ In file included from /usr/include/gtk-2.0/gtk/gtktoolitem.h:31, from /usr/include/gtk-2.0/gtk/gtktoolbutton.h:30, from /usr/include/gtk-2.0/gtk/gtkmenutoolbutton.h:30, from /usr/include/gtk-2.0/gtk/gtk.h:126, from test.c:1: /usr/include/gtk-2.0/gtk/gtktooltips.h:73:3: warning: 'GTimeVal' is deprecated: Use 'GDateTime' instead [-Wdeprecated-declarations] 73 | GTimeVal last_popdown; | ^~~~~~~~ In file included from /usr/include/glib-2.0/glib/galloca.h:32, from /usr/include/glib-2.0/glib.h:30, from /usr/include/glib-2.0/gobject/gbinding.h:28, from /usr/include/glib-2.0/glib-object.h:22, from /usr/include/glib-2.0/gio/gioenums.h:28, from /usr/include/glib-2.0/gio/giotypes.h:28, from /usr/include/glib-2.0/gio/gio.h:26, from /usr/include/gtk-2.0/gdk/gdkapplaunchcontext.h:30, from /usr/include/gtk-2.0/gdk/gdk.h:32, from /usr/include/gtk-2.0/gtk/gtk.h:32, from test.c:1: /usr/include/glib-2.0/glib/gtypes.h:547:8: note: declared here 547 | struct _GTimeVal | ^~~~~~~~~ A nudge in the right direction would be greatly appreciated. Last edited by luketheduke; 04-15-2023 at 01:01 AM. |
![]() |
![]() |
![]() |
#2 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 416
Karma: 765432
Join Date: Apr 2016
Location: Italy
Device: Kindle PW3 5.8.5.0.1
|
try this:
Code:
arm-kindlepw2-linux-gnueabi-gcc test.c -o test `pkg-config gtk+-2.0 --cflags --libs` Last edited by encol; 04-15-2023 at 09:38 AM. |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 87
Karma: 25608
Join Date: Sep 2022
Device: PW3, PW2, KT2, 2xKT, 2xK3G
|
Same error, unfortunately.
Here's the way my files are laid out. Code:
/home/debian | |----x-tools (koxtoolchain) |----lib (usr/lib directory from my kindle) |----test.c I'm on a Debian VM, btw. Thanks for the assistance. |
![]() |
![]() |
![]() |
#4 |
BLAM!
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13,506
Karma: 26047202
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
|
You're trying to build a GTK-2 something. The toolchain doesn't know anything about GTK, it only provides you a compiler, a libc and kernel headers.
Now, Kindles *do* ship some god awful ancient bits of GTK stuff, so you *could* frankenstein something, but it's going to be a PITA unless you know what you're doing (specifically, you're going to need matching headers for the binaries shipped. You might want to look at the lab126 source code drop for your specifric FW release, I would imagine they'd be in there, in source form, at least, so you're not out of the woods yet ;p). ---- If you're aiming for GTK stuff, it might be easier to dig up whatever KTerm was using to be built, I imagine it's described somewhere. |
![]() |
![]() |
![]() |
#5 | |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 87
Karma: 25608
Join Date: Sep 2022
Device: PW3, PW2, KT2, 2xKT, 2xK3G
|
Quote:
Thanks for the info. ![]() EDIT: So I need to build GTK and its dependencies using the toolchain first? EDIT: NVM, I'm going to start with following KTerm's build instructions. Last edited by luketheduke; 04-15-2023 at 06:46 PM. |
|
![]() |
![]() |
Advert | |
|
![]() |
#7 | ||
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 87
Karma: 25608
Join Date: Sep 2022
Device: PW3, PW2, KT2, 2xKT, 2xK3G
|
Quote:
Quote:
NVM, found a mirror. http://217.196.149.234/debian/dists/....0-6-versatile http://217.196.149.234/debian/dists/...boot/initrd.gz Last edited by luketheduke; 04-16-2023 at 04:15 PM. |
||
![]() |
![]() |
![]() |
#9 | |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 87
Karma: 25608
Join Date: Sep 2022
Device: PW3, PW2, KT2, 2xKT, 2xK3G
|
Quote:
The first mirror didn't work out too well. Nearly done with the installation, but it failed to install busybox. ![]() I'm gonna try the mirror you suggested, which looks like a newer version of Debian as well. (I was using Jesse) |
|
![]() |
![]() |
![]() |
#10 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 87
Karma: 25608
Join Date: Sep 2022
Device: PW3, PW2, KT2, 2xKT, 2xK3G
|
It seems QEMU won't boot the installer from the mirror you provided.
|
![]() |
![]() |
![]() |
#11 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 416
Karma: 765432
Join Date: Apr 2016
Location: Italy
Device: Kindle PW3 5.8.5.0.1
|
Have you tried web archive?
|
![]() |
![]() |
![]() |
#12 | |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 87
Karma: 25608
Join Date: Sep 2022
Device: PW3, PW2, KT2, 2xKT, 2xK3G
|
Quote:
The last two worked, but during the installation, it "failed to install busybox". (See first attachment) I checked the syslog and it says "Failed to authenticate the following packages: Busybox". (See second attachment) I guess I'll try the web archive next. Also, thanks a lot for helping me through this. I wouldn't have even gotten this far myself. |
|
![]() |
![]() |
![]() |
#13 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 87
Karma: 25608
Join Date: Sep 2022
Device: PW3, PW2, KT2, 2xKT, 2xK3G
|
|
![]() |
![]() |
![]() |
#14 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 416
Karma: 765432
Join Date: Apr 2016
Location: Italy
Device: Kindle PW3 5.8.5.0.1
|
i just sent you a message
|
![]() |
![]() |
![]() |
#15 |
Junior Member
![]() Posts: 2
Karma: 10
Join Date: Jun 2023
Device: none
|
Hello, have you solved it? I have encountered the same problem. If possible, please tell me how to solve it. Thank you!
|
![]() |
![]() |
![]() |
Tags |
cross-compile, gcc |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to cross compile C program for Kindle? | NotaStudio | Kindle Developer's Corner | 1 | 10-20-2016 11:40 AM |
Aura H2O CROSS COMPILE on UBUNTU 16.04 x86_64 | disruptivesocial | Kobo Reader | 1 | 05-04-2016 10:19 AM |
Noob Cross-Compile Question | icantbebothered | Kindle Developer's Corner | 1 | 05-07-2013 03:44 PM |
Help with cross compile | Ondra | Kindle Developer's Corner | 18 | 01-06-2013 01:25 PM |
Cross Compile c code for K3 on Win 7 or XP | jmseight | Kindle Developer's Corner | 1 | 04-18-2012 12:33 AM |