From 019d3055e5f7888fe98812a1cc1a68b0ed32e243 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matev=C5=BE=20Jekovec?= Date: Thu, 12 Sep 2024 10:46:20 +0200 Subject: [PATCH 1/3] feat(rofl/build): Set x86_64-unknown-linux-gnu target for Localnet build --- cmd/rofl/build.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/rofl/build.go b/cmd/rofl/build.go index 6c6121bd..0387fb9a 100644 --- a/cmd/rofl/build.go +++ b/cmd/rofl/build.go @@ -110,7 +110,7 @@ var ( // First build for the default target. fmt.Println("Building ELF binary...") - elfPath, err := cargo.Build(true, "", features) + elfPath, err := cargo.Build(true, "x86_64-unknown-linux-gnu", features) if err != nil { cobra.CheckErr(fmt.Errorf("failed to build ELF binary: %w", err)) } From c6ddc1350ed113f4cfeb27ca6a6b7a952c58dee3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matev=C5=BE=20Jekovec?= Date: Thu, 12 Sep 2024 11:59:13 +0200 Subject: [PATCH 2/3] build rofl: Fail if cannot connect to network The current behavior silently falls back to production builds when your Localnet is not accessible. If --mode is auto, then it should fail, when the connection cannot be established. --- cmd/rofl/build.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/rofl/build.go b/cmd/rofl/build.go index 0387fb9a..8f98d9f6 100644 --- a/cmd/rofl/build.go +++ b/cmd/rofl/build.go @@ -72,12 +72,12 @@ var ( ctx := context.Background() conn, err := connection.Connect(ctx, npa.Network) if err != nil { - break // Autodetection failed. + cobra.CheckErr(fmt.Errorf("unable to autodetect build mode, please provide --mode flag manually: failed to connect to GRPC endpoint: %v", err)) } params, err := conn.Consensus().Registry().ConsensusParameters(ctx, consensus.HeightLatest) if err != nil { - break // Autodetection failed. + cobra.CheckErr(fmt.Errorf("unable to autodetect build mode, please provide --mode flag manually: failed to get consensus parameters: %v", err)) } if params.DebugAllowTestRuntimes { From 0a4993c64f89d5324e6e5b4e34ab94be9c83ae5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matev=C5=BE=20Jekovec?= Date: Thu, 12 Sep 2024 15:41:58 +0200 Subject: [PATCH 3/3] build rofl: Use x86_64-unknown-linux-musl target In order to be compatible with alpine linux builds we use in our containers, the target needs to be built for musl instead of gnu. --- cmd/rofl/build.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/rofl/build.go b/cmd/rofl/build.go index 8f98d9f6..cd151729 100644 --- a/cmd/rofl/build.go +++ b/cmd/rofl/build.go @@ -110,7 +110,7 @@ var ( // First build for the default target. fmt.Println("Building ELF binary...") - elfPath, err := cargo.Build(true, "x86_64-unknown-linux-gnu", features) + elfPath, err := cargo.Build(true, "x86_64-unknown-linux-musl", features) if err != nil { cobra.CheckErr(fmt.Errorf("failed to build ELF binary: %w", err)) }