I would like to compile libvips with libjpeg-turbo8 to get a better performance, but I'm having trouble replacing it.
When both libjpeg and libjpeg-turbo8 are installed, the regular libjpeg seems to be used during compilation as the performance is quite bad. (I have another docker image where everything does compile properly where it is much faster.)
When I try to remove libjpeg, it will also remove libtiff.
So my question is: How can I compile libvips with libjpeg-turbo8, while keeping libraries that depend on libjpeg?
# apt remove libjpeg8
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
libjpeg-dev libjpeg8 libjpeg8-dev libtiff-dev libtiff5 libtiff5-dev libtiffxx5
0 upgraded, 0 newly installed, 7 to remove and 113 not upgraded.
After this operation, 1664 kB disk space will be freed.
Do you want to continue? [Y/n]
Below a snippet of apt list
that shows all installed jpeg libraries:
libjpeg-dev/bionic,now 8c-2ubuntu8 amd64 [installed,automatic]
libjpeg-progs/bionic 1:9b-2 amd64
libjpeg-turbo-progs/bionic-updates,bionic-security 1.5.2-0ubuntu5.18.04.3 amd64
libjpeg-turbo-test/bionic-updates,bionic-security 1.5.2-0ubuntu5.18.04.3 amd64
libjpeg-turbo8/bionic-updates,bionic-security,now 1.5.2-0ubuntu5.18.04.3 amd64 [installed]
libjpeg-turbo8-dbg/bionic-updates,bionic-security 1.5.2-0ubuntu5.18.04.3 amd64
libjpeg-turbo8-dev/bionic-updates,bionic-security,now 1.5.2-0ubuntu5.18.04.3 amd64 [installed,automatic]
libjpeg62/bionic 1:6b2-3 amd64
libjpeg62-dev/bionic 1:6b2-3 amd64
libjpeg8/bionic,now 8c-2ubuntu8 amd64 [installed,automatic]
libjpeg8-dbg/bionic 8c-2ubuntu8 amd64
libjpeg8-dev/bionic,now 8c-2ubuntu8 amd64 [installed,automatic]
libjpeg9/bionic 1:9b-2 amd64
libjpeg9-dbg/bionic 1:9b-2 amd64
libjpeg9-dev/bionic 1:9b-2 amd64
There's no need to rebuild anything -- the two libjpegs are binary compatible and you can simply remove one library binary and install the other.
apt knows how to do this. Just apt install libjpeg-turbo8
and it'll remove the slow libjpeg8
, install the new turbo version, and off you go.