I am trying to build Opencv on Ubuntu 18.04.

When I run make I get the error:

grfmt_jpeg2000.cpp:59:10: fatal error: jasper/jasper.h: No such file or directory
 #include <jasper/jasper.h>
compilation terminated.

I had already jasper installed and installed libjasperreports-java. However the file jasper.h cannot be found in my system. Is there any library I can install with apt install to get that file?


1 Answer 1


jasper.h is part of the libjasper-dev package. This package is not available in Ubuntu 18.04. So try downloading it and install using

cd ~/Downloads
wget http://archive.ubuntu.com/ubuntu/pool/main/j/jasper/libjasper-dev_1.900.1-debian1-2.4ubuntu1.3_amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/main/j/jasper/libjasper1_1.900.1-debian1-2.4ubuntu1.3_amd64.deb

sudo apt-get install ./libjasper-dev_1.900.1-debian1-2.4ubuntu1.3_amd64.deb ./libjasper1_1.900.1-debian1-2.4ubuntu1.3_amd64.deb
  • I get this error The following packages have unmet dependencies: libjasper-dev : Depends: libjasper1 (= 1.900.1-debian1-2.4ubuntu1.2) but it is not installable E: Unable to correct problems, you have held broken packages. Oct 1, 2018 at 13:45
  • Edited my answer. Please try again
    – Arun
    Oct 1, 2018 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.