Comments (1)
Hello,
RISC-V support is highly experimental and we only actively develop for it on master
branch, so don't expect future support on older tags.
For reference on how to build binaries for RISC-V you can check this docker build file.
If you are developing on a native RISC-V environment, you will find every step needed, like compiling sqlite and linking it to rust compile, to properly build for it.
For tag/v0.4.1/ircd
you can use the following docker file using this steps:
cargo clean
on repo root folder- save the file as
ircd-riscv.Dockerfile
insidecontrib/docker
- build on repo root folder:
docker build . --pull --no-cache --shm-size=196m -t darkfi:ircd-riscv -f ./contrib/docker/ircd-riscv.Dockerfile -o riscv-bins
No need to touch anything else.
ircd-riscv.Dockerfile:
# Usage(on repo root folder):
# docker build . --pull --no-cache --shm-size=196m -t darkfi:ircd-riscv -f ./contrib/docker/ircd-riscv.Dockerfile -o riscv-bins
# If you want to keep building using the same builder, remove --no-cache option.
# Arguments configuration
ARG DEBIAN_VER=latest
ARG SQL_VER=3420000
ARG RUST_VER=stable
# When changing riscv target, don't forget to also update the linker
ARG RISCV_TARGET=riscv64gc-unknown-linux-gnu
ARG RISCV_LINKER=riscv64-linux-gnu-gcc
# Environment setup
FROM debian:${DEBIAN_VER} as builder
## Arguments import
ARG SQL_VER
ARG RUST_VER
ARG RISCV_TARGET
ARG RISCV_LINKER
ARG BINS
## Install system dependencies
RUN apt-get update
RUN apt-get install -y make gcc pkg-config gcc-riscv64-linux-gnu wget
## Build sqlite3 for Risc-V
RUN wget https://www.sqlite.org/2023/sqlite-autoconf-${SQL_VER}.tar.gz && \
tar xvfz sqlite-autoconf-${SQL_VER}.tar.gz && \
rm sqlite-autoconf-${SQL_VER}.tar.gz && \
mv sqlite-autoconf-${SQL_VER} sqlite3 && \
cd sqlite3 && \
./configure --host=riscv64-linux-gnu CC=/bin/${RISCV_LINKER} && \
make
## Rust installation
RUN wget -O install-rustup.sh https://sh.rustup.rs && \
sh install-rustup.sh -yq --default-toolchain none && \
rm install-rustup.sh
ENV PATH "${PATH}:/root/.cargo/bin/"
RUN rustup default "${RUST_VER}"
RUN rustup target add "${RISCV_TARGET}"
# Build binaries
FROM builder as rust_builder
WORKDIR /opt/darkfi
COPY . /opt/darkfi
# Risc-V support is highly experimental so we have to add some hack patches.
RUN echo '[patch.crates-io] \n\
ring = {git="https://github.com/aggstam/ring"} \n\
rustls = {git="https://github.com/aggstam/rustls", branch="risc-v"} \n\
rcgen = {git="https://github.com/aggstam/rcgen"} \n\
' >> Cargo.toml
RUN sed -i Cargo.toml \
-e """s|\[dependencies\]|\[dependencies\]\n\
rustls = \"0.21.7\"\n\
ring = \"0.16.20\"|g""" \
-e "s|0.10.0|0.11.1|g" \
-e "s|0.22.2|0.24.0|g"
RUN sed -i src/net/transport/upgrade_tls.rs \
-e "s|DistinguishedNames|DistinguishedName|g" \
-e "s|Option<DistinguishedName>|\&\[DistinguishedName]|g" \
-e "s|Some(vec!\[\])|\&\[\]|g"
RUN cargo update
WORKDIR /opt/darkfi/bin/ircd
RUN sed -i Cargo.toml -e "s|0.22.2|0.24.0|g"
ENV RUSTFLAGS="-C linker=/bin/${RISCV_LINKER} -L/sqlite3/.libs/"
RUN RUSTFLAGS="${RUSTFLAGS}" cargo build --target=${RISCV_TARGET} --all-features --release
WORKDIR /opt/darkfi
RUN mkdir compiled-bins && cp target/${RISCV_TARGET}/release/ircd compiled-bins/ircd
# Export binaries from rust builder
FROM scratch
COPY --from=rust_builder /opt/darkfi/compiled-bins/* ./
Builded binary will work without issues, as I constantly test it on a RISC-V board.
Let me know if you require extra help and/or information!
KR
from darkfi.
Related Issues (20)
- payment transfer issue HOT 2
- darkfid shutting down suddenly...
- error[E0463]: can't find crate for `core` HOT 1
- drk: build script doesn't enable optional dependency `play` HOT 5
- unable to build ircd on master HOT 1
- darkfid rpc stops listening after some time ("Error: Connection failed") HOT 2
- sync stuck at a past block. HOT 4
- Unable to connect to darkirc HOT 1
- Connection fails when switching from versioned ircd to darkirc HOT 2
- Cannot connect on returning to ircd HOT 2
- zkas improvements HOT 1
- DAGSyncFailed HOT 1
- Installation Instructions Missing `libclang-dev` HOT 4
- `darkifd` Doesn't Respond To CTRL+C HOT 2
- Improve nixos flake installation HOT 3
- question on make and rust workspace build process HOT 2
- Merge mining with Monero HOT 8
- error compiling ircd
- possible faulty ircd set up
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from darkfi.