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

时间:2023-05-10 21:59:56

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

执行到make步骤时,出错:

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

这时,就需要安装headers

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