What happens if a library is licensed under MIT, but internally that library have a dependency which license under GPL 3.0? Can we still use this library?

I know that libarchive can be configured in a way the resembles the above situation so let’s use that as an example.


Let’s look a bit at the dependencies of libarchive as distributed in Ubuntu. The dependencies according to Ubuntu, as listed here, are:

  • libacl1

  • libbz2-1.0

  • libc6

  • liblz4-1

  • liblzma5

  • libnettle8

  • libxml2

  • libzstd1

  • zlib1g

If we’re using ldd we get:

$ ldd /usr/lib/x86_64-linux-gnu/ | cut -d "=" -f 1 (0x00007ffc075d0000) 
	/lib64/ (0x00007f26fd4b2000) 

And using

$ --png /usr/lib/x86_64-linux-gnu/ 
Log file created: /home/hesa/.vinland/compliance-utils/elf-deps/
Created dot file: /home/hesa/.vinland/compliance-utils/elf-deps/
Created png file: /home/hesa/.vinland/compliance-utils/elf-deps/

we get a graphical view: libarchive’s dependencies

Looking up the licenses, which in itself is a topic we will dive in to in coming posts, and excluding libraries from GNU C Library (glibc) and GNU C++ library both released under GPL but with exceptions (again, exceptions will be covered in coming posts):

… and of course libarchive itself

Let’s copy the dot file, remove the libc(++) libs and enter the licenses

$ cp /home/hesa/.vinland/compliance-utils/elf-deps/ 
$ emacs
$ cat
digraph depends {
 node [shape=plaintext]
" (New BSD)" -> " (LGPLv2.1+ & GPLv2+)"
" (New BSD)" -> " (bzip)"
" (New BSD)" -> " (BSD 2-Clause)"
" (New BSD)" -> " (GPLv2+)"
" (New BSD)" -> " (LGPLv3+ | GPLv2+)"
" (New BSD)" -> " (MIT)"
" (New BSD)" -> " (Zlib)"
" (New BSD)" -> " (BSD)"
" (ICU)" -> " (ICU)"
" (MIT)" -> " (ICU)"
" (MIT)" -> " (GPLv2+)"
" (MIT)" -> " (Zlib)"
$ dot -Tpng -O

The graph now looks like this: libarchive’s (fixed) dependencies

Most parts if the graph look OK. In the libacl case we can chose the LGPL license instead of the GPL. But the following should stir up some emotions:

" (New BSD)" -> " (GPLv2+)"
" (MIT)" -> " (GPLv2+)"

If we plan to keep the license of libarchive and libxml as New BSD and MIT then we get in to a tricky situation. We can however license the combined work (all the libraries above combined) under GPLv2+.

Note: the dot file is here:

A program using libarchive

Let’s say we want to create a file browser that uses libarchive. Examples of file browser are Dolphin and Nautilus / Gnome Files. Do they use libarchive?

$ which dolphin | xargs ldd | grep libarchive
$ which nautilus | xargs ldd | grep libarchive => /lib/x86_64-linux-gnu/ (0x00007f9fe9afc000)

Nautilus uses libarchive but Dolphin does not. So let’s look at Nautilus, which is released under GPL-3.0. Software released *under GPL-3.0 can use GPL-2 components so no problemts there.

But if we want to create a new program, let’s call Dolphinus using libarchive (which, as a reminder, now has the outbound license GPL2 (configured as with Ubuntu)) and release this program under the MIT license. We can’t do this if we want to keep the outbound license of the program (or rather the combined work) as “MIT”.


So libarchive can be distributed as Debian and Ubuntu (and most likely Fedora, RedHat and the rest of the GNU/Linux distributors) do it. Even though a BSD library is dependent (uses) on a GPL component.

However we need to keep in mind that the outbound license for libarchive as a combined work is GPLv2 instead of New BSD (as is the license of libarchive itself).

When checking compliance manually or with license tools, such as flict, we need to make sure we or the tool determine(s) the outbound license of a software. Otherwise we might come to the conclusion that a program like Dolphinus (as a combined work) above can have the outbound license MIT which is not correct.

Note: flict will support a change in the outbound license “quite soon” (famous last words)

About the cover image

Flea market in Majorna, Gothenburg, Sweden from flickr, (c) 2017 Henrik Sandklef released under Attribution-ShareAlike 2.0 Generic (CC BY-SA 2.0)

Hmmm, the reason for using this picture isn’t that good. I figure the guy in the picture is looking in to an archive. Kind of lame. But I like the picture so let’s use it.