1、安装apt-file工具
sodu apt-get update sudo apt-get - install apt-file
安装好apt-file工具后,我们可以合作如下命令进行命令格式的查看:
sudo apt-file --help
apt-file [options] action [pattern]
apt-file [options] -f action <file>
apt-file [options] -D action <debfile>
Configuration options:
--architecture -a <arch> Use specific architecture
--cache -c <dir> Cache directory
--cdrom-mount -d <cdrom> Use specific cdrom mountpoint
--dummy -y run in dummy mode (no action)
--fixed-string -F Do not expand pattern
--from-deb -D Use file list of .deb package(s) as
patterns; implies -F
--from-file -f Read patterns from file(s), one per line
(use '-' for stdin)
--ignore-case -i Ignore case distinctions
--non-interactive -N Skip schemes requiring user input
(useful in cron jobs)
--package-only -l Only display packages name
--regexp -x pattern is a regular expression
--sources-list -s <file> sources.list location
--verbose -v run in verbose mode
--help -h Show this help.
-- End of options (neccessary if pattern
starts with a '-')
Action:
update Fetch Contents files from apt-sources.
search|find <pattern> Search files in packages
list|show <pattern> List files in packages
purge Remove cache files
一般用得比如多的就是Action部分。
2、查找指定的软件包
比如我们编译软件时报如下错:
fatal error: jansson.h: No such file or directory
我们可以通过如下命令查找软件包:
sudo apt-file update sudo apt-file search /usr/include/jansson.h
输出如下:
libjansson-dev: /usr/include/jansson.h
接着执行以下命令安装即可:
sudo apt-get install -y libjansson-dev
我们还可以模糊查找,比如查找nvcc编译器:
sudo apt-file search bin/nvcc
3、安装必要的编译环境
一般编译环境里都建议安装下必要的开发包,命令如下:
sudo apt-get -y install build-essential
- 微信扫码赞助
- 支付宝赞助