I'm trying to compile the NIST Biometric Image Software, and I have been having trouble all day. I finally got the source checked out right, and I installed cygwin with no problems (I have used it in the past), but when I went to compile, I get this error:
我正在编写NIST的生物特征图像软件,我一整天都有麻烦。我最终检查了源代码,并安装了cygwin,没有任何问题(我以前用过它),但是当我去编译时,我得到了这个错误:
$ sh setup.sh </cygdrive/c/NBIS> [--without-X11]
setup.sh: line 94: syntax error near unexpected token `$'in\r''
'etup.sh: line 94: ` case $1 in
Now I'm sure any advanced coder would head to the setup.sh and look for problems, but I'm not really much of a coder (I'm only compiling this because there are no pre-compiled packages) so I don't know what to do. I didn't install any libraries with cygwin, I just left everything default. I'm trying to follow the NBIS manual, but I don't really understand it that well and so I'm struggling badly. Maybye taking a look at it you may notice something I missed: http://www.nist.gov/customcf/get_pdf.cfm?pub_id=51097
现在我确信任何高级的编码器都将进入这个设置。sh和查找问题,但是我不是一个真正的程序员(我只是编译这个,因为没有预编译的包),所以我不知道该怎么做。我没有安装有cygwin的库,我只是把所有的东西都默认了。我试着遵循NBIS手册,但是我不太理解它,所以我很挣扎。也许你会注意到我漏掉了什么:http://www.nist.gov/customcf/get_pdf.cfm?
5 个解决方案
#1
42
To convert setup.sh
to Unix line endings on Cygwin, use
将设置。使用Cygwin的sh到Unix行结束符
dos2unix setup.sh
#2
22
run
运行
sed -i 's/\r//' setup.sh
to fix your line endings
修正你的行尾
#3
10
Easy way to convert example.sh file to unix is use NotePad++ (Edit>EOL Conversion>UNIX/OSX Format)
转换示例的简单方法。sh文件到unix是使用NotePad++(编辑>EOL转换> unix /OSX格式)
You can also set the default EOL in notepad++ (Settings>Preferences>New Document/Default Directory>select Unix/OSX under the Format box)
您还可以在notepad++中设置默认的EOL(设置>首选项>新文档/默认目录>在Format框下选择Unix/OSX)
#4
8
Windows uses two characters (CR and LF, or \r\n
) to mark the end of a line in a text file. Unix, Linux, and (by default) Cygwin use a single LF or '\n' character. Some Cygwin tools are able to deal with either format, but sh typically can't.
Windows使用两个字符(CR和LF,或\r\n)来标记文本文件中一行的末尾。Unix、Linux和Cygwin(默认情况下)使用一个LF或'\n'字符。一些Cygwin工具可以处理这两种格式,但是sh通常不能。
It looks like setup.sh
uses Windows-style line endings -- or at least line 94 does.
它看起来像设置。sh使用windows风格的行尾——或者至少是第94行。
I didn't find the download for the sources, but if they're distributed as a zip file, you might need to extract them using the Cygwin unzip
command with the -a
option, so any line endings are automatically converted.
我没有找到源文件的下载,但是如果它们是作为zip文件分发的,您可能需要使用Cygwin unzip命令和-a选项来提取它们,因此任何行结尾都将自动转换。
But I suspect there's more to it than that. The distributed setup.sh
file shouldn't have had any Windows-style line endings in the first place, and if it did, I don't know why the problem wouldn't show up until line 94.
但我怀疑还有更多的原因。分布式安装。sh文件一开始不应该有任何windows风格的行结尾,如果有,我不知道为什么问题直到第94行才出现。
If you can post the URL for the source download, I'll take a look at setup.exe
.
如果您可以发布源下载的URL,我将查看setup.exe。
#5
0
Tell Cygwin bash to ignore CR characters:
告诉Cygwin bash忽略CR字符:
set -o igncr
(from https://*.com/a/14607651/1098603)
(来自https://*.com/a/14607651/1098603)
Note that igncr
is specific to Cygwin and will fail on Linux, as indicated by @KeithThompson.
请注意,igncr是针对Cygwin的,并且会在Linux上失败,如@KeithThompson所示。
#1
42
To convert setup.sh
to Unix line endings on Cygwin, use
将设置。使用Cygwin的sh到Unix行结束符
dos2unix setup.sh
#2
22
run
运行
sed -i 's/\r//' setup.sh
to fix your line endings
修正你的行尾
#3
10
Easy way to convert example.sh file to unix is use NotePad++ (Edit>EOL Conversion>UNIX/OSX Format)
转换示例的简单方法。sh文件到unix是使用NotePad++(编辑>EOL转换> unix /OSX格式)
You can also set the default EOL in notepad++ (Settings>Preferences>New Document/Default Directory>select Unix/OSX under the Format box)
您还可以在notepad++中设置默认的EOL(设置>首选项>新文档/默认目录>在Format框下选择Unix/OSX)
#4
8
Windows uses two characters (CR and LF, or \r\n
) to mark the end of a line in a text file. Unix, Linux, and (by default) Cygwin use a single LF or '\n' character. Some Cygwin tools are able to deal with either format, but sh typically can't.
Windows使用两个字符(CR和LF,或\r\n)来标记文本文件中一行的末尾。Unix、Linux和Cygwin(默认情况下)使用一个LF或'\n'字符。一些Cygwin工具可以处理这两种格式,但是sh通常不能。
It looks like setup.sh
uses Windows-style line endings -- or at least line 94 does.
它看起来像设置。sh使用windows风格的行尾——或者至少是第94行。
I didn't find the download for the sources, but if they're distributed as a zip file, you might need to extract them using the Cygwin unzip
command with the -a
option, so any line endings are automatically converted.
我没有找到源文件的下载,但是如果它们是作为zip文件分发的,您可能需要使用Cygwin unzip命令和-a选项来提取它们,因此任何行结尾都将自动转换。
But I suspect there's more to it than that. The distributed setup.sh
file shouldn't have had any Windows-style line endings in the first place, and if it did, I don't know why the problem wouldn't show up until line 94.
但我怀疑还有更多的原因。分布式安装。sh文件一开始不应该有任何windows风格的行结尾,如果有,我不知道为什么问题直到第94行才出现。
If you can post the URL for the source download, I'll take a look at setup.exe
.
如果您可以发布源下载的URL,我将查看setup.exe。
#5
0
Tell Cygwin bash to ignore CR characters:
告诉Cygwin bash忽略CR字符:
set -o igncr
(from https://*.com/a/14607651/1098603)
(来自https://*.com/a/14607651/1098603)
Note that igncr
is specific to Cygwin and will fail on Linux, as indicated by @KeithThompson.
请注意,igncr是针对Cygwin的,并且会在Linux上失败,如@KeithThompson所示。