1

I am having some trouble to compile GCC. When I try to compile it, this error appears:

Makefile:26: *** missing separator. Stop.

The line 26 refers to the first line of this condition:

@if gcc
ifeq (,$(.VARIABLES)) # The variable .VARIABLES, new with 3.80, is never empty.
$(error GNU make version 3.80 or newer is required.)
endif
@endif gcc

I already tried to insert a TAB between the keywords but it didn't work. The only thing I tried and seems to work is to change the condition to:

ifeq ($(gcc),)
ifeq (,$(.VARIABLES)) # The variable .VARIABLES, new with 3.80, is never empty.
$(error GNU make version 3.80 or newer is required.)
endif
endif

Informations:

Make log: http://pastebin.com/t5eNYJd5

Make log (after changing the condition): http://pastebin.com/HHjQKdDx

My make version is: 4.0.

GCC version I am trying to build: 5.2.0

I am using fedora 22.

I've got a workaround. The problem is that the Makefile contains hundreds of '@if', therefore, I would like to know why is it using '@if' if they do not work ?

Thanks in advance.

7
  • Since you've got a solution, and one which the GNU make manual on conditionals suggests is the correct solution, why is there a question — or what is the question? You normally use @ to conceal an action in a recipe; I'm not sure it has an alternative significance in GNU make; the index for @ suggests not. Sep 12, 2015 at 20:37
  • Yes I've got a workaround. The problem is that the Makefile contains hundreds of '@if', therefore, I would like to know why is it using '@if' if they do not work ? Sep 12, 2015 at 20:46
  • This isn't really the place to ask why the GCC build system does what it does. You should go to a GCC-specific forum, or create a bug. I'm not sure which of the many makefiles in GCC it is that you're using; you've not stated which version of GCC you're building. I've had to futz with an awk script in 5.2.0 (and 5.1.0) on Mac, but I'm not sufficiently sure I know what's supposed to be happening to have created a bug report (though I probably will, especially if another version comes out without a fix). Sep 12, 2015 at 20:47
  • Superficially, all that you need to do is change ^@if to if , and @endif to endif. OTOH, maybe that's an indication of some other operation having failed — maybe that @if notation should have been preprocessed out, but something went wrong with that step. I don't keep build directories for GCC around for very long; I don't have one at the moment. (I've just started a build of 5.2.0 on Mac OS X 10.10.5 because it failed the last time I tried; so far, so good, but it's only been a couple of minutes so far). You've not stated which platform you're building on either. Sep 12, 2015 at 20:54
  • Done. I added more information; Sep 12, 2015 at 21:50

1 Answer 1

1

I stumbled upon this same problem. This question is a little old and it looks like you found a workaround, but I'll document my findings here as well for the People of the Future.

Background

GCC currently requires you to perform an out-of-source build. Based on the commands shown, some of the documentation and online QA implies that this is valid:

svn checkout svn://gcc.gnu.org/svn/gcc/trunk gcc;
gcc/configure <configure options>;
make -j 8 && make install;

This nests the source directory in the build directory, but I would expect that to count as "out-of-source." Running without -j 8 still produced the problem. I did this on a RHEL6 system, using GNU make 4.2. I was attempting to build GCC 8.0.0.

Solution

I found that making the source and build directories adjacent rather than creating builddir/sourcedir resolved the problem.

Additional info

Here's are relevant snippets from the GCC build instructions:

We use srcdir to refer to the toplevel source directory for GCC; we use objdir to refer to the toplevel build/object directory.

...

If you obtained the sources via SVN, srcdir must refer to the top gcc directory, the one where the MAINTAINERS file can be found, and not its gcc subdirectory, otherwise the build will fail.

...

First, we highly recommend that GCC be built into a separate directory from the sources which does not reside within the source tree. This is how we generally build GCC; building where srcdir == objdir should still work, but doesn’t get extensive testing; building where objdir is a subdirectory of srcdir is unsupported.

Depending on your definition of "source tree", these instructions may or may not proscribe building the way I first attempted. They should probably be updated to clarify this case.

As to the specific reason that Makefile won't run, that snippet is not valid make syntax - if is not a make keyword, and referenced variables must be enclosed like so: $(varname). @ simply prevents the command from being echoed.

Rather, this is supposed to be multiline interpolated bash. This StackOverflow answer shows this being done in a Makefile, but it's done as part of a recipe. I see no evidence that this is valid as a standalone entity.

In the correctly-generated Makefile, the section you posted is absent, and all interpolated bash appears in a recipe.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.