Coffee Space


Listen:

Build Kiwix

Preview Image

TL;DR

Some of the libraries for building the official Kiwix program for Linux are now gone, but you can build it by downloading (or finding) the below libraries.

What Is Kiwix?

Essentially it’s a way of viewing Zim dumps, specifically it allows you to view content such as Wikipedia archives offline. This is quite useful if you are travelling to somewhere where internet may not be guaranteed, have an interest in creating backups of content you love or a multitude of other reasons.

Problems Building Kiwix

So Kiwix now have their official GitHub repository in archive and it’s stopped building correctly as the packages are old. Their website where lots of the packages are archived also doesn’t have quite a few of the packages any more.

As of writing, you should run (for Linux x86):

0001 ./autogen.sh

Then:

0002 ./configure --enable-compileall --enable-staticbins --disable-android;

Next

0003 cd src/dependencies

This is where you’ll run into problems…

Library Mirror

I went and found the missing files, you should copy them to src/dependencies. They are listed with their checksums, if you’re concerned you can independently verify them or find them - but I have no interest in screwing with anybody.

ctpp2-2.8.3

Download and check:

0004 $ shasum -a256 ctpp2-2.8.3.tar.gz | awk \
0005 '{if($1=="a83ffd07817adb575295ef40fbf759892512e5a63059c520f9062d9ab8fb42fc")print"good";else print"bad";}'

e2fsprogs-1.42

Download and check:

0006 $ shasum -a256 e2fsprogs-1.42.tar.gz | awk \
0007 '{if($1=="55b46db0cec3e2eb0e5de14494a88b01ff6c0500edf8ca8927cad6da7b5e4a46")print"good";else print"bad";}'

icu4c-56_1-src

Download and check:

0008 $ shasum -a256 icu4c-56_1-src.tgz | awk \
0009 '{if($1=="3a64e9105c734dcf631c0b3ed60404531bce6c0f5a64bfe1a6402a4cc2314816")print"good";else print"bad";}'

libmicrohttpd-0.9.19

Download and check:

0010 $ shasum -a256 libmicrohttpd-0.9.19.tar.gz | awk \
0011 '{if($1=="dc418c7a595196f09d2f573212a0d794404fa4ac5311fc9588c1e7ad7a90fae6")print"good";else print"bad";}'

pugixml-1.2

Download and check:

0012 $ shasum -a256 pugixml-1.2.tar.gz | awk \
0013 '{if($1=="0f422dad86da0a2e56a37fb2a88376aae6e931f22cc8b956978460c9db06136b")print"good";else print"bad";}'

xapian-core-1.4.2

Download and check:

0014 $ shasum -a256 xapian-core-1.4.2.tar.xz | awk \
0015 '{if($1=="aec2c4352998127a2f2316218bf70f48cef0a466a87af3939f5f547c5246e1ce")print"good";else print"bad";}'

xulrunner-runtime

Download and check:

0016 $ shasum -a256 xulrunner-runtime.tar.bz2 | awk \
0017 '{if($1=="7af48a7f227beff2b9f04ba10fe59962d9baf6f5a64512b4aaf8fc521f187544")print"good";else print"bad";}'

xulrunner-sdk

Download and check:

0018 $ shasum -a256 xulrunner-sdk.tar.bz2 | awk \
0019 '{if($1=="6a58c461447b425112e9d67f3ce4f3cb819085de48ea4a677925e04ad8d9207d")print"good";else print"bad";}'

xz

Download and check:

0020 $ shasum -a256 xz.tar.bz2 | awk \
0021 '{if($1=="5cd9b060d3a1ad396b3be52c9b9311046a1c369e6062aea752658c435629ce92")print"good";else print"bad";}'

zimlib-1.4

Download and check:

0022 $ shasum -a256 zimlib-1.4.tar.gz | awk \
0023 '{if($1=="b831f8f2aa5215300c957231b3dfbc9336f5c8d3b4ac8e6d98a37441701c2a93")print"good";else print"bad";}'

zlib

Download and check:

0024 $ shasum -a256 zlib.tar.gz | awk \
0025 '{if($1=="36658cb768a54c1d4dec43c3116c27ed893e88b02ecfcb44f2166f9c0b7f2a0d")print"good";else print"bad";}'

icu-config

Yeah, so part of the build system was depreciated, yaay! You can build it and install it with the following:

0026 cd icu/source # from the src/dependencies directory
0027 ./configure --enable-icu-config
0028 make
0029 sudo make install

Next Steps

Now you should be able to run (in src/dependencies):

0030 make;
0031 sudo make install
0032 cd ../..;

You’ll need to reconfigure:

0033 ./configure --enable-compileall;

Then run make again:

0034 make;

Then you can build the static version:

0035 make diststatic

Your ready to rock binary should be in static_tmp. Not quite done yet…

ZLIB_1.2.9

So if you try running ./kiwix in that directory, you’ll get an error like so:

0036 $ ./kiwix
0037 XPCOMGlueLoad error for file kiwix-xulrunner/static_tmp/kiwix/xulrunner/libxul.so:
0038 kiwix-xulrunner/static_tmp/kiwix/xulrunner/libz.so.1: version `ZLIB_1.2.9' not found (required by /usr/lib/x86_64-linux-gnu/libpng16.so.16)
0039 Couldn't load XPCOM.

Download and check:

0040 $ shasum -a256 zlib-1.2.9.tar.gz | awk \
0041 '{if($1=="73ab302ef31ed1e74895d2af56f52f5853f26b0370f3ef21954347acec5eaa21")print"good";else print"bad";}'

Then we can do the following:

tar -xvf zlib-1.2.9.tar.gz # extract in whichever location cd zlib-1.2.9 ./configure make

If that all went okay, you can now copy the output files libz.* to static_tmp/kiwix.

Finally, you should now be able to run ./kiwix in the static_tmp/kiwix directory. Good luck!

Additional Problems

It seems like we’re still having problems packaging something together. When you try to index the Zim file after searching it, you segfault. It seems to be that it cannot find the location of kiwix-index. For now we’ll manually copy it over:

0042 mkdir static_tmp/kiwix/bin/.libs
0043 cp src/indexer/kiwix-index static_tmp/kiwix/bin/.libs/
0044 cp src/indexer/kiwix_index-kiwix-index.o static_tmp/kiwix/bin/.libs/

Now you should be able to index the Zim file.

It’s Alive!

You should see something like the below if you have been successful:

Kiwix indexing anime stack exchange