diff --git a/.circleci/config.yml b/.circleci/config.yml index f0170dde..640480b5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -334,4 +334,4 @@ commands: - save_cache: key: v28-proof-params-{{ arch }} paths: - - "~/filecoin-proof-parameters/" + - "~/filecoin-proof-parameters/" \ No newline at end of file diff --git a/builder/.DS_Store b/builder/.DS_Store new file mode 100644 index 00000000..65d2ec78 Binary files /dev/null and b/builder/.DS_Store differ diff --git a/builder/arm64/.DS_Store b/builder/arm64/.DS_Store new file mode 100644 index 00000000..0c1ea629 Binary files /dev/null and b/builder/arm64/.DS_Store differ diff --git a/builder/arm64/Dockerfile b/builder/arm64/Dockerfile new file mode 100644 index 00000000..9cc101e8 --- /dev/null +++ b/builder/arm64/Dockerfile @@ -0,0 +1,20 @@ +#FROM --platform=arm64 golang@sha256:96e888160bd68f54a1165b23c66318aea4ff6a4726cb854276d6d776c14b8978 +FROM ubuntu:latest as builder +#FROM rust:slim-buster@sha256:5b0c5f6cd5aa84f6dd3f2188ac84aa0e0d602b514ccc14e9d1ebd5b865aa7849 +#FROM golang:1.17.9-stretch + +ARG DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && \ + apt-get install -y wget jq hwloc ocl-icd-opencl-dev git libhwloc-dev pkg-config make curl && \ + apt-get install -y cargo golang-go + +WORKDIR /filecoin-ffi/ + +#RUN curl https://sh.rustup.rs -sSf | bash -s -- -y +RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly -y +ENV PATH="/root/.cargo/bin:${PATH}" +RUN rustup +nightly target add aarch64-unknown-linux-gnu +RUN cargo --help +RUN git clone https://github.com/filecoin-project/filecoin-ffi.git . && \ + RUSTFLAGS="-C target-cpu=native -g" FFI_BUILD_FROM_SOURCE=1 make \ No newline at end of file diff --git a/builder/arm64/README.md b/builder/arm64/README.md new file mode 100644 index 00000000..89fb6fa1 --- /dev/null +++ b/builder/arm64/README.md @@ -0,0 +1,27 @@ +# filecoin-ffi build workaround + +As of this writing, .circleci does not support arm based images and as a workaround we need to try and build the filecoin-ffi in a containerized environment. The workaround is to create a docker image using an ARM64 based operating system and build the binaries in the image. We can then pull (`cp`) the binaries to the host. + +## Pre-requisites +- docker +- bash +- tar + +There are 2 files in this repo: +- Dockerfile this is the main docker file that will run the steps to build the latest master branch of filecoin-ffi on ubuntu +- run_arm_build_docker.sh - this script runs the docker build and extract the content from the image to the host. + +## Running +``` +./run_arm_build_docker.sh +``` + + +## Builders +We can use some of these images as builders. They are all arm64 based. +``` +FROM --platform=arm64 golang@sha256:96e888160bd68f54a1165b23c66318aea4ff6a4726cb854276d6d776c14b8978 as builder +FROM ubuntu:latest as builder +FROM rust:slim-buster@sha256:5b0c5f6cd5aa84f6dd3f2188ac84aa0e0d602b514ccc14e9d1ebd5b865aa7849 as builder +FROM golang:1.17.9-stretch as builder +``` diff --git a/builder/arm64/run_arm_build_docker.sh b/builder/arm64/run_arm_build_docker.sh new file mode 100755 index 00000000..1f4504e5 --- /dev/null +++ b/builder/arm64/run_arm_build_docker.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +timestamp=$(date +%s) +name=arm_build_only_$timestamp +docker build -t $name . + +# get the container id +id=$(docker create $name) +docker cp $id:/filecoin-ffi/ - > $name.tar.gz + +## extract +tar -xvf $name.tar.gz + +## Copy to wherever.. \ No newline at end of file diff --git a/install-filcrypto b/install-filcrypto index 41adf5fd..ae4a7e9a 100755 --- a/install-filcrypto +++ b/install-filcrypto @@ -161,7 +161,10 @@ build_from_source() { if [ "$(uname -s)" = "Darwin" ] && [ "$(uname -m)" = "x86_64" ]; then build="lipo" additional_flags="--targets x86_64-apple-darwin,aarch64-apple-darwin " - else + elif [ "$(uname -m)" = "arm64" ]; then + build="build" + additional_flags="--target aarch64-unknown-linux-gnu " + else build="build" fi