Fix glibc build prefix
Add ldd & ldconfig
This commit is contained in:
parent
cbc10c6bd1
commit
e12c5a3cfb
39
Dockerfile
39
Dockerfile
@ -22,26 +22,26 @@ RUN curl -fL https://github.com/javabean/su-exec/releases/download/${SU_EXEC_VER
|
|||||||
curl -fL https://github.com/krallin/tini/releases/download/${TINI_VER}/tini-amd64 > sbin/tini && \
|
curl -fL https://github.com/krallin/tini/releases/download/${TINI_VER}/tini-amd64 > sbin/tini && \
|
||||||
chmod +x sbin/su-exec sbin/tini
|
chmod +x sbin/su-exec sbin/tini
|
||||||
|
|
||||||
WORKDIR /tmp/glibc
|
WORKDIR /tmp/glibc/build
|
||||||
|
|
||||||
# Download and build glibc from source
|
# Download and build glibc from source
|
||||||
RUN curl -fL https://ftp.gnu.org/gnu/glibc/glibc-${GLIBC_VER}.tar.xz | tar xJ && \
|
RUN curl -fL https://ftp.gnu.org/gnu/glibc/glibc-${GLIBC_VER}.tar.xz \
|
||||||
mkdir -p glibc-build && cd glibc-build && \
|
| tar xJ --strip-components=1 -C .. && \
|
||||||
\
|
\
|
||||||
echo "slibdir=/lib" >> configparms && \
|
echo "slibdir=/lib" >> configparms && \
|
||||||
echo "rtlddir=/lib" >> configparms && \
|
echo "rtlddir=/lib" >> configparms && \
|
||||||
echo "sbindir=/bin" >> configparms && \
|
echo "sbindir=/bin" >> configparms && \
|
||||||
echo "rootsbindir=/bin" >> configparms && \
|
echo "rootsbindir=/sbin" >> configparms && \
|
||||||
|
echo "build-programs=yes" >> configparms && \
|
||||||
\
|
\
|
||||||
# Fix debian lib path weirdness
|
# Fix debian lib path weirdness
|
||||||
rm -rf /usr/include/${ARCH}-linux-gnu/c++ && \
|
rm -rf /usr/include/${ARCH}-linux-gnu/c++ && \
|
||||||
ln -s /usr/include/${ARCH}-linux-gnu/* /usr/include && \
|
|
||||||
\
|
\
|
||||||
../glibc-${GLIBC_VER}/configure \
|
exec >/dev/null && \
|
||||||
--prefix="$(pwd)/root" \
|
../configure \
|
||||||
--libdir="$(pwd)/root/lib" \
|
--prefix=/ \
|
||||||
|
--libdir="/lib" \
|
||||||
--libexecdir=/lib \
|
--libexecdir=/lib \
|
||||||
--with-headers=/usr/include \
|
|
||||||
--enable-add-ons \
|
--enable-add-ons \
|
||||||
--enable-obsolete-rpc \
|
--enable-obsolete-rpc \
|
||||||
--enable-kernel=3.10.0 \
|
--enable-kernel=3.10.0 \
|
||||||
@ -53,12 +53,23 @@ RUN curl -fL https://ftp.gnu.org/gnu/glibc/glibc-${GLIBC_VER}.tar.xz | tar xJ &&
|
|||||||
--enable-multi-arch \
|
--enable-multi-arch \
|
||||||
--disable-werror && \
|
--disable-werror && \
|
||||||
make -j "$(nproc)" && \
|
make -j "$(nproc)" && \
|
||||||
make install_root=$(pwd)/out install
|
make -j "$(nproc)" install_root="$(pwd)/out" install
|
||||||
|
|
||||||
# Copy glibc libs & generate ld cache
|
# Strip binaries to reduce their size
|
||||||
RUN cp -d glibc-build/out/lib/*.so "${PREFIX}/lib" && \
|
RUN apt-get install -y file && \
|
||||||
echo '/usr/lib' > "${PREFIX}/etc/ld.so.conf" && \
|
find out/{s,}bin -exec file {} \; | grep -i elf \
|
||||||
ldconfig -r "${PREFIX}"
|
| sed 's|^\(.*\):.*|\1|' | xargs strip -s && \
|
||||||
|
\
|
||||||
|
# Patch ldd to use sh not bash
|
||||||
|
sed -i '1s/.*/#!\/bin\/sh/' out/bin/ldd && \
|
||||||
|
# Copy glibc libs & generate ld cache
|
||||||
|
cp -d out/lib/*.so "${PREFIX}/lib" && \
|
||||||
|
cp -d out/bin/ldd "${PREFIX}/bin" && \
|
||||||
|
cp -d out/sbin/ldconfig "${PREFIX}/sbin" && \
|
||||||
|
\
|
||||||
|
echo /usr/lib > "${PREFIX}/etc/ld.so.conf" && \
|
||||||
|
ldconfig -r "${PREFIX}" && \
|
||||||
|
ldconfig -r "${PREFIX}" -p
|
||||||
|
|
||||||
WORKDIR /tmp/busybox
|
WORKDIR /tmp/busybox
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user