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 12-09-2025, 11:23 AM   #1
mpham
Junior Member
mpham began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Dec 2022
Device: Kindle
Lightbulb Trying to build QT4 (and eventually PyQT4) on K2

Hi guys, I've been trying to revive my K2 to build a simple TODO app. Since it has a keyboard, it could be useful tablet for noting my tasks

So basically, I (on a mac with apple silicon) was trying to setup a build environment using Docker (ubuntu:22.04), with the help from sysroot that I extracted from my K2 (GLIBC 2.5), and koxtoolchain 2025.05.

1) Building a simple Helloworld C works

2) Building another simple Helloworld CPP works (static linking)
Code:
#define _GNU_SOURCE
#include <cstdio>
#include <vector>
#include <unistd.h>
#include <fcntl.h>
#include <cerrno>

int main() {
    printf("1. Start: C stdio works.\n");
    
    // --- TEST A: C++ STL (Triggers libstdc++) ---
    std::vector<int> v;
    v.push_back(42);
    
    printf("2. C++ Vector size: %d\n", (int)v.size());

    // --- TEST B: GLIBC 2.9 Feature (pipe2) ---
    // pipe2() was added in glibc 2.9. 
    // It allows setting O_CLOEXEC atomically.
    int pipefd[2];
    
    // Attempt to use pipe2
    int result = pipe2(pipefd, O_CLOEXEC);

    if (result == 0) {
        printf("3. GLIBC 2.9 [pipe2]: Success! (Kernel supports syscall)\n");
        close(pipefd[0]);
        close(pipefd[1]);
    } else {
        if (errno == ENOSYS) {
             printf("3. GLIBC 2.9 [pipe2]: Linked OK, but Kernel too old (ENOSYS).\n");
             printf("   (This is normal for Kindle 2/3/4 with Kernel < 2.6.27)\n");
        } else {
             printf("3. GLIBC 2.9 [pipe2]: Failed with error code %d\n", errno);
        }
    }

    printf("4. Final: Binary execution finished.\n");
    return 0;
}
3) Building Python-2.7.18 works

4) Now, for qt-everywhere-opensource-src-4.8.2:
- Dynamic link built OK, when I tried to run libQtCore.so complains about GLIBC (toolchain's version is 2.9 iirc, but Kindle's version is 2.5)
- Dynamic link, pointing to the toolchain's lib built OK, but it returned Segmentation fault when I tried to run
- Static link seems OK, I tried to build a simple QT app

Code:
#include <QApplication>
#include <QLabel>
#include <QTimer>
#include <cstdio>

int main(int argc, char *argv[]) {
    QApplication app(argc, argv);
    
    printf("1. Qt Initialized successfully.\n");

    QLabel label("Hello K2!");
    label.show();
    
    printf("2. GUI Element created. Starting Event Loop...\n");


    int ret = app.exec();
    
    return ret;
}
Code:
TEMPLATE = app
TARGET = qt_hello
SOURCES += main.cpp
But when I ran, it returns

Code:
./qt_hello_static  -qws

QWSSocket::connectToLocalFile could not connect:: No such file or directory

QWSSocket::connectToLocalFile could not connect:: No such file or directory

QWSSocket::connectToLocalFile could not connect:: No such file or directory

QWSSocket::connectToLocalFile could not connect:: No such file or directory

QWSSocket::connectToLocalFile could not connect:: No such file or directory

QWSSocket::connectToLocalFile could not connect:: No such file or directory

No Qt for Embedded Linux server appears to be running.

If you want to run this program as a server,

add the "-qws" command-line option.
With force server mode

Code:
#include <QApplication>
#include <QLabel>
#include <QTimer>
#include <cstdio>

int main(int argc, char *argv[]) {
    printf("1. Force-Starting in Server Mode...\n");

    QApplication app(argc, argv, QApplication::GuiServer);
    
    printf("2. Qt Initialized. Screen Width: %d\n", app.desktop()->width());

    QLabel label("Hello Static Kindle!\n(Server Mode Forced)");
    label.setAlignment(Qt::AlignCenter);
    label.showFullScreen();
    

    QTimer::singleShot(3000, &app, SLOT(quit()));

    return app.exec();
}
It returned error

Code:
./qt_hello_static -qws
QLinuxFbScreen::initDevice: Invalid argument
Error writing palette to framebuffer
Cannot open input device '/dev/tty0': No such file or directory
Could you guys please help me to see what was the problem?

Thanks!!
mpham is offline   Reply With Quote
Old Yesterday, 01:34 PM   #2
mpham
Junior Member
mpham began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Dec 2022
Device: Kindle
finally!!!!
Attached Thumbnails
Click image for larger version

Name:	IMG_6378.jpg
Views:	11
Size:	275.1 KB
ID:	219666  
mpham is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ImportError: No module named PyQT4 Francois_C Devices 6 02-13-2015 11:47 AM
V2 new error : pyqt4 hairybiker Calibre 5 10-06-2014 06:43 AM
ImportError: No module named PyQt4 miglanc Conversion 8 09-11-2014 01:51 AM
iLiad QT4 Working!!! Adam B. iRex Developer's Corner 9 06-17-2007 02:41 PM


All times are GMT -4. The time now is 02:12 AM.


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