5

I have been trying to build glibc on Clear Linux, with a previous issue discussed here: How do I build into a specified directory using the "prefix" option of configure?

Now that I have succeeded in running configure, there seems to be something wrong in the makefile:

james@clr ~/Downloads/glibc $ make
Makeconfig:42: *** missing separator.  Stop.

line 42 of Makeconfig:

objdir must be defined by the build-directory Makefile.

and the nakefile up to the point of error:

ifneq (,)
This makefile requires GNU Make.
endif

all: # Make this the default goal

ifneq "$(origin +included-Makeconfig)" "file"

+included-Makeconfig := yes

ifdef subdir
.. := ../
endif

# $(common-objdir) is the place to put objects and
# such that are not specific to a single subdir.
ifdef objdir
objpfx := $(patsubst %//,%/,$(objdir)/$(subdir)/)
common-objpfx = $(objdir)/
common-objdir = $(objdir)
else
objdir must be defined by the build-directory Makefile.
endif

I have GNU Make 4.2.1

MadScientist
  • 92,819
  • 9
  • 109
  • 136
Stonecraft
  • 860
  • 1
  • 12
  • 30
  • 1
    You should definitely not replace all tabs with spaces. You should also definitely not put a TAB at the beginning of each line. You should TABs only in places where they are needed and not use them in places where they are not needed. Since you haven't provided us with any information about your situation there's little we can do to help you. I suggest you go back to the first file you had, and if you still see the "missing separator" error you post here the lines related to that error; in the first error message above it's complaining about line 42 in the file Makeconfig. – MadScientist Jun 28 '18 at 02:52
  • 1
    Post here (using proper formatting for SO) the line that is reported by make as having an error and some lines before and after it for context. Then we can help you understand what might be wrong with those lines. – MadScientist Jun 28 '18 at 02:53
  • Thanks, I edited my question to include the lines, – Stonecraft Jun 28 '18 at 06:28
  • 1
    @Thoughtcraft so did you solve this problem? I face it too and can't figure out solution from this accepted answer :) – Mikhail_Sam May 30 '19 at 18:05

3 Answers3

4

You're seeing an error because this makefile thinks your environment is wrong. The line in the makefile that you're running is purposefully a syntax error: no amount of editing these lines will change it into a correct line because its entire purpose is to force make to fail when it sees an invalid configuration.

The error it's trying to tell you about is right there in the text:

objdir must be defined by the build-directory Makefile.

The makefile checks to see if the objdir variable is defined and if not, it falls through to this invalid syntax.

I haven't tried to build glibc myself in quite a while so I can't say exactly what that means but I'm sure if you Google that error message you'll find some information that will let you move forward.

It's too bad that this makefile doesn't use more readable ways of specifying errors such as the $(error ...) function (added in GNU make 3.78, released in 1999).

MadScientist
  • 92,819
  • 9
  • 109
  • 136
  • You are correct, it seems that objdir was defined as the current working directory in another makefile upstream, and that there were earlier errors that caused that, It seems I will have to create another question to address those. – Stonecraft Jun 29 '18 at 04:06
1

libc forbids building from the source root directory. It is worth to read the INSTALL file (you find it in the source root as well):

The GNU C Library cannot be compiled in the source directory. You must build it in a separate build directory. For example, if you have unpacked the GNU C Library sources in '/src/gnu/glibc-VERSION', create a directory '/src/gnu/glibc-build' to put the object files in. This allows removing the whole build directory in case an error occurs, which is the safest way to get a fresh start and should always be done.

On the practice it means you should run configure and make being in the build directory (you should create it by yourself), for example:

glibc-x.xx/build> ../configure "CFLAGS=-m64 -O2" "CXXFLAGS=-m64" "LDFLAGS=-m64" --prefix=$HOME/glibc-x.xx-bin
glibc-x.xx/build> make all install

The error message which you get means glibc-x.xx/Makefile wants to be called from some parent Makefile which must be glibc-x.xx/build/Makefile generated by configure.

Alexander Samoylov
  • 2,358
  • 2
  • 25
  • 28
1

considering the source is in "~/Downloads/glibc", then

create a build folder somewhere else, like "~/Downloads/glibc-build", cd to it, then run configure from that folder, like "../glibc/configure". It will likely go wrong, do some error and display error.

The easy fix is run same configure ( ../glibc/configure, from inside ~/Downloads/glibc-build ) but now with the option " --disable-sanity-checks ". That will likely produce a Makefile. Now run 'make'.

If you're building an old glibc, try an old gcc version from the same age, as usually code written for a certain compiler version only builds for those compiler versions. Good luck

Marcelo Ruggeri
  • 1,939
  • 1
  • 17
  • 10