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

fix: fixes anvil-zksync failing on ubuntu-latest #527

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ jobs:
]
include:
- arch: x86_64-unknown-linux-gnu
platform: ubuntu-20.04
platform: ubuntu-24.04
- arch: aarch64-unknown-linux-gnu
platform: ubuntu-20.04
platform: ubuntu-24.04
- arch: x86_64-apple-darwin
platform: macos-latest
- arch: aarch64-apple-darwin
Expand Down Expand Up @@ -77,7 +77,11 @@ jobs:

- name: Build anvil-zksync for ${{ matrix.arch }}
run: |
make build-${{ matrix.arch }}
if [[ "${{ matrix.arch }}" == *"linux"* ]]; then
make build-static-${{ matrix.arch }}
else
make build-${{ matrix.arch }}
fi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we shouldn't build static binaries on macOS? I assume openssl is more or less on every modern mac machine but I wouldn't count on it being the same version

Copy link
Collaborator Author

@dutterbutter dutterbutter Jan 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not too familiar with any pros / cons but figured we havent had any issue with the macos builds to leave it as it. When I was looking into static builds it seems only prevalent with linux builds.


- name: Rename and move binary
run: |
Expand Down
12 changes: 6 additions & 6 deletions Cross.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Cross.toml

[target.x86_64-unknown-linux-gnu]
image = "ubuntu:24.04"
pre-build = [
"export DEBIAN_FRONTEND=noninteractive",
"export TZ=Etc/UTC",
"dpkg --add-architecture $CROSS_DEB_ARCH",
"apt update -q && apt upgrade -yq && apt install --assume-yes --no-install-recommends libclang-10-dev clang-10 cmake build-essential pkg-config libssl-dev:$CROSS_DEB_ARCH libsasl2-dev llvm-dev gnutls-bin",
"apt install -y gcc-10 g++-10",
"update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10",
"update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10"
"apt update -q && apt upgrade -yq",
"apt install --assume-yes --no-install-recommends libclang-14-dev clang-14 cmake build-essential pkg-config libssl-dev:$CROSS_DEB_ARCH libsasl2-dev llvm-14-dev gnutls-bin",
"apt install -y gcc-11 g++-11",
"update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 11",
"update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 11"
]

[target.aarch64-unknown-linux-gnu]
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ run: all
build-%:
cross build --bin anvil-zksync --target $* --release

# Build the Rust project for a specific target (static build).
build-static-%:
RUSTFLAGS='-C target-feature=+crt-static' OPENSSL_STATIC=1 cross build --bin anvil-zksync --target $* --release

# Build the Rust documentation
rust-doc:
cargo doc --no-deps --open
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/fork.rs
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ impl ForkDetails {

if !block_details
.protocol_version
.map_or(false, supported_protocol_versions)
.is_some_and(supported_protocol_versions)
{
return Err(eyre!("This block is using the unsupported protocol version: {:?}. This binary supports versions {}.",
block_details.protocol_version,
Expand Down
3 changes: 1 addition & 2 deletions e2e-tests-rust/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ impl LockedPort {
/// or is not needed anymore.
impl Drop for LockedPort {
fn drop(&mut self) {
self.lockfile
.unlock()
fs2::FileExt::unlock(&self.lockfile)
.with_context(|| format!("failed to unlock lockfile for port={}", self.port))
.unwrap();
}
Expand Down
3 changes: 1 addition & 2 deletions spec-tests/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ impl LockedPort {
/// or is not needed anymore.
impl Drop for LockedPort {
fn drop(&mut self) {
self.lockfile
.unlock()
fs2::FileExt::unlock(&self.lockfile)
.with_context(|| format!("failed to unlock lockfile for port={}", self.port))
.unwrap();
}
Expand Down
Loading