Stonecraft
Stonecraft

Reputation: 814

Errors building glibc: what is wrong with the make/confgure files?

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

Upvotes: 5

Views: 9059

Answers (3)

Rutcha
Rutcha

Reputation: 2029

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

Upvotes: 1

Alexander Samoylov
Alexander Samoylov

Reputation: 2578

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.

Upvotes: 3

MadScientist
MadScientist

Reputation: 101051

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).

Upvotes: 4

Related Questions