Last active
July 6, 2016 10:15
-
-
Save dyerti/0afc38e42106b8f7ed5bbff8d7430968 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM alpine:3.4 | |
ENV RUST_VERSION 1.9.0 | |
RUN apk add --no-cache 'curl' | |
# TODO: Verify download. | |
RUN curl -LOsS https://static.rust-lang.org/dist/rustc-${RUST_VERSION}-src.tar.gz \ | |
&& ls -l \ | |
&& tar -xzvf rustc-${RUST_VERSION}-src.tar.gz \ | |
&& cd rustc-${RUST_VERSION}/ \ | |
&& sed -i -e 's/v3\.4/edge/g' /etc/apk/repositories \ | |
&& apk add --no-cache --virtual '.build-deps' \ | |
'tree' \ | |
'python' \ | |
'file' \ | |
'make' \ | |
'g++' \ | |
'llvm-dev' \ | |
'musl-dev' \ | |
'libunwind-dev' \ | |
'libc6-compat' \ | |
'llvm-libs' \ | |
'llvm-static' \ | |
'zlib-dev' \ | |
'libffi-dev' | |
RUN curl -LsSo /glibc.tar.xz https://www.archlinux.org/packages/core/x86_64/glibc/download/ \ | |
&& mkdir /glibc \ | |
&& tar xvf /glibc.tar.xz -C /glibc | |
ADD glibc.patch /glibc.patch | |
ADD libpath.patch /libpath.patch | |
ADD ffi.patch /ffi.patch | |
RUN cd rustc-${RUST_VERSION}/ \ | |
# HACK: needed to run stage0 in Alpine | |
&& patch -p0 < /glibc.patch \ | |
&& patch -p0 < /libpath.patch \ | |
# Needed when using --llvm-root | |
&& patch -p0 < /ffi.patch \ | |
&& ./configure --disable-docs --disable-codegen-tests --disable-jemalloc --enable-dist-host-only --enable-llvm-static-stdcpp --llvm-root=/usr --prefix=/usr | |
RUN cd rustc-${RUST_VERSION}/ \ | |
# HACK: build stage1 from a glibc stage0 | |
&& LD_LIBRARY_PATH=/glibc/usr/lib:/lib make -j8 rustc-stage1 | |
#&& make -j4 install | |
RUN cd rustc-${RUST_VERSION}/ \ | |
&& LD_LIBRARY_PATH=/glibc/usr/lib:/lib make -j8 install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- src/librustc_llvm/lib.rs.old | |
+++ src/librustc_llvm/lib.rs | |
@@ -565,6 +565,7 @@ | |
// automatically updated whenever LLVM is updated to include an up-to-date | |
// set of the libraries we need to link to LLVM for. | |
#[link(name = "rustllvm", kind = "static")] | |
+#[link(name = "ffi")] | |
#[cfg(not(cargobuild))] | |
extern {} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- mk/main.mk.old | |
+++ mk/main.mk | |
@@ -461,7 +461,7 @@ | |
ifeq ($(1),0) | |
# Don't run the stage0 compiler under valgrind - that ship has sailed | |
-CFG_VALGRIND_COMPILE$(1) = | |
+CFG_VALGRIND_COMPILE$(1) = /glibc/usr/lib/ld-2.23.so | |
else | |
CFG_VALGRIND_COMPILE$(1) = $$(CFG_VALGRIND_COMPILE) | |
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- mk/main.mk.old | |
+++ mk/main.mk | |
@@ -179,6 +179,7 @@ | |
# have to worry about the distribution of one file (with its native dynamic | |
# dependencies) | |
RUSTFLAGS_STAGE0 += -C prefer-dynamic -C no-stack-check | |
+RUSTFLAGS_STAGE0 += -L x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib | |
RUSTFLAGS_STAGE1 += -C prefer-dynamic | |
RUST_LIB_FLAGS_ST2 += -C prefer-dynamic | |
RUST_LIB_FLAGS_ST3 += -C prefer-dynamic |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment