Reputation: 760
I'm trying to build the latest version of glibc (2.22). I've not modified any sources of glibc. On my x86_64 Ubuntu 14.04.1 machine I'm using the following extract of a makefile to build:
HOST ?= x86_64-linux-gnu
TARGET ?= x86_64-linux-gnu
CROSS_OUT = $(shell pwd)/$(TARGET)
CC ?= gcc
CXX ?= g++
LD ?= ld
[...]
CFLAGS ?= "-I$(CROSS_OUT)/include -L$(CROSS_OUT)/lib"
CXXFLAGS ?= "-I$(CROSS_OUT)/include -L$(CROSS_OUT)/lib"
CPPFLAGS ?= "-I$(CROSS_OUT)/include -L$(CROSS_OUT)/lib"
LDFLAGS ?= "-I$(CROSS_OUT)/include -L$(CROSS_OUT)/lib"
[...]
GLIBC_PATH=$(shell pwd)/glibc
GLIBC_BUILD_PATH=$(shell pwd)/glibc-build
glibc: glibc-clean
mkdir -p $(GLIBC_BUILD_PATH)
cd $(GLIBC_BUILD_PATH) && \
CC=$(CC) \
CXX=$(CXX) \
LD=$(LD) \
CFLAGS=$(CFLAGS) \
CXXFLAGS=$(CXXFLAGS) \
CPPFLAGS=$(CPPFLAGS) \
LDFLAGS=$(LDFLAGS) \
$(GLIBC_PATH)/configure \
--host=$(TARGET) \
--build=$(HOST) \
--prefix=$(CROSS_OUT) \
--disable-shared \
--enable-add-ons \
--enable-static-nss && \
make && \
make install
glibc-clean:
rm -r -f $(GLIBC_BUILD_PATH)
Make stops nearly immediatly with the following error:
In file included from <command-line>:0:0:
../include/stdc-predef.h:64:1: fatal error: /home/leon/reaper/glibc-build/libc-modules.h: No such file or directory
#endif
^
compilation terminated.
Unfortunately, the file definitely doesn't exist.
Upvotes: 1
Views: 3400
Reputation: 1841
In met the same error when I used --disable-shared option for configure
.
When I removed the option, the build passed correctly.
I also use -fno-stack-protector -U_FORTIFY_SOURCE
in CFLAGS according to glibc FAQ (my OS is Debian).
Also this topic was helpful to set up environment:
https://lists.debian.org/debian-user/2015/07/msg00120.html
This is my script for build glibc:
#!/bin/bash
# sudo aptitude install linux-headers-$(uname -r)
# sudo aptitude install build-essentials
# sudo aptitude install gawk
export CFLAGS="-fPIC -O2 -fno-stack-protector -U_FORTIFY_SOURCE"
mkdir glibc-build
cd glibc-build
../glibc-2.23/configure --disable-werror --prefix=/home/alexey/projects/work/build-dir/glibc-prefix
make
Upvotes: 2
Reputation: 5899
If you want to build an alien libc6 / an extra libc6, the build of glibc-2.22 is described here http://www.linuxfromscratch.org/lfs/view/stable/chapter05/glibc.html
Ref. http://www.linuxfromscratch.org/lfs/view/stable/
Suggest : --prefix=/opt/glibc222
The header 'libc-modules.h' is a generated header. Appears when configuring is done the right way.
Upvotes: 0
Reputation: 2316
Try installing these:
$ sudo apt-get install build-essential
$ sudo apt-get install libc6
And link from where you got that source code please.
Upvotes: 0