linux安装iscsi target,make时出错,解决方法

时间:2021-08-16 12:45:16

安装主要是按照这个网址的步骤来的:http://ixdba.blog.51cto.com/2895551/526452

执行到make步骤时,出错:

root@host:~/iscsitarget-1.4.20.2# make
cc: error: /lib/modules/3.5.0-23-generic/build/include/linux/version.h: No such file or directory
cc: fatal error: no input files
compilation terminated.
/bin/sh: 1: [: -le: unexpected operator
/bin/sh: 1: [: -le: unexpected operator
/bin/sh: 1: [: -le: unexpected operator
/bin/sh: 1: [: -le: unexpected operator
/bin/sh: 1: [: -le: unexpected operator
/bin/sh: 1: [: -le: unexpected operator
/bin/sh: 1: [: -le: unexpected operator
/bin/sh: 1: [: -le: unexpected operator
/bin/sh: 1: [: -le: unexpected operator
/bin/sh: 1: [: -le: unexpected operator
/bin/sh: 1: [: -le: unexpected operator
/bin/sh: 1: [: -lt: unexpected operator
make -C usr
make[1]: Entering directory `/root/iscsitarget-1.4.20.2/usr'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/root/iscsitarget-1.4.20.2/usr'
make -C /lib/modules/3.5.0-23-generic/build SUBDIRS=/root/iscsitarget-1.4.20.2/kernel modules
make: *** /lib/modules/3.5.0-23-generic/build: No such file or directory.  Stop.
make: *** [kernel] Error 2
root@controller:~/iscsitarget-1.4.20.2# cd /lib/modules/3.5.0-23-generic/build/include/linux
-bash: cd: /lib/modules/3.5.0-23-generic/build/include/linux: No such file or directory
root@controller:~/iscsitarget-1.4.20.2# cd /lib/modules/3.5.0-23-generic/build/include/
-bash: cd: /lib/modules/3.5.0-23-generic/build/include/: No such file or directory
root@controller:~/iscsitarget-1.4.20.2# cd /lib/modules/3.5.0-23-generic/build/
-bash: cd: /lib/modules/3.5.0-23-generic/build/: No such file or directory

找不到/lib/modules/3.5.0-23-generic/build/include/linux/version.h

可以执行以下命令查看系统是否安装了kernel headers

ls /lib/modules/`uname -r`/build/include/linux/version.h

如果得到关于额米有这个文件的信息,比如:

ls: /lib/modules/2.6.15-23-386/build/include/linux/version.h: No such file or directory

这时,就需要安装headers

apt-get install linux-headers-`uname -r`