Menu

LinuxLibzip

libzip (2)
Martin Fischer Dave Bullis

Linux Build - Libzip

The Original Problem

For users using the executables built by this project we face an issue with the libzip library. For XTrkCad users using distribution packages (Ubuntu, Fedora, Slackwas, etc) see below..

We build XTrkCad on an older release of Ubuntu (currently 20.04). Excutables built on an older distribution can (usually) be run on newer ditributions. The allows us to support a wider range of systems.

This reveals a problem with Ubuntu's handling ot the libzip library.
Libzip is usually at version V4.
But Ubuntu 20.04 (our build platform) switched to V5 with no path to backward compatibly.
So executables using the libzip shared library from Ubuntu 20.04 will not run on any system not using V5
Google shows a number of posts on this issue, for example
https://github.com/actions/runner-images/issues/1084

The symptom for XTrkCad built on Ubuntu 20.04 and running on 22.04

$ ldd xtrkcad-dynlib | grep libzip
libzip.so.5 => /lib/x86_64-linux-gnu/libzip.so.5 (0x00007f6098026000)
$ ./xtrkcad-dynlib
./xtrkcad-dynlib: error while loading shared libraries: libzip.so.5: cannot open shared object file: No such file or directory

This says the excutable is dependent on libzip V5 shared library but that library does not exist on this system.

To avoid this type of shared library version dependency we would normally link with the static libzip.a library.
However Ubuntu or the Libzip project ceased to ship libzip.a as part of their binary libzip distribuction.

The problem is
* we need to link with libzip.a
* libzip.a is not shipped with Ubuntu

The libzip static library was last shipped in library version 1,1,2.-.1 available here
https://bugs.launchpad.net/ubuntu/yakkety/amd64/libzip-dev/1.1.2-1.1
Download libzip-dev_1.1.2-1.1_amd64.deb and extract the static library libzip.a
As a convenience, libzip.a is available here
https://sourceforge.net/projects/xtrkcad-fork/files/Development/Linux%20Lib/x86_64/
Copy libzip.a to somewhere on the linker path (LIBZIP_LIBRARY) defined in $SRCDIR/CMake/FindLibzip.txt (such as /usr/local/lib or your Build root)

V5.3.0 Current Bahavior

Currently (V5.3.0GA) inclues libzip.a at SRCDIR/app/tools/lib
This causes grief for some distibution maintainers who don't like having a binary library in the source tree.
The library is currently available from SourceForge and will be removed from the source tree in next post-V5.3.0 release

Distribution Maintainers

We have two type of audiences for this informations:
* Developers who are fixing bugs and enhancing the program
* Maintainers who integrate the program into various distributions

The above discussion addresses the first group who want to produce a program that runs on as many different systems as possible. This group wants to avoid shared library conflicts such as this.

The second group produces a program which is integrated to the current environment, using the up to date shared libraries.
This group can ignore the above discussion and not use the libzip.a static library post-5.3.0GA.
However, statically linking obscure components can reduce run-time dependencies.

CategoryDevel


Related

Wiki: LinuxBuild

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.