Skip to content

Commit abdf922

Browse files
committed
Update llvm, minor re-org of args, use xbuild 0.5.29
- Need to avoid LTO changes that result in gcc linking with compiler_builtins.rlib `error adding symbols: file format not recognized`
1 parent 9f8bfee commit abdf922

File tree

1 file changed

+29
-25
lines changed

1 file changed

+29
-25
lines changed

Dockerfile

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,11 @@
11
FROM debian:buster-slim
22

3-
# -------------------------------------------------------------------
4-
# Toolchain Version Config
5-
# -------------------------------------------------------------------
6-
7-
# esp-idf framework
8-
ARG IDF_VERSION="v4.0"
9-
10-
# llvm-xtensa (xtensa_release_9.0.1)
11-
ARG LLVM_VERSION="654ba115e55638acc60a8dacf8b1b8d8468cc4f4"
12-
13-
# rust-xtensa
14-
ARG RUSTC_VERSION="672b35ef0d38d3cd3b0d77eb15e5e58d9f4efec6"
15-
163
# -------------------------------------------------------------------
174
# Toolchain Path Config
185
# -------------------------------------------------------------------
196

207
ARG TOOLCHAIN="/home/esp32-toolchain"
218

22-
ARG ESP_BASE="${TOOLCHAIN}/esp"
23-
ENV IDF_PATH "${ESP_BASE}/esp-idf"
24-
25-
ARG LLVM_BASE="${TOOLCHAIN}/llvm"
26-
ARG LLVM_PATH="${LLVM_BASE}/llvm_xtensa"
27-
ARG LLVM_BUILD_PATH="${LLVM_BASE}/llvm_build"
28-
ARG LLVM_INSTALL_PATH="${LLVM_BASE}/llvm_install"
29-
30-
ARG RUSTC_BASE="${TOOLCHAIN}/rustc"
31-
ARG RUSTC_PATH="${RUSTC_BASE}/rust_xtensa"
32-
ARG RUSTC_BUILD_PATH="${RUSTC_BASE}/rust_build"
339

3410
ENV PATH "/root/.cargo/bin:${PATH}"
3511

@@ -63,6 +39,11 @@ RUN apt-get update \
6339
# Setup esp-idf
6440
# -------------------------------------------------------------------
6541

42+
# esp-idf framework
43+
ARG IDF_VERSION="v4.0"
44+
ARG ESP_BASE="${TOOLCHAIN}/esp"
45+
ENV IDF_PATH "${ESP_BASE}/esp-idf"
46+
6647
WORKDIR "${ESP_BASE}"
6748
RUN git clone \
6849
--recursive --single-branch -b "${IDF_VERSION}" \
@@ -74,6 +55,13 @@ RUN git clone \
7455
# Build llvm-xtensa
7556
# -------------------------------------------------------------------
7657

58+
# llvm-xtensa (xtensa_release_9.0.1)
59+
ARG LLVM_VERSION="ae26b7e4eb0938601f8a8744ff50c178a3ef0847"
60+
ARG LLVM_BASE="${TOOLCHAIN}/llvm"
61+
ARG LLVM_PATH="${LLVM_BASE}/llvm_xtensa"
62+
ARG LLVM_BUILD_PATH="${LLVM_BASE}/llvm_build"
63+
ARG LLVM_INSTALL_PATH="${LLVM_BASE}/llvm_install"
64+
7765
WORKDIR "${LLVM_BASE}"
7866
RUN mkdir "${LLVM_PATH}" \
7967
&& cd "${LLVM_PATH}" \
@@ -101,6 +89,12 @@ RUN mkdir "${LLVM_PATH}" \
10189
# Build rust-xtensa
10290
# -------------------------------------------------------------------
10391

92+
# rust-xtensa
93+
ARG RUSTC_VERSION="672b35ef0d38d3cd3b0d77eb15e5e58d9f4efec6"
94+
ARG RUSTC_BASE="${TOOLCHAIN}/rustc"
95+
ARG RUSTC_PATH="${RUSTC_BASE}/rust_xtensa"
96+
ARG RUSTC_BUILD_PATH="${RUSTC_BASE}/rust_build"
97+
10498
WORKDIR "${RUSTC_BASE}"
10599
RUN git clone \
106100
--recursive --single-branch \
@@ -120,6 +114,15 @@ RUN git clone \
120114
# Setup rustup toolchain
121115
# -------------------------------------------------------------------
122116

117+
# Need to use specific version of xbuild.
118+
# LTO was enabled in 0.5.30 and then removed in 0.5.31.
119+
# 0.5.32 passes `-Cembed-bitcode=yes` instead of `-Clinker-plugin-lto` for sysroot.
120+
# But, embed-bitcode isn't recognized by rustc 1.43.1.
121+
# Details:
122+
# https://github.com/rust-osdev/cargo-xbuild/issues/72
123+
# https://stackoverflow.com/questions/61755610/unknown-feature-llvm-asm-when-compile-rust-src
124+
125+
WORKDIR "${RUSTC_BASE}"
123126
RUN curl \
124127
--proto '=https' \
125128
--tlsv1.2 \
@@ -128,7 +131,8 @@ RUN curl \
128131
| sh -s -- -y --default-toolchain stable \
129132
&& rustup component add rustfmt \
130133
&& rustup toolchain link xtensa "${RUSTC_BUILD_PATH}" \
131-
&& cargo install cargo-xbuild bindgen
134+
&& cargo install bindgen \
135+
&& cargo install --version 0.5.29 cargo-xbuild
132136

133137
# -------------------------------------------------------------------
134138
# Our Project

0 commit comments

Comments
 (0)