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

Add binary packages for mips architecture #3096

Closed
psitem opened this issue Aug 6, 2017 · 8 comments · Fixed by #5234
Closed

Add binary packages for mips architecture #3096

psitem opened this issue Aug 6, 2017 · 8 comments · Fixed by #5234
Labels
upstream bug or issues that rely on dependency fixes

Comments

@psitem
Copy link

psitem commented Aug 6, 2017

I'd like to run telegraf on my Ubiquiti EdgeRouters, which use MT7621 1004Kc (32-bit) or Cavium Octeon II (64-bit) MIPS cores.

@goller
Copy link
Contributor

goller commented Aug 7, 2017

Hey there @tbyehl, I think it would be neat to do this. I just tried cross-compiling telegraf but I ran into these errors:

 GOOS=linux GOARCH=mipsle go build ./cmd/telegraf
# github.com/shirou/gopsutil/host
../../shirou/gopsutil/host/host_linux.go:142: undefined: sizeOfUtmp
../../shirou/gopsutil/host/host_linux.go:147: undefined: sizeOfUtmp
../../shirou/gopsutil/host/host_linux.go:149: undefined: utmp


 GOOS=linux GOARCH=mips64le go build ./cmd/telegraf
# github.com/shirou/gopsutil/host
../../shirou/gopsutil/host/host_linux.go:142: undefined: sizeOfUtmp
../../shirou/gopsutil/host/host_linux.go:147: undefined: sizeOfUtmp
../../shirou/gopsutil/host/host_linux.go:149: undefined: utmp

Looks like we'd need the mips port in gopsutil.

@psitem
Copy link
Author

psitem commented Aug 7, 2017

I'm out of my element here, but is it being compiled with a version of Go that supports MIPS? It seems like it's getting those definitions from Go?

https://github.com/shirou/gopsutil/blob/master/host/types_linux.go

@psitem psitem changed the title Any chance of getting MPS builds? Any chance of getting MIPS builds? Aug 7, 2017
@danielnelson
Copy link
Contributor

We need to run go tool cgo -godefs types_linux.go in order to generate the correct types_linux_mips.go file. This is a little tricky because you need to have go running on the edgerouter, and debian does not provide a package for it.

There is an issue open on gopsutil shirou/gopsutil#273, so I would follow up there.

@danielnelson danielnelson changed the title Any chance of getting MIPS builds? Add binary packages for mips architecture Aug 8, 2017
@danielnelson danielnelson added the upstream bug or issues that rely on dependency fixes label Aug 12, 2017
@crablab
Copy link

crablab commented Jan 4, 2019

Is there an ETA on this? This repo implies it is possible to compile telegraf on the EdgeRouters but I'm struggling to find any information anywhere on how people have done this.

@danielnelson
Copy link
Contributor

One potential issue with the packages in #5234 is that Telegraf has a rather large binary, and my Edgerouter model ER-X-SFP only has about 200MB of space. I think to update the firmware you need a good percentage of that space free. This is probably less of an issue on the more expensive models, but it may be worth doing a custom build with only the plugins you are using enabled.

  1. Edit plugins/*/all/all.go, comment out any plugins you don't want.
  2. Build using the regular instructions, but instead run the make command like so:
    GOOS=linux GOARCH=mipsle make
    

@goofus
Copy link

goofus commented Jan 27, 2019

One potential issue with the packages in #5234 is that Telegraf has a rather large binary, and my Edgerouter model ER-X-SFP only has about 200MB of space. I think to update the firmware you need a good percentage of that space free. This is probably less of an issue on the more expensive models, but it may be worth doing a custom build with only the plugins you are using enabled.

1. Edit `plugins/*/all/all.go`, comment out any plugins you don't want.

2. Build using the [regular instructions](https://github.com/influxdata/telegraf#from-source), but instead run the make command like so:
   ```
   GOOS=linux GOARCH=mipsle make
   ```

I tried
GOOS=linux GOARCH=mips make
to use it for openwrt. collectd as an example for a working executable:

/usr/sbin/collectd: ELF 32-bit MSB executable, MIPS, MIPS32 rel2 version 1, dynamically linked, interpreter /lib/ld-musl-mips-sf.so.1, corrupted section header size
telegraf: ELF 32-bit MSB executable, MIPS, MIPS32 version 1 (SYSV), statically linked, not stripped

But I get:

# ./telegraf 
Illegal instruction

Any idea what I am doing wrong? Is something missing?

@danielnelson
Copy link
Contributor

Have you tried GOARCH=mipsle already?

If that's not working then can you run readelf -h telegraf and readelf -h collectd, maybe we will be able to see the issue with the output of those.

@broizter
Copy link

Would like to add a request to also get mips (not mipsel) packages. Currently I have to compile myself to get Telegraf running on my EdgeRouter 4.

@danielnelson danielnelson mentioned this issue Jul 22, 2019
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upstream bug or issues that rely on dependency fixes
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants