My thoughts on Slackware, life and everything

Calibre 5.x – I can’t create a working package

Calibre is my favorite e-book library management program. My repository contains a package for Calibre 4.x which works well, but it is using Python2 and has been superseded since September 2020 by the new 5.x releases which are based on Python3.
I have been postponing the Slackware package migration from 4.x to 5.x until Slackware 15.0 would be released, since the move from Python 2 to 3 promised to be a significant effort in terms of changing the calibre.SlackBuild script.

Now that Slackware 15.0 is available, I decided to pick up this chore and re-write the build script to support Calibre 5.x. The re-write took several days because of all the new Python modules that are now required by Calibre 5.
I have dropped support for embedding a copy of the Qt5 libraries and compiling an embedded Python interpreter is no longer optional. It simplified the script and reduced the compile-time a lot (no more Qt5 compilation).

Now the bad part. I have been trying to compile Calibre 5.38 on Slackware 15.0 now for the past week. Well, compiling is OK, and the ebook viewer and editor work properly. But the main calibre program crashes with an error “free(): invalid pointer” as soon as it tries to create a new (or read an existing) Calibre database (metadata.db). As a consequence, the Calibre library maintenance program is completely useless.
I have not found a cause for that, and unfortunately the Calibre developer refuses to discuss any bug that is not in his own pre-built binaries.

So I am between a rock and a hard place. I have no idea how to proceed from here, and I am not willing to add a non-functional package to my repository. So I have uploaded my work here:

If anyone wants to try this out and finds the cause of the crash bug, please share your thoughts here.

Thanks, Eric

4 Comments

  1. Didier Spaier

    Hi Eric,

    as an aside I have just packaged foliate for upcoming Slint 15.0:
    https://johnfactotum.github.io/foliate/
    mostly stealing the PKGBUILD from Arch (converted to an SLKBUILD and built with slkbuild from gapan):
    https://archlinux.org/packages/community/x86_64/foliate/
    https://github.com/archlinux/svntogit-community/blob/packages/foliate/trunk/PKGBUILD

    I just needed to add a doinst with:
    /usr/bin/glib-compile-schemas /usr/share/glib-2.0/schemas

    It builds fine on Slackware64-15.0, I still need to include a proper .desktop file

    A plus for blind users: it can read the text aloud using for instance espeak-ng

  2. Jen

    Calibre and frescobaldi are messes. Like, the devs really just want either to be a binary distribution, and aren’t overly responsive to fixing things that break. I wonder if it’s a feature of a python-based program, sloppy dev culture, or both? Looks like FBReader for Linux is doing snap store, too. seems like there’s a real push away from source and to flatpak/snap. :/

  3. alienbob

    I guess it needed some anger and frustration to fix.
    I looked up how to debug a Python based application, and found the PYTHONVERBOSE variable in “man python”.
    So I ran “export PYTHONVERBOSE=2 ; calibre” and noticed that the last action before the “”free(): invalid pointer” error was loading the sqlite_extension plugin of Calibre: “/usr/lib64/calibre/calibre/plugins/sqlite_extension.so”.
    SQLite support in Calibre goes via apsw (Another Python SQlite Wrapper) and the apsw module that I compile into Calibre contains an embedded ‘sqlite amalgamation’ C-code file. But what I did not do was build apsw with “–enable-all-extensions”. So when my calibre debugging showed that the problem was somehow with the SQLite support, I decided to try a couple of things. First, I switched to the latest apsw and sqlite amalgamation versions and when that didn’t help, switch back to the versions that Calibre itself uses. Then I added the “–enable-all-extensions” parameter to the apsw build command and that finally made the difference.
    I am going to do some more testing but I have Calibre up and running here in 64bit Slackware-current, so I am confident.

  4. Ozan

    All the developers I had to deal with Calibre was the worst. I remember we just dont bother to fix a LANG problem years ago. THey mad eup excuses to close the bug report couple of times. I persisted and they finally get it fixed.
    BY the way, Mkvtoolnix developer was the nicest to work with. He really helped me with my build script couple of times and fixed a bug twice for me.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

© 2024 Alien Pastures

Theme by Anders NorenUp ↑