-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dockerized LLVM #1914
Merged
Merged
Dockerized LLVM #1914
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d85985d
nudge
jackcmay 4469e61
Build with dockererized llvm
jackcmay d6b2e0f
optionally use docker
jackcmay a3fbfcf
cleanup
jackcmay 8cedc3d
move llvm, solana docker images to sdk
jackcmay f3eb95a
add dockers to sdk
jackcmay 71a7ac3
nudge
jackcmay 0d2c020
Document user must pull docker solanalabs/llvm
jackcmay File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
SDKPATH="$( cd "$(dirname "$0")" ; pwd -P )"/../../../.. | ||
docker run --workdir /solana_sdk --volume $SDKPATH:/solana_sdk --rm solanalabs/llvm `basename "$0"` "$@" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
SDKPATH="$( cd "$(dirname "$0")" ; pwd -P )"/../../../.. | ||
docker run --workdir /solana_sdk --volume $SDKPATH:/solana_sdk --rm solanalabs/llvm `basename "$0"` "$@" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
SDKPATH="$( cd "$(dirname "$0")" ; pwd -P )"/../../../.. | ||
docker run --workdir /solana_sdk --volume $SDKPATH:/solana_sdk --rm solanalabs/llvm `basename "$0"` "$@" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
SDKPATH="$( cd "$(dirname "$0")" ; pwd -P )"/../../../.. | ||
docker run --workdir /solana_sdk --volume $SDKPATH:/solana_sdk --rm solanalabs/llvm `basename "$0"` "$@" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
read -r -d '' SCRIPT << 'EOM' | ||
#!/usr/bin/env bash | ||
set -ex | ||
SDKPATH="$( cd "$(dirname "$0")" ; pwd -P )"/../../../.. | ||
docker run --workdir /solana_sdk --volume $SDKPATH:/solana_sdk --rm solanalabs/llvm `basename "$0"` "$@" | ||
EOM | ||
|
||
echo "$SCRIPT" > bin/clang | ||
echo "$SCRIPT" > bin/clang++ | ||
echo "$SCRIPT" > bin/llc | ||
echo "$SCRIPT" > bin/llvm-objdump |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# This docker file is based on the llvm docker file example located here: | ||
# https://github.com/llvm-mirror/llvm/blob/master/utils/docker/debian8/Dockerfile | ||
|
||
FROM launcher.gcr.io/google/debian8:latest as builder | ||
LABEL maintainer "Solana Maintainers" | ||
|
||
# Install build dependencies of llvm. | ||
# First, Update the apt's source list and include the sources of the packages. | ||
RUN grep deb /etc/apt/sources.list | \ | ||
sed 's/^deb/deb-src /g' >> /etc/apt/sources.list | ||
|
||
# Install compiler, python and subversion. | ||
RUN apt-get update && \ | ||
apt-get install -y \ | ||
--no-install-recommends \ | ||
ca-certificates gnupg \ | ||
build-essential \ | ||
python \ | ||
wget \ | ||
unzip \ | ||
git \ | ||
ssh && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Install a newer ninja release. It seems the older version in the debian repos | ||
# randomly crashes when compiling llvm. | ||
RUN wget "https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip" && \ | ||
echo "d2fea9ff33b3ef353161ed906f260d565ca55b8ca0568fa07b1d2cab90a84a07 ninja-linux.zip" \ | ||
| sha256sum -c && \ | ||
unzip ninja-linux.zip -d /usr/local/bin && \ | ||
rm ninja-linux.zip | ||
|
||
# Import public key required for verifying signature of cmake download. | ||
RUN gpg --no-tty --keyserver hkp://pgp.mit.edu --recv 0x2D2CEF1034921684 | ||
|
||
# Download, verify and install cmake version that can compile clang into /usr/local. | ||
# (Version in debian8 repos is too old) | ||
RUN mkdir /tmp/cmake-install && cd /tmp/cmake-install && \ | ||
wget "https://cmake.org/files/v3.7/cmake-3.7.2-SHA-256.txt.asc" && \ | ||
wget "https://cmake.org/files/v3.7/cmake-3.7.2-SHA-256.txt" && \ | ||
gpg --verify cmake-3.7.2-SHA-256.txt.asc cmake-3.7.2-SHA-256.txt && \ | ||
wget "https://cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.tar.gz" && \ | ||
( grep "cmake-3.7.2-Linux-x86_64.tar.gz" cmake-3.7.2-SHA-256.txt | \ | ||
sha256sum -c - ) && \ | ||
tar xzf cmake-3.7.2-Linux-x86_64.tar.gz -C /usr/local --strip-components=1 && \ | ||
cd / && \ | ||
rm -rf /tmp/cmake-install | ||
|
||
# ADD checksums /tmp/checksums | ||
# ADD scripts /tmp/scripts | ||
|
||
# Checkout the source code | ||
RUN git clone https://github.com/solana-labs/llvm.git && \ | ||
git clone https://github.com/solana-labs/clang.git llvm/tools/clang && \ | ||
git clone https://github.com/solana-labs/clang-tools-extra.git llvm/tools/clang/tools/extra && \ | ||
git clone https://github.com/solana-labs/lld.git llvm/tools/lld && \ | ||
git clone https://github.com/solana-labs/compiler-rt.git llvm/projects/compiler-rt | ||
|
||
RUN mkdir /llvm/build && \ | ||
cd /llvm/build && \ | ||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_INSTALL_PREFIX=$HOME/local -G "Ninja" .. && \ | ||
ninja -j6 && \ | ||
ninja install | ||
|
||
# Produce stage 2 docker with just the peices needed | ||
FROM launcher.gcr.io/google/debian8:latest | ||
LABEL maintainer "Solana Maintainers" | ||
COPY --from=builder root/local/bin /usr/local/bin |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
## Solana Customized LLVM | ||
|
||
This Docker contains LLVM binaries that incorporate customizations and fixes required | ||
by Solana but not yet upstreamed into the LLVM mainline. | ||
|
||
https://hub.docker.com/r/solanalabs/llvm/ | ||
|
||
### Usage: | ||
|
||
This Docker is optionally used by the SDK BPF build system. | ||
|
||
For more information: | ||
|
||
```bash | ||
$ make help | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
|
||
cd "$(dirname "$0")" | ||
|
||
docker build -t solanalabs/llvm . | ||
docker push solanalabs/llvm |
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably should document somewhere around here that the user needs to
docker pull solanalabs/llvm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't docker do that automagically if it does not find the docker locally?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nerp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about pull as part of the script or is that just wasteful?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ci/docker-run.sh
does this, but there's also cases when you don't want to pull (you're on an airplane with no uplink) so if we autopull then we'd also want to add a way to disable it. My vote for now is to just document that the user must pull