Linux内核运行稀疏失败-/bin/sh:1:稀疏:找不到 [英] Linux Kernel run sparse failed - /bin/sh: 1: sparse: not found

查看:709
本文介绍了Linux内核运行稀疏失败-/bin/sh:1:稀疏:找不到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在linux内核上运行稀疏.

I run sparse on linux kernel.

但是它会引发以下错误:

But it throws the following error:

在linux上运行稀疏:
lovegcy @ knltest-VirtualBox:〜/git_root/linux $ make C = 2
make [1]:对"all"不执行任何操作.
HOSTCC arch/x86/tools/relocs_32.o
HOSTCC arch/x86/tools/relocs_64.o
HOSTCC arch/x86/tools/relocs_common.o
HOSTLD arch/x86/tools/relocs
CHK include/Generated/uapi/linux/version.h
CHK include/generate/utsrelease.h
CC内核/bounds.s
GEN包含/生成/bounds.h
CC arch/x86/kernel/asm-offsets.s
GEN包含/生成/asm-offsets.h
CALL脚本/checksyscalls.sh
检查脚本/mod/empty.c
/bin/sh:1:稀疏:找不到
make [2]: * [scripts/mod/empty.o]错误127
make [1]:
[scripts/mod]错误2
make:*
* [scripts]错误2

Run sparse on linux:
lovegcy@knltest-VirtualBox:~/git_root/linux$ make C=2
make[1]: Nothing to be done for `all'.
HOSTCC arch/x86/tools/relocs_32.o
HOSTCC arch/x86/tools/relocs_64.o
HOSTCC arch/x86/tools/relocs_common.o
HOSTLD arch/x86/tools/relocs
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
CC kernel/bounds.s
GEN include/generated/bounds.h
CC arch/x86/kernel/asm-offsets.s
GEN include/generated/asm-offsets.h
CALL scripts/checksyscalls.sh
CHECK scripts/mod/empty.c
/bin/sh: 1: sparse: not found
make[2]: * [scripts/mod/empty.o] Error 127
make[1]:
[scripts/mod] Error 2
make: *
* [scripts] Error 2

这是稀疏的安装日志:

lovegcy @ knltest-VirtualBox:〜/git_root/sparse $进行安装
/bin/sh:1:1:llvm-config:找不到
Makefile:79:您的系统没有llvm,因此禁用了sparse-llvm
安装稀疏"->"/home/lovegcy/bin/sparse"
安装"cgcc"->"/home/lovegcy/bin/cgcc"
安装"c2xml"->"/home/lovegcy/bin/c2xml"
安装测试检查"->"/home/lovegcy/bin/测试检查"
安装‘sparse.1’->‘/home/lovegcy/share/man/man1/sparse.1’
安装‘cgcc.1’->‘/home/lovegcy/share/man/man1/cgcc.1’
安装‘libsparse.a’->‘/home/lovegcy/lib/libsparse.a’
安装‘token.h’->‘/home/lovegcy/include/sparse/token.h’
安装‘parse.h’->‘/home/lovegcy/include/sparse/parse.h’
安装‘lib.h’->‘/home/lovegcy/include/sparse/lib.h’
安装‘symbol.h’->‘/home/lovegcy/include/sparse/symbol.h’
安装‘scope.h’->‘/home/lovegcy/include/sparse/scope.h’
安装‘expression.h’->‘/home/lovegcy/include/sparse/expression.h’
安装‘target.h’->‘/home/lovegcy/include/sparse/target.h’
安装‘linearize.h’->‘/home/lovegcy/include/sparse/linearize.h’
安装‘bitmap.h’->‘/home/lovegcy/include/sparse/bitmap.h’
安装"ident-list.h"->"/home/lovegcy/include/sparse/ident-list.h"
安装‘compat.h’->‘/home/lovegcy/include/sparse/compat.h’
安装‘flow.h’->‘/home/lovegcy/include/sparse/flow.h’
安装‘allocate.h’->‘/home/lovegcy/include/sparse/allocate.h’
安装‘storage.h’->‘/home/lovegcy/include/sparse/storage.h’
安装‘ptrlist.h’->‘/home/lovegcy/include/sparse/ptrlist.h’
安装"dissect.h"->"/home/lovegcy/include/sparse/dissect.h"
安装‘sparse.pc’->‘/home/lovegcy/lib/pkgconfig/sparse.pc’

lovegcy@knltest-VirtualBox:~/git_root/sparse$ make install
/bin/sh: 1: llvm-config: not found
Makefile:79: Your system does not have llvm, disabling sparse-llvm
INSTALL ‘sparse’ -> ‘/home/lovegcy/bin/sparse’
INSTALL ‘cgcc’ -> ‘/home/lovegcy/bin/cgcc’
INSTALL ‘c2xml’ -> ‘/home/lovegcy/bin/c2xml’
INSTALL ‘test-inspect’ -> ‘/home/lovegcy/bin/test-inspect’
INSTALL ‘sparse.1’ -> ‘/home/lovegcy/share/man/man1/sparse.1’
INSTALL ‘cgcc.1’ -> ‘/home/lovegcy/share/man/man1/cgcc.1’
INSTALL ‘libsparse.a’ -> ‘/home/lovegcy/lib/libsparse.a’
INSTALL ‘token.h’ -> ‘/home/lovegcy/include/sparse/token.h’
INSTALL ‘parse.h’ -> ‘/home/lovegcy/include/sparse/parse.h’
INSTALL ‘lib.h’ -> ‘/home/lovegcy/include/sparse/lib.h’
INSTALL ‘symbol.h’ -> ‘/home/lovegcy/include/sparse/symbol.h’
INSTALL ‘scope.h’ -> ‘/home/lovegcy/include/sparse/scope.h’
INSTALL ‘expression.h’ -> ‘/home/lovegcy/include/sparse/expression.h’
INSTALL ‘target.h’ -> ‘/home/lovegcy/include/sparse/target.h’
INSTALL ‘linearize.h’ -> ‘/home/lovegcy/include/sparse/linearize.h’
INSTALL ‘bitmap.h’ -> ‘/home/lovegcy/include/sparse/bitmap.h’
INSTALL ‘ident-list.h’ -> ‘/home/lovegcy/include/sparse/ident-list.h’
INSTALL ‘compat.h’ -> ‘/home/lovegcy/include/sparse/compat.h’
INSTALL ‘flow.h’ -> ‘/home/lovegcy/include/sparse/flow.h’
INSTALL ‘allocate.h’ -> ‘/home/lovegcy/include/sparse/allocate.h’
INSTALL ‘storage.h’ -> ‘/home/lovegcy/include/sparse/storage.h’
INSTALL ‘ptrlist.h’ -> ‘/home/lovegcy/include/sparse/ptrlist.h’
INSTALL ‘dissect.h’ -> ‘/home/lovegcy/include/sparse/dissect.h’
INSTALL ‘sparse.pc’ -> ‘/home/lovegcy/lib/pkgconfig/sparse.pc’

更多: 内核已经编译.

More: The kernel is already compiled.

有人可以提供一些线索吗?

Could anyone give some clue?

非常感谢您!

推荐答案

更简单的方法:

首先,从官方渠道在主机上下载并安装 sparse .

Easier method :

First, download and Install sparse on your host-PC from the official channel.

例如,在Ubuntu上运行,
$ sudo apt-get install sparse

For example, on Ubuntu run,
$ sudo apt-get install sparse

或者,如果您尝试从源代码构建sparse,那么我们需要确保在运行make install命令后,sparse二进制文件位于/usr/bin/sparse.

Alternately if you are attempting to build sparse from its sources, then we need to ensure that after running the make install command the sparse binary is present at /usr/bin/sparse.

这可以通过打开新终端并在其中运行which sparse命令来确认.它应该输出类似于以下内容:

This can be confirmed by opening a new terminal and running the which sparse command in it. It should output similar to the following :

$ which sparse
/usr/bin/sparse

在同一终端中,导航到Linux内核源目录,然后尝试make C=2在Linux内核源上运行sparse.

In the same terminal, navigate to the Linux kernel source directory and attempt make C=2 to run sparse on the Linux kernel source.

注意:从您的日志看来,sparse已安装到/home/lovegcy/bin/中.确保已添加路径/home/lovegcy/bin/您的$PATH环境变量.否则,系统将无法找到sparse二进制文件.

Note : From your logs it appears that sparse is being installed into /home/lovegcy/bin/. Ensure that you have added the path /home/lovegcy/bin/ your $PATH environment variable. Otherwise the system will NOT be able to find the sparse binary.

在Ubuntu上(运行bash shell),可以通过在.bashrc文件中添加以下行,从而自动为每个新终端添加此代码,如下所示:

On Ubuntu (running the bash shell), this can be automated for each new terminal by adding the following line in the .bashrc file as follows :

$ echo "export PATH=\$PATH:/home/lovegcy/bin/" >> ~/.bashrc

这篇关于Linux内核运行稀疏失败-/bin/sh:1:稀疏:找不到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆