Makefile 错误:出现意外的行尾

发布于 2024-08-27 04:07:07 字数 558 浏览 10 评论 0原文

尝试安装 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

行雁书 2024-09-03 04:07:07

在 SunOS 上使用 gmake 而不是 make 为我解决了这个问题。

Using gmake on SunOS instead of make fixed this issue for me.

墨落画卷 2024-09-03 04:07:07

使用 gmake 而不是 make

一般solaris有两个命令,gmakemake。在此gmake是GNU风格的make命令,而make是solaris风格的make命令。我希望您已经用 GNU 风格编写了 makefile。因此使用 gmake 命令。

Use gmake instead of make.

Genrally solaris has two command, gmake and make. In this gmake is GNU style make command, and make is solaris style make command. I hope you have written your makefile in GNU style. So use gmake command.

千鲤 2024-09-03 04:07:07

这可能是由于 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.

转瞬即逝 2024-09-03 04:07:07

确保您确实已对该行进行了制表符并且并非全是空格。我遇到了这个问题,但我发现该命令未正确插入,这就是我遇到此错误的原因。

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.

仙女山的月亮 2024-09-03 04:07:07

这是你的“make”的问题,安装“make-3.81.tar”然后尝试

Its a problem with your "make", install "make-3.81.tar" and then try

私野 2024-09-03 04:07:07

我用 2 个简单的 makefile 遇到了这个错误,其中一个正在工作,另一个产生了错误。

两者都有正确的制表符行,并且都有“CRLF”行结尾。

出于某种原因,我设法通过将行结尾更改为“LF”来解决问题,但我很困惑为什么另一个 makefile 被成功解析,即使它有“CRLF”结尾。然而,有一个线索:前一两次,“make”给出了另一个错误:

mksh: Warning: newline is not last character...

在文本编辑器中打开 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:

mksh: Warning: newline is not last character...

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文