Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 04-14-2023, 08:17 PM   #1
luketheduke
Connoisseur
luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.
 
luketheduke's Avatar
 
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
I was able to compile a simple hello world C program.

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
I tried to compile this:

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;
}
But it failed with this error

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
      |        ^~~~~~~~~
I've done a fair bit of googling, but no solutions.
A nudge in the right direction would be greatly appreciated.

Last edited by luketheduke; 04-15-2023 at 01:01 AM.
luketheduke is offline   Reply With Quote
Old 04-15-2023, 09:18 AM   #2
encol
Evangelist
encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.
 
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`
I compiled it in a chroot environment and it works

Last edited by encol; 04-15-2023 at 09:38 AM.
encol is offline   Reply With Quote
Advert
Old 04-15-2023, 01:06 PM   #3
luketheduke
Connoisseur
luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.
 
luketheduke's Avatar
 
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
Are there any packages I need to install?

I'm on a Debian VM, btw.

Thanks for the assistance.
luketheduke is offline   Reply With Quote
Old 04-15-2023, 05:13 PM   #4
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
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.
NiLuJe is offline   Reply With Quote
Old 04-15-2023, 06:28 PM   #5
luketheduke
Connoisseur
luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.
 
luketheduke's Avatar
 
Posts: 87
Karma: 25608
Join Date: Sep 2022
Device: PW3, PW2, KT2, 2xKT, 2xK3G
Quote:
Originally Posted by NiLuJe View Post
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.
Good to know. Unfortunately, I have no idea what I'm doing, so I'm going to see about the latter option.

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.
luketheduke is offline   Reply With Quote
Advert
Old 04-16-2023, 03:40 AM   #6
encol
Evangelist
encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.
 
Posts: 416
Karma: 765432
Join Date: Apr 2016
Location: Italy
Device: Kindle PW3 5.8.5.0.1
I followed this instructions (method 1), and i was able to compile it
encol is offline   Reply With Quote
Old 04-16-2023, 04:09 PM   #7
luketheduke
Connoisseur
luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.
 
luketheduke's Avatar
 
Posts: 87
Karma: 25608
Join Date: Sep 2022
Device: PW3, PW2, KT2, 2xKT, 2xK3G
Quote:
Originally Posted by encol View Post
I followed this instructions (method 1), and i was able to compile it
Quote:
Originally Posted by coplate View Post
  1. wget http://http.us.debian.org/debian/dis....0-4-versatile
  2. wget http://http.us.debian.org/debian/dis...boot/initrd.gz
  3. qemu-img create -f raw armdisk.img 2G
  4. qemu-system-arm -m 256 -M versatilepb -kernel vmlinuz-3.16.0-4-versatile -initrd initrd.gz -hda armdisk.img -append "root=/dev/ram"
I'm getting a 404. Looks like the links are down. Is there a mirror?

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.
luketheduke is offline   Reply With Quote
Old 04-16-2023, 05:18 PM   #8
encol
Evangelist
encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.
 
Posts: 416
Karma: 765432
Join Date: Apr 2016
Location: Italy
Device: Kindle PW3 5.8.5.0.1
Quote:
Originally Posted by luketheduke View Post
NVM, found a mirror.
good, or you can try here

Last edited by encol; 04-16-2023 at 05:21 PM.
encol is offline   Reply With Quote
Old 04-16-2023, 10:05 PM   #9
luketheduke
Connoisseur
luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.
 
luketheduke's Avatar
 
Posts: 87
Karma: 25608
Join Date: Sep 2022
Device: PW3, PW2, KT2, 2xKT, 2xK3G
Quote:
Originally Posted by encol View Post
good, or you can try here

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)
luketheduke is offline   Reply With Quote
Old 04-16-2023, 11:13 PM   #10
luketheduke
Connoisseur
luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.
 
luketheduke's Avatar
 
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.
luketheduke is offline   Reply With Quote
Old 04-17-2023, 02:51 AM   #11
encol
Evangelist
encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.
 
Posts: 416
Karma: 765432
Join Date: Apr 2016
Location: Italy
Device: Kindle PW3 5.8.5.0.1
Have you tried web archive?
encol is offline   Reply With Quote
Old 04-17-2023, 12:54 PM   #12
luketheduke
Connoisseur
luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.
 
luketheduke's Avatar
 
Posts: 87
Karma: 25608
Join Date: Sep 2022
Device: PW3, PW2, KT2, 2xKT, 2xK3G
Quote:
Originally Posted by encol View Post
Have you tried web archive?
I tried
  • http.us.debian.org
  • archive.debian.org
  • 217.196.149.234

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.
Attached Thumbnails
Click image for larger version

Name:	Screen Shot 2023-04-16 at 9.24.54 PM.png
Views:	148
Size:	106.6 KB
ID:	201107   Click image for larger version

Name:	Screen Shot 2023-04-17 at 9.48.26 AM.png
Views:	137
Size:	262.7 KB
ID:	201108  
luketheduke is offline   Reply With Quote
Old 04-17-2023, 01:04 PM   #13
luketheduke
Connoisseur
luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.luketheduke knows what's going on.
 
luketheduke's Avatar
 
Posts: 87
Karma: 25608
Join Date: Sep 2022
Device: PW3, PW2, KT2, 2xKT, 2xK3G
Quote:
Originally Posted by encol View Post
Have you tried web archive?
404 Not Found

Looks like the downloads weren't archived.
luketheduke is offline   Reply With Quote
Old 04-17-2023, 02:14 PM   #14
encol
Evangelist
encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.encol ought to be getting tired of karma fortunes by now.
 
Posts: 416
Karma: 765432
Join Date: Apr 2016
Location: Italy
Device: Kindle PW3 5.8.5.0.1
i just sent you a message
encol is offline   Reply With Quote
Old 06-28-2023, 07:16 AM   #15
dou
Junior Member
dou began at the beginning.
 
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!
dou is offline   Reply With Quote
Reply

Tags
cross-compile, gcc


Forum Jump

Similar Threads
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


All times are GMT -4. The time now is 11:47 AM.


MobileRead.com is a privately owned, operated and funded community.