Makefile 错误:出现意外的行尾
尝试安装 Git,我运行了 configure 和 make,但收到以下错误消息:
make:阅读器中的致命错误:Makefile, 第 221 行:出现意外的行尾
Makefile 如下所示:
218: GIT-VERSION-FILE: FORCE
219: @$(SHELL_PATH) ./GIT-VERSION-GEN
220: -include GIT-VERSION-FILE
221:
222: uname_S := $(shell sh -c 'uname -s 2>/dev/null øø echo not')
是什么导致了错误?
以下信息可能相关,也可能不相关:
- 我尝试安装 Git 1.7.0.3 SunOS 5.9 (Solaris 9) 在我帐户的目录中。
- gcc 版本是 3.4.2(比 3.4.6 的版本由 sunfreeware.com)。
- 我没有root权限。
Trying to install Git, I ran configure and make, but got the following error message:
make: Fatal error in reader: Makefile,
line 221: Unexpected end of line seen
The Makefile looks like:
218: GIT-VERSION-FILE: FORCE
219: @$(SHELL_PATH) ./GIT-VERSION-GEN
220: -include GIT-VERSION-FILE
221:
222: uname_S := $(shell sh -c 'uname -s 2>/dev/null øø echo not')
What's causing the error?
The following information may or may not be relevant:
- I tried to install Git 1.7.0.3 on
SunOS 5.9 (Solaris 9) in a directory in my account. - The gcc version is 3.4.2 (older then the
version of 3.4.6 stated by
sunfreeware.com). - I don't have root privileges.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
在 SunOS 上使用
gmake
而不是make
为我解决了这个问题。Using
gmake
on SunOS instead ofmake
fixed this issue for me.使用
gmake
而不是make
。一般solaris有两个命令,
gmake
和make
。在此gmake
是GNU风格的make命令,而make
是solaris风格的make命令。我希望您已经用 GNU 风格编写了 makefile。因此使用 gmake 命令。Use
gmake
instead ofmake
.Genrally solaris has two command,
gmake
andmake
. In thisgmake
is GNU style make command, andmake
is solaris style make command. I hope you have written your makefile in GNU style. So usegmake
command.这可能是由于 makefile 中的 DOS 行结尾 (CRLF) 造成的。我刚刚遇到了类似的问题,并通过在 makefile 上运行 dos2unix 解决了它。 Linux make 似乎不受同一个 makefile 的影响。
This might be due to DOS line endings (CRLF) in your makefile. I have just had a similar problem and solved it by running dos2unix on the makefile. Linux make seems unfazed by the same makefile.
确保您确实已对该行进行了制表符并且并非全是空格。我遇到了这个问题,但我发现该命令未正确插入,这就是我遇到此错误的原因。
Make sure that you have actually tabbed the line and it is not all spaces. I had this issue but I found out the command was not properly tabbed in and that is why I was running into this error.
这是你的“make”的问题,安装“make-3.81.tar”然后尝试
Its a problem with your "make", install "make-3.81.tar" and then try
我用 2 个简单的 makefile 遇到了这个错误,其中一个正在工作,另一个产生了错误。
两者都有正确的制表符行,并且都有“CRLF”行结尾。
出于某种原因,我设法通过将行结尾更改为“LF”来解决问题,但我很困惑为什么另一个 makefile 被成功解析,即使它有“CRLF”结尾。然而,有一个线索:前一两次,“make”给出了另一个错误:
在文本编辑器中打开 makefile 并在末尾添加一行后,它开始产生 OP 的错误。
在这种情况下,最好有一个可以显示行结尾和制表符的编辑器。
I came to this error with 2 simple makefiles, one of which was working, and one which produced the error.
Both had properly tabbed lines, and both had "CRLF" line endings.
For one reason or another, I managed to fix the problem by changing the line endings to "LF", but I am confused as to why the other makefile was parsed successfully even though it had "CRLF" endings. There is, however, a clue: the first one or two times, "make" gave another error:
After opening the makefile in a text-editor, and adding a line ending at the end, it started producing the OP's error.
In this situation, it's good to have an editor that can display line endings and tabs.