Makefile error: Unexpected end of line seen
Solution 1
Using gmake
on SunOS instead of make
fixed this issue for me.
Solution 2
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.
Solution 3
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.
Solution 4
Its a problem with your "make", install "make-3.81.tar" and then try
Solution 5
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.
Winston C. Yang
Updated on June 05, 2022Comments
-
Winston C. Yang about 2 years
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.
-
Cascabel about 14 yearsThe make version would be more relevant than the gcc version. Perhaps it's too old to support the
-include
directive? -
Jonathan Leffler about 14 years@Jefromi: or it isn't GNU Make...the Sun Make probably does not understand '-include' - and will be expecting either a colon or an equals sign on line 220 (since it can't be a command because the first character is not a tab), and all other lines are comments, rules (with a colon) or macros (with an equals) and line 220 doesn't fit any of those.
-
mark4o about 14 yearsIf your Makefile really says
øø
then it somehow became corrupted. It should be||
. Try downloading again. -
Jonathan Leffler about 14 years@mark4o: maybe Winston is working with a Scandinavian (Danish?) code set where ø appears at the code point where | appears in 8859-1.
-
Winston C. Yang about 14 years@ Jefromi, Jonathan Leffler: Here is the information about make: RELEASE VERSION SunOS 5.9 Patch 111703-03 October 2002. @mark4o, Jonathan Leffler: I don't know how the || got changed. Maybe from copying and pasting, or I hit the wrong keys. After your comments, I used gmake (3.80, from 2002) and got error messages about include files and openssl. Do I have to ask root to install dependencies? Or can I install them locally and tell gmake where to look for them?
-
Winston C. Yang about 14 years@Diavolche: Only the beginning of Line 219 in the code excerpt has a tab.
-
vesperto over 8 yearsIn my case the line wasn't properly indented (should start with a tab). Why this was -1'ed is beyond me.
-
jim about 8 yearsalso change the line "= cc" to instead be "= gcc"
-
rashok about 4 yearsSame answer already answered before you. stackoverflow.com/questions/2557787/…