Skip to content
This repository was archived by the owner on Nov 21, 2018. It is now read-only.

linux-cross: use glibc-2.14/gcc-4.8 for the arm toolchain #69

Merged
merged 5 commits into from
Mar 13, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions slaves/linux-cross/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ RUN apt-get install -y --force-yes --no-install-recommends \
curl make git wget file \
python-dev python-pip stunnel \
g++ gcc libc6-dev \
gcc-4.7-arm-linux-gnueabi libc6-dev-armel-cross \
gcc-4.7-arm-linux-gnueabihf libc6-dev-armhf-cross \
gcc-4.8-aarch64-linux-gnu libc6-dev-arm64-cross \
gcc-4.8-powerpc-linux-gnu libc6-dev-powerpc-cross \
gcc-4.8-powerpc64le-linux-gnu libc6-dev-ppc64el-cross \
Expand Down Expand Up @@ -38,6 +36,30 @@ RUN pip install buildbot-slave
RUN groupadd -r rustbuild && useradd -r -g rustbuild rustbuild
RUN mkdir /buildslave && chown rustbuild:rustbuild /buildslave

# Install arm cross compiler
WORKDIR /build
COPY linux-cross/build_arm_toolchain_root.sh /build/
RUN /bin/bash build_arm_toolchain_root.sh && chown rustbuild:rustbuild /build
RUN mkdir /x-tools && chown rustbuild:rustbuild /x-tools
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to chown? rustbuild shouldn't want to modify anything in these directories, right? It's fine to just run all the builds as root I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a catch here's that I forgot to mention. crosstool-ng can't be run as root, so we run it under the rustbuild user. That's the reason /x-tools directory needs to be writable by rustbuild.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha! makes sense to me, could you throw a comment here about that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you throw a comment here about that?

Sure!

COPY linux-cross/build_arm_toolchain.sh /build/
COPY linux-cross/arm-linux-gnueabi.config /build/
COPY linux-cross/arm-linux-gnueabihf.config /build/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can collapse these all into one COPY directive if you want

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed!

USER rustbuild
RUN /bin/bash build_arm_toolchain.sh arm-linux-gnueabi
RUN /bin/bash build_arm_toolchain.sh arm-linux-gnueabihf
USER root
RUN rm -rf /build
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've found that not having a bunch of intermediate artifacts can hugely reduce the size of docker containers, could this be done as part of each step? Some examples I've done in the past are:

RUN /bin/bash build_arm_toolchain.sh arm-linux-gnueabi && rm -rf /build

(or something like that)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've found that not having a bunch of intermediate artifacts can hugely reduce the size of docker containers

Great tip! I'll try to condense these commands as much as possible.


RUN \
for f in `ls /x-tools/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-*`; do \
g=`basename $f`; \
ln -vs $f /usr/bin/`echo $g | sed -e 's/-unknown//'`; \
done && \
for f in `ls /x-tools/arm-unknown-linux-gnueabihf/bin/arm-unknown-linux-gnueabihf-*`; do \
g=`basename $f`; \
ln -vs $f /usr/bin/`echo $g | sed -e 's/-unknown//'`; \
done

# When running this container, startup buildbot
WORKDIR /buildslave
USER rustbuild
Expand Down
Loading