Make error: missing separator

227,928

Solution 1

As indicated in the online manual, the most common cause for that error is that lines are indented with spaces when make expects tab characters.

Correct

target: 
\tcmd

where \t is TAB (U+0009)

Wrong

target:
....cmd

where each . represents a SPACE (U+0020).

Solution 2

Just for grins, and in case somebody else runs into a similar error:

I got the infamous "missing separator" error because I had invoked a rule defining a function as

($eval $(call function,args))

rather than

$(eval $(call function,args))

i.e. ($ rather than $(.

Solution 3

This is a syntax error in your Makefile. It's quite hard to be more specific than that, without seeing the file itself, or relevant portion(s) thereof.

Solution 4

For me, the problem was that I had some end-of-line # ... comments embedded within a define ... endef multi-line variable definition. Removing the comments made the problem go away.

Solution 5

My error was on a variable declaration line with a multi-line extension. I have a trailing space after the "\" which made that an invalid line continuation.

MY_VAR = \
   val1 \ <-- 0x20 there caused the error.
   val2
Share:
227,928

Related videos on Youtube

Wesley Reed
Author by

Wesley Reed

want to know the real facts.

Updated on December 28, 2021

Comments

  • Wesley Reed
    Wesley Reed over 1 year

    I am getting the following error running make:

    Makefile:168: *** missing separator.  Stop.
    

    What is causing this?

  • user35443
    user35443 almost 7 years
    What? :) I guess you didn't have 0x20 "space" there, is that correct?
  • smac89
    smac89 over 6 years
    @user35443 The placement of $
  • aseq
    aseq over 6 years
    You can use .RECIPEPREFIX to change the character make uses. See: gnu.org/software/make/manual/html_node/…
  • ynn
    ynn over 3 years
    Thank you. I didn't know comments in define directive are treated literally. Actually the behavior is not explain in the documentation. (For clarity: Embedding a number sign # within the directive isn't itself a syntax error. But it is just not interpreted as a start of a comment, so doing that is admittedly error-prone.)
  • Teodor Hirs
    Teodor Hirs over 2 years
    completely not understandable answer, not applicable to the question in any way
  • Tejas Shetty
    Tejas Shetty over 1 year
    Please elaborate
  • cpurdy
    cpurdy about 1 year
    To confirm, I just ran into this myself. Most editors/IDEs can help spot this. For example, in IDEA, go to the View menu, choose "Active Editor", "Show Whitespaces". I can't believe that spaces vs. tabs is still a thing in (checks notes) 2022.