alloy icon indicating copy to clipboard operation
alloy copied to clipboard

Could you please include `mipsle` in releases?

Open missingcharacter opened this issue 2 years ago • 9 comments

I see https://github.com/grafana/agent/pull/602

For now, I'd like to not bundle it with releases. New platforms really bloat up the CI time, and I'd prefer to wait until we have more people asking for it before we do that.

Could you have people show their interest in mipsle in this issue?

Related PR: https://github.com/grafana/agent/pull/2418

missingcharacter avatar Feb 23 '23 20:02 missingcharacter

We have a use case to install Grafana Agent on hundreds of OpenWRT based routers, these devices are based on MIPS architecture. Currently we are building our own, It would really helpful to get Grafana Agent release supported for MIPS.

ksingh-scogo avatar Dec 22 '23 19:12 ksingh-scogo

Hi @rfratto 👋

Would really appreciate your attention on this.

ksingh-scogo avatar Jan 04 '24 14:01 ksingh-scogo

@missingcharacter did you manage to find a workaround on this topic.

ksingh-scogo avatar Jan 04 '24 14:01 ksingh-scogo

@ksingh-scogo Yes, I manually build agent and agentctl with GOOS=linux GOARCH=mipsle GOMIPS=softfloat

missingcharacter avatar Jan 04 '24 14:01 missingcharacter

@ksingh-scogo I did it in an older version, but I believe the following should work

Requirements:

  • docker should be installed
  • Propagate GOMIPS environment variable
diff --git a/Makefile b/Makefile
index 024a624d2..72bef8582 100644
--- a/Makefile
+++ b/Makefile
@@ -119,6 +119,7 @@ AGENTLINT_BINARY                        ?= build/agentlint
 GOOS                                    ?= $(shell go env GOOS)
 GOARCH                                  ?= $(shell go env GOARCH)
 GOARM                                   ?= $(shell go env GOARM)
+GOMIPS                                  ?= $(shell go env GOMIPS)
 CGO_ENABLED                             ?= 1
 RELEASE_BUILD                           ?= 0
 GOEXPERIMENT                            ?= $(shell go env GOEXPERIMENT)
@@ -127,7 +128,7 @@ GOEXPERIMENT                            ?= $(shell go env GOEXPERIMENT)
 # container. USE_CONTAINER must _not_ be included to avoid infinite recursion.
 PROPAGATE_VARS := \
     AGENT_IMAGE AGENTCTL_IMAGE OPERATOR_IMAGE CROW_IMAGE SMOKE_IMAGE \
-    BUILD_IMAGE GOOS GOARCH GOARM CGO_ENABLED RELEASE_BUILD \
+    BUILD_IMAGE GOOS GOARCH GOARM GOMIPS CGO_ENABLED RELEASE_BUILD \
     AGENT_BINARY AGENT_BORINGCRYPTO_BINARY FLOW_BINARY AGENTCTL_BINARY OPERATOR_BINARY \
     CROW_BINARY SMOKE_BINARY VERSION GO_TAGS GOEXPERIMENT

@@ -135,7 +136,7 @@ PROPAGATE_VARS := \
 # Constants for targets
 #

-GO_ENV := GOOS=$(GOOS) GOARCH=$(GOARCH) GOARM=$(GOARM) CGO_ENABLED=$(CGO_ENABLED)
+GO_ENV := GOOS=$(GOOS) GOARCH=$(GOARCH) GOARM=$(GOARM) GOMIPS=$(GOMIPS) CGO_ENABLED=$(CGO_ENABLED)

 VERSION      ?= $(shell bash ./tools/image-tag)
 GIT_REVISION := $(shell git rev-parse --short HEAD)

The actual commands

$ export GOOS=linux GOARCH=mipsle GOMIPS=softfloat USE_CONTAINER=1
$ make binaries

and if it doesn't work you can try to go back to this version https://github.com/grafana/agent/pull/602/files

missingcharacter avatar Jan 04 '24 16:01 missingcharacter

welp, newer versions don't even support mipsle, I get these errors when building:

with CGO_ENABLED=1

$ export GOOS=linux GOARCH=mipsle GOMIPS=softfloat CGO_ENABLED=1 USE_CONTAINER=1
$ make binaries
...
fatal: unsupported $VICEROYARCH mipsle for linux. Must be one of: amd64, 386, arm, arm64, ppc64le, s390x

with CGO_ENABLED=0

$ export GOOS=linux GOARCH=mipsle GOMIPS=softfloat CGO_ENABLED=0 USE_CONTAINER=1
$ make binaries
...
# github.com/microsoft/go-mssqldb
/go/pkg/mod/github.com/microsoft/[email protected]/ucs22str.go:23:20: 0xFFFFFFF8 (untyped int constant 4294967288) overflows int
make: *** [Makefile:199: agent] Error 1
make: *** [agent] Error 2

you'd have to git checkout to a previous version like https://github.com/grafana/agent/pull/602/files

missingcharacter avatar Jan 04 '24 17:01 missingcharacter

seems like mipsle is not supported by https://github.com/rfratto/viceroy/issues/6

missingcharacter avatar Jan 04 '24 18:01 missingcharacter

Trying to add mips support here https://github.com/rfratto/viceroy/pull/7

missingcharacter avatar Jan 04 '24 19:01 missingcharacter

@ksingh-scogo if you are interested in an "easy" way to build the agent and agentctl binaries, sadly, these would be for an older version. Try the below:

$ git checkout b8ec553
$ CROSS_BUILD='true' BUILD_IN_CONTAINER='true' RELEASE_BUILD='true' TARGETPLATFORM='mipls' make all
...
$ file cmd/agent/agent
cmd/agent/agent: ELF 32-bit LSB executable, MIPS, MIPS32 rel2 version 1 (SYSV), dynamically linked, interpreter /lib/ld.so.1, BuildID[sha1]=e684a8700000d7b00fc7972976f03a1d65f14b6b, for GNU/Linux 3.2.0, stripped
$ file cmd/agentctl/agentctl 
cmd/agentctl/agentctl: ELF 32-bit LSB executable, MIPS, MIPS32 rel2 version 1 (SYSV), dynamically linked, interpreter /lib/ld.so.1, BuildID[sha1]=611fce2b2a7f5e9fc1f01febe7e87772b7f26394, for GNU/Linux 3.2.0, stripped

missingcharacter avatar Jan 08 '24 03:01 missingcharacter