-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: build filecoin-ffi on arm based OS #278
Closed
Closed
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
6c611cb
chore: add ARM build
alvin-reyes 0e0626f
chore: docker file to build on arm
alvin-reyes eb09142
Merge branch 'filecoin-project:master' into master
36000ad
chore: use ubuntu image and add script to extract files from image to…
alvin-reyes 08012b8
Merge branch 'master' of https://github.com/alvin-reyes/filecoin-ffi
alvin-reyes e44c228
chore: use filecoin-ffi directly
alvin-reyes a0d954c
chore: added dedicated docker file for running filecoin-ffi build
alvin-reyes 4a345ad
chore: added arm64 scripts
alvin-reyes b7be0a3
Update README.md
7a12cc9
Update README.md
f317fd5
chore: removed echo uname
alvin-reyes e7ec255
Merge branch 'filecoin-project:master' into master
214c5ae
Merge branch 'filecoin-project:master' into master
9ea46e3
Merge branch 'filecoin-project:master' into master
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Binary file not shown.
Binary file not shown.
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 @@ | ||
#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 |
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,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 | ||
``` |
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,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.. |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what "arm based images" are, but CircleCI has ARM64 support, which is e.g. be used by rust-fil-proofs: https://github.com/filecoin-project/rust-fil-proofs/blob/6260c2a5409bda6c2514e8c355d52623939f4bc7/.circleci/config.yml#L19-L22
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Thank you for this. I'll experiment with this image then.
I saw this note on circle ci.