showwin/speedtest-go

Add cross compilation target/release for MIPS

Closed this issue · 2 comments

Hi, I'm trying to use this tool from my dd-wrt box, which runs MIPS. I'm going to try and cross compile it and will submit a PR if I get it to work successfully, but it would be nice to have a MIPS release!

I was able to compile this for my system (an Archer-C7) with the following cpuinfo:

system type             : Qualcomm Atheros QCA9558 ver 1 rev 1.0 (0x1130)
processor               : 0
cpu model               : MIPS 74Kc V5.0

using the following build command:

GOOS=linux GOARCH=mips GOMIPS=softfloat go build

I then transferred it from the host by running:

on host: python3 -m http.server

on dd-wrt: curl 192.168.x,y:8000/speedtest-go --output speedtest && chmod +x ./speedtest && ./speedtest

This resulted in the following error:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 8279k  100 8279k    0     0  25.7M      0 --:--:-- --:--:-- --:--:-- 25.8M
Warning: Cannot fetch user information. http://www.speedtest.net/speedtest-config.php is temporarily unavailable.
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x4 pc=0x346720]

goroutine 1 [running]:
main.showUser(0x0)
        /home/jer/go/src/github.com/showwin/speedtest-go/speedtest.go:138 +0x30
main.main()
        /home/jer/go/src/github.com/showwin/speedtest-go/speedtest.go:36 +0x438

Presumably this is because FetchUserInfo() returns nil and the program continues executing. On this system, the result of

curl http://www.speedtest.net/speedtest-config.php is empty, so it may be something having to do with the user agent settings that's making this fail.

As a fun side note, I realised that this system came already equipped with speedtest_cli, so I'm going to just use that instead! But hopefully this issue will help improve your software.

Happy to test any fixes on this system for you, if you decide to try making a fix.

@ijustlovemath
Thank you for your proposal!

About this error

Warning: Cannot fetch user information. http://www.speedtest.net/speedtest-config.php is temporarily unavailable.

#63 change will solve the problem.

and of course I welcome to have a MIPS release. Currently, we use goreleaser-action plugin here, so I'm glad if we can pass some option to get MIPS release.