-
-
Notifications
You must be signed in to change notification settings - Fork 338
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Small improvements to the devcontainer (#2522)
* feat: revert now unecessary workaround, use rust-lang.rust-analyzer * fix: specify llvm version and symlink llvm. Thanks @tokatoka * fix: pass the llvm version to createAliases.sh * fix: shell script lints * fix: shell script lints * feat: use cargo binstall to make the container build faster
- Loading branch information
1 parent
37f2d2d
commit 69941f2
Showing
3 changed files
with
37 additions
and
9 deletions.
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 |
---|---|---|
|
@@ -3,8 +3,10 @@ FROM rust:1.76.0 AS libafl | |
LABEL "maintainer"="afl++ team <[email protected]>" | ||
LABEL "about"="LibAFL Docker image" | ||
|
||
# Install cargo-binstall to download the sccache build | ||
RUN curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash | ||
# install sccache to cache subsequent builds of dependencies | ||
RUN cargo install --locked sccache | ||
RUN cargo binstall --no-confirm sccache | ||
|
||
ENV HOME=/root | ||
ENV SCCACHE_CACHE_SIZE="1G" | ||
|
@@ -22,12 +24,11 @@ RUN rustup component add rustfmt clippy | |
# Install clang 18, common build tools | ||
ENV LLVM_VERSION=18 | ||
RUN apt update && apt install -y build-essential gdb git wget python3-venv ninja-build lsb-release software-properties-common gnupg cmake | ||
# Workaround until https://github.com/llvm/llvm-project/issues/62475 is resolved | ||
RUN set -ex &&\ | ||
echo "deb http://apt.llvm.org/bookworm/ llvm-toolchain-bookworm-${LLVM_VERSION} main" > /etc/apt/sources.list.d/apt.llvm.org.list &&\ | ||
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc &&\ | ||
apt update &&\ | ||
apt-get install -y clang-${LLVM_VERSION} lldb-${LLVM_VERSION} lld-${LLVM_VERSION} clangd-${LLVM_VERSION} clang-tidy-${LLVM_VERSION} clang-format-${LLVM_VERSION} clang-tools-${LLVM_VERSION} llvm-${LLVM_VERSION}-dev lld-${LLVM_VERSION} lldb-${LLVM_VERSION} llvm-${LLVM_VERSION}-tools libomp-${LLVM_VERSION}-dev libc++-${LLVM_VERSION}-dev libc++abi-${LLVM_VERSION}-dev libclang-common-${LLVM_VERSION}-dev libclang-${LLVM_VERSION}-dev libclang-cpp${LLVM_VERSION}-dev libunwind-${LLVM_VERSION}-dev libclang-rt-${LLVM_VERSION}-dev libpolly-${LLVM_VERSION}-dev | ||
wget https://apt.llvm.org/llvm.sh &&\ | ||
chmod +x llvm.sh &&\ | ||
./llvm.sh ${LLVM_VERSION} | ||
|
||
|
||
# Copy a dummy.rs and Cargo.toml first, so that dependencies are cached | ||
WORKDIR /libafl | ||
|
@@ -39,6 +40,10 @@ COPY scripts/dummy.rs libafl_derive/src/lib.rs | |
COPY libafl/Cargo.toml libafl/build.rs libafl/README.md libafl/ | ||
COPY scripts/dummy.rs libafl/src/lib.rs | ||
|
||
# Set up LLVM aliases | ||
COPY scripts/createAliases.sh libafl/ | ||
RUN bash libafl/createAliases.sh ${LLVM_VERSION} | ||
|
||
COPY libafl_bolts/Cargo.toml libafl_bolts/build.rs libafl_bolts/README.md libafl_bolts/ | ||
COPY libafl_bolts/examples libafl_bolts/examples | ||
COPY scripts/dummy.rs libafl_bolts/src/lib.rs | ||
|
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,20 @@ | ||
#!/bin/bash | ||
|
||
# creates a symbolic link from bin-x.x to bin | ||
# This just strips off last 3 characters when creating a link | ||
|
||
LLVMFILES="/usr/bin/llvm*" | ||
CLANGFILES="/usr/bin/clang*" | ||
LLC=/usr/bin/llc-$1 | ||
OPT=/usr/bin/opt-$1 | ||
LLD=/usr/bin/lld-$1 | ||
|
||
for f in $LLVMFILES $CLANGFILES $LLC $OPT $LLD | ||
do | ||
link=${f::-3} | ||
echo "linking" "$f" "to" "$link" | ||
ln -s "$f" "$link" | ||
if [ -e "$f" ] | ||
then cp "$link" /usr/local/bin/ | ||
fi | ||
done |