Skip to content

Commit b76ec1c

Browse files
author
Claudio Raimondi
committed
Fix cargo cross compilation [skip ci]
1 parent c17d990 commit b76ec1c

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ ENV LIGHTNINGD_VERSION=master
118118

119119
RUN dpkg --add-architecture ${target_arch_dpkg}
120120

121-
#TODO: python3-dev needs QEMU for post install scripts. find a workaround
121+
#TODO: python3-dev needs QEMU for post install scripts. find a workaround to not use QEMU
122122
RUN apt-get update && \
123123
apt-get install -qq -y --no-install-recommends \
124124
pkg-config:${target_arch_dpkg} \
@@ -139,7 +139,7 @@ ARG TARGET=${target_arch_rust}
139139
ARG COPTFLAGS="-O2 ${COPTFLAGS}"
140140
ARG RUST_PROFILE=release
141141

142-
#TODO: set via env
142+
#TODO: set all these config options via env variables (https://doc.rust-lang.org/cargo/reference/environment-variables.html)
143143
RUN mkdir -p .cargo && tee .cargo/config.toml <<EOF
144144

145145
[build]
@@ -165,7 +165,6 @@ RUN git submodule update --init --recursive --jobs $(nproc) --depth 1
165165

166166
#TODO: Fix unaligned access on armv7
167167
RUN ./configure --prefix=/tmp/lightning_install --enable-static --disable-compat --disable-valgrind
168-
#TODO: Fix cp stat error on amd64 x86-64
169168
RUN uv run make install-program -j$(nproc)
170169

171170
RUN find /tmp/lightning_install -type f -executable -exec \

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,14 @@ endif
345345
fi
346346

347347
RUST_PROFILE ?= debug
348+
349+
# Cargo places cross compiled packages in a different directory, using the target triple
350+
ifeq ($(TARGET),)
351+
RUST_TARGET_DIR = target/$(RUST_PROFILE)
352+
else
353+
RUST_TARGET_DIR = target/$(TARGET)/$(RUST_PROFILE)
354+
endif
355+
348356
ifneq ($(RUST_PROFILE),debug)
349357
CARGO_OPTS := --profile=$(RUST_PROFILE) --quiet
350358
else

0 commit comments

Comments
 (0)