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

How official Solana binaries are built? #22749

Closed
kucharskim opened this issue Jan 26, 2022 · 5 comments
Closed

How official Solana binaries are built? #22749

kucharskim opened this issue Jan 26, 2022 · 5 comments

Comments

@kucharskim
Copy link

Can someone point me to the build scripts?

I'm asking about binary artifacts from asset section of https://github.com/solana-labs/solana/releases

I'm asking in context of target-cpu and target-feature or anything else, which could lead to SIGILL. Similarly to #19669

@ruuda
Copy link
Contributor

ruuda commented Jan 26, 2022

I'm asking in context of target-cpu and target-feature or anything else, which could lead to SIGILL.

The reason we ask, is because we build solana-validator from source, and we observed it SIGILL.

I have one hypothesis for what causes this, but I haven’t verified it yet. Solana depends on reed-solomon-erasure with simd-accel feature enabled. Due to a bug/feature in this crate, when simd-accel is enabled and when RUSTFLAGS is not set or does not contain a -C target-cpu flag, reed-solomon-erasure will compile a piece of C code with -march=native: https://github.com/rust-rse/reed-solomon-erasure/blob/v4.0.2/build.rs#L161-L181 This could cause the compiler to select instructions specific to the host that the binary is built on, outside of the intended simd instructions. This also relates to rust-rse/reed-solomon-erasure#75.

@deni64k
Copy link

deni64k commented Jan 26, 2022

@ruuda Your guess is correct. I work around it this way.

Here is a stub executable for clang/gcc compilers:

#!/usr/bin/env bash
declare -a args=()
for arg in "$@"; do
  narg=$(echo -n "$arg" | sed -E "s,-m(arch|cpu|tune)=.+,-m\\1={WHATEVER_ARCH_YOU_WANT},")
  if test -z "$narg"; then
    narg="$arg"
  fi
  args+=("$narg")
done
exec "__EXE__.orig" "${args[@]}"

I install it in a Docker builder image this way:

RUN for exe in /usr/bin/clang* /usr/bin/gcc* /usr/bin/g++*; do  \
      mv "$exe" "$exe.orig";                                    \
      cp /usr/local/bin/clang-stub "$exe";                      \
      sed -i -e "s,__EXE__,$exe,g" "$exe";                      \
      chmod +x "$exe";                                          \
    done

@kucharskim
Copy link
Author

Do you have your build pipeline for binaries public somewhere? Where I can find above piece of code and Dockerfile? What is your default {WHATEVER_ARCH_YOU_WANT} for official Solana binaries?

@t-nelson
Copy link
Contributor

It's here. Specifically

# Make CHANNEL available to include in the software version information
export CHANNEL
source ci/rust-version.sh stable
scripts/cargo-install-all.sh stable "${RELEASE_BASENAME}"

@steveluscher
Copy link
Contributor

We want to make sure to keep signal strong in the GitHub issue tracker – to make sure that it remains the best place to track issues that affect the development of Solana itself – so I'm going to close this.

If you learned something that's worth sharing with the broader community, please do post both your original question and the answer you discovered to our new purpose-built Q&A forum: https://solana.stackexchange.com/questions/ask

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

No branches or pull requests

5 participants