Skip to content
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

feat: FFI_PORTABLE to build a maximally portable binary #480

Merged
merged 1 commit into from
Sep 11, 2024

Conversation

rvagg
Copy link
Member

@rvagg rvagg commented Sep 10, 2024

Ref: filecoin-project/lotus#12423

Background: we're having trouble building from source in Lotus CI because we run tests two different machine types and only build FFI on one, caching the output and deploying it on the other machines. We have our own custom runners in AWS and also lean heavily on the default GHA runners which are in Azure and they obviously have different CPU types.

This change introduces FFI_PORTABLE=1 which builds using the same flags as rust/scripts/build-release.sh does when called from CI to build the release bundle.

Comparison of some builds:

When run from CI, we get:

+ RUSTFLAGS='--print native-static-libs '
+ cargo build --release --locked --verbose --no-default-features --features multicore-sdr,opencl,blst-portable

When run from FFI_BUILD_FROM_SOURCE=1 make (on my machine), we get:

+ RUSTFLAGS='--print native-static-libs -C target-feature=+adx,+sha,+sse2,+avx2,+avx,+sse4.2,+sse4.1'
+ cargo build --release --locked --no-default-features --features multicore-sdr,cuda

FFI_BUILD_FROM_SOURCE=1 FFI_USE_BLST_PORTABLE=1 make gives:

+ RUSTFLAGS='--print native-static-libs -C target-feature=+adx,+sha,+sse2,+avx2,+avx,+sse4.2,+sse4.1'
+ cargo build --release --locked --no-default-features --features multicore-sdr,blst-portable,cuda

And this new option, FFI_BUILD_FROM_SOURCE=1 FFI_PORTABLE=1 make, gives:

+ RUSTFLAGS='--print native-static-libs '
+ cargo build --release --locked --no-default-features --features multicore-sdr,blst-portable,opencl

i.e. the same to the CI version except for --verbose.

Ref: filecoin-project/lotus#12423

Builds using the same flags as rust/scripts/build-release.sh does when called
from CI to build the release bundle.
@rvagg rvagg merged commit f19e735 into master Sep 11, 2024
5 checks passed
@rvagg rvagg deleted the rvagg/portable branch September 11, 2024 02:51
@rjan90 rjan90 mentioned this pull request Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants