【Linux】opencv在arm64上提示找不到libjasper-dev

解决opencv在arm64上提示找不到libjasper-dev的问题。

本文首发于❄慕雪的寒舍

问题说明

最近我在尝试编译opencv,安装依赖项libjasper1和libjasper-dev的时候就遇到了这个问题。在amd64平台上,我们可以通过下面的命令安装(ubuntu18.04)

bash 复制代码
apt-get install -y software-properties-common 
add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main"
apt-get -y update 
apt-get install -y libjasper1 libjasper-dev

但是在arm64的机器上,这个新添加的源会提示404。注意404不是网络问题,而是指定的文件不存在。根据这里显示的url,其实就是因为binary-arm64这个路径不存在。

复制代码
Err:6 http://security.ubuntu.com/ubuntu xenial-security/main arm64 Packages
  404  Not Found [IP: 185.125.190.83 80]
Fetched 106 kB in 2s (44.6 kB/s)
Reading package lists... Done
E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/main/binary-arm64/Packages  404  Not Found [IP: 185.125.190.83 80]
E: Some index files failed to download. They have been ignored, or old ones used instead.

解决方案

根据这篇博客,arm架构的ubuntu18.04需要使用下面的方式安装这两个库。

将下面的清华源写入/etc/apt/sources.list文件的末尾(注意,如果你执行过上文的命令错误添加了会404的源,需要将那个源注释掉)

复制代码
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ xenial main multiverse restricted universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ xenial-security main multiverse restricted universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ xenial-updates main multiverse restricted universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ xenial-backports main multiverse restricted universe
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ xenial main multiverse restricted universe
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ xenial-security main multiverse restricted universe
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ xenial-updates main multiverse restricted universe
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ xenial-backports main multiverse restricted universe

修改文件之后,执行如下命令就可以安装了。

bash 复制代码
apt-get -y update 
apt-get install -y libjasper1 libjasper-dev

安装成功的输出如下

复制代码
root@ubuntu-linux-22-04-02-desktop:/# apt-get install -y libjasper1 libjasper-dev
Reading package lists... Done
Building dependency tree   
Reading state information... Done
Suggested packages:
  libjasper-runtime
The following NEW packages will be installed:
  libjasper-dev libjasper1
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 613 kB of archives.
After this operation, 1327 kB of additional disk space will be used.
Get:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports xenial-security/main arm64 libjasper1 arm64 1.900.1-debian1-2.4ubuntu1.3 [111 kB]
Get:2 http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports xenial-security/main arm64 libjasper-dev arm64 1.900.1-debian1-2.4ubuntu1.3 [502 kB]
Fetched 613 kB in 1s (758 kB/s)    
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76, <> line 2.)
debconf: falling back to frontend: Readline
Selecting previously unselected package libjasper1:arm64.
(Reading database ... 67223 files and directories currently installed.)
Preparing to unpack .../libjasper1_1.900.1-debian1-2.4ubuntu1.3_arm64.deb ...

搞定!

相关推荐
stormsha11 分钟前
中文路径让 MySQL 起不来:Failed to find valid data directory 与 Illegal byte sequence
运维·数据库·mysql
stormsha22 分钟前
MySQL 报 `data directory has files in it`:初始化失败一次,之后就永久起不来
运维·数据库·mysql
星恒随风3 小时前
从0实现C++ AI大模型接入SDK(七):Ollama本地模型部署、NDJSON流式响应与LLMManager模型管理
linux·开发语言·c++·人工智能·笔记
蜗牛一步步往上爬3 小时前
第十七章 创建函数
linux
沙老师6 小时前
Linux Purification Plan - More Modification
linux·运维·服务器
Tanner_SL6 小时前
Linux笔记之常用命令
linux·笔记·php
StarsGreen6 小时前
gstreamer应用使用API详解
linux
Decay__7 小时前
PostgreSQL 高可用与容灾架构 —— 流复制、Patroni、Keepalived+VIP、读写分离与两地三中心
运维·数据库·sql·postgresql
鱼很腾apoc7 小时前
【Redis】第2期 详解Redis五大数据结构:命令+C++实现、渐进式遍历与数据库管理
linux·服务器·c语言·数据结构·c++·redis·学习
沙老师8 小时前
重新设计 Linux VFS 的 Mount 机制
linux