Skip to content

Commit

Permalink
fix: fixes anvil-zksync failing on ubuntu-latest (#527)
Browse files Browse the repository at this point in the history
* fix: fix builds for releases

* chore: bump base image

* chore: update to 22:04 explicitly

* chore: fix lint

* chore: fix lint issue

* fix lint errors
  • Loading branch information
dutterbutter authored Jan 13, 2025
1 parent fbf14a3 commit 2c79e6b
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 14 deletions.
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
- 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

0 comments on commit 2c79e6b

Please sign in to comment.