librespeed / speedtest-cli

Command line client for LibreSpeed
GNU Lesser General Public License v3.0
485 stars 59 forks source link

Not working on Mips architecture (openwrt) #44

Closed varac closed 2 years ago

varac commented 2 years ago

I'm trying to run speedtest-cli 1.09 on a GL-X750 LTE router. I tried both the -mips-hardfloat and -mips-softfloat binaries, but both stall shortly after starting with no console output. Strace shows:

root@GL-X750:~# strace /tmp/librespeed-cli-mips-hardfloat 
execve("/tmp/librespeed-cli-mips-hardfloat", ["/tmp/librespeed-cli-mips-hardflo"...], 0x7feaaa90 /* 13 vars */) = 0
open("/proc/self/exe", O_RDONLY)        = 3
mmap(NULL, 2378876, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x77d55000
mmap(0x77d55000, 2378033, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0x77d55000
cacheflush(0x77f99244, 0xa38, 0x3)      = 0
mprotect(0x77f98000, 7292, PROT_READ|PROT_EXEC) = 0
readlink("/proc/self/exe", "/tmp/librespeed-cli-mips-hardflo"..., 4095) = 34
cacheflush(0x7fba0fb0, 0x114, 0x3)      = 0
mmap(0x10000, 6762496, PROT_NONE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x10000
mmap(0x10000, 3677824, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x10000
cacheflush(0x10000, 0x114, 0x3)         = 0
cacheflush(0x10114, 0x381d6c, 0x3)      = 0
mprotect(0x10000, 3677824, PROT_READ|PROT_EXEC) = 0

CPU info:

root@GL-X750:~# cat /proc/cpuinfo 
system type     : Qualcomm Atheros QCA9533 ver 2 rev 0
machine         : GL.iNet GL-X750 (NOR)
processor       : 0
cpu model       : MIPS 24Kc V7.4
BogoMIPS        : 432.53
wait instruction    : yes
microsecond timers  : yes
tlb_entries     : 16
extra interrupt vector  : yes
hardware watchpoint : yes, count: 4, address/irw mask: [0x0ffc, 0x0ffc, 0x0ffb, 0x0ffb]
isa         : mips1 mips2 mips32r1 mips32r2
ASEs implemented    : mips16
Options implemented : tlb 4kex 4k_cache prefetch mcheck ejtag llsc dc_aliases perf_cntr_intr_bit nan_legacy nan_2008 perf
shadow register sets    : 1
kscratch registers  : 0
package         : 0
core            : 0
VCED exceptions     : not available
VCEI exceptions     : not available

Am I using the right binaries ? From what I can see I don't have a 64bit architecture. What's the difference between -softfload and -hardfloat, and between -mips and -mipsle` ?

maddie commented 2 years ago

Try decompressing the binary using upx

On Sat, Jan 1, 2022 at 23:08 Varac @.***> wrote:

I'm trying to run speedtest-cli 1.09 on a GL-X750 LTE router https://www.gl-inet.com/products/gl-x750. I tried both the -mips-hardfloat and -mips-softfloat binaries, but both stall shortly after starting with no console output. Strace shows:

@.**:~# strace /tmp/librespeed-cli-mips-hardfloat execve("/tmp/librespeed-cli-mips-hardfloat", ["/tmp/librespeed-cli-mips-hardflo"...], 0x7feaaa90 / 13 vars */) = 0 open("/proc/self/exe", O_RDONLY) = 3 mmap(NULL, 2378876, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x77d55000 mmap(0x77d55000, 2378033, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0x77d55000 cacheflush(0x77f99244, 0xa38, 0x3) = 0 mprotect(0x77f98000, 7292, PROT_READ|PROT_EXEC) = 0 readlink("/proc/self/exe", "/tmp/librespeed-cli-mips-hardflo"..., 4095) = 34 cacheflush(0x7fba0fb0, 0x114, 0x3) = 0 mmap(0x10000, 6762496, PROT_NONE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x10000 mmap(0x10000, 3677824, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x10000 cacheflush(0x10000, 0x114, 0x3) = 0 cacheflush(0x10114, 0x381d6c, 0x3) = 0 mprotect(0x10000, 3677824, PROT_READ|PROT_EXEC) = 0

CPU info:

@.***:~# cat /proc/cpuinfo system type : Qualcomm Atheros QCA9533 ver 2 rev 0 machine : GL.iNet GL-X750 (NOR) processor : 0 cpu model : MIPS 24Kc V7.4 BogoMIPS : 432.53 wait instruction : yes microsecond timers : yes tlb_entries : 16 extra interrupt vector : yes hardware watchpoint : yes, count: 4, address/irw mask: [0x0ffc, 0x0ffc, 0x0ffb, 0x0ffb] isa : mips1 mips2 mips32r1 mips32r2 ASEs implemented : mips16 Options implemented : tlb 4kex 4k_cache prefetch mcheck ejtag llsc dc_aliases perf_cntr_intr_bit nan_legacy nan_2008 perf shadow register sets : 1 kscratch registers : 0 package : 0 core : 0 VCED exceptions : not available VCEI exceptions : not available

Am I using the right binaries ? From what I can see I don't have a 64bit architecture. What's the difference between -softfload and -hardfloat, and between -mips and -mipsle` ?

— Reply to this email directly, view it on GitHub https://github.com/librespeed/speedtest-cli/issues/44, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABWFMBD3IG77UTILMKBUODUT4KFFANCNFSM5LCSIQSA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Yours, Maddie

varac commented 2 years ago

@maddie Thx, I tried using upx but it doesn't start neither. I downloaded https://github.com/upx/upx/releases/download/v3.96/upx-3.96-mips_linux.tar.xz to my laptop, extracted the archive using tar -xJf upx-3.96-mipsel_linux.tar.xz and copied the upx binary to the router. There it stalls at the same stage, wonder what I'm doing wrong:

root@GL-X750:/tmp# strace ./upx
execve("./upx", ["./upx"], 0x7faf10d0 /* 13 vars */) = 0
open("/proc/self/exe", O_RDONLY)        = 3
mmap(NULL, 438624, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x77f06000
mmap(0x77f06000, 437605, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0x77f06000
cacheflush(0x77f70728, 0xa38, 0x3)      = 0
mprotect(0x77f6f000, 8544, PROT_READ|PROT_EXEC) = 0
readlink("/proc/self/exe", "/tmp/upx", 4095) = 8
cacheflush(0x7fce30e0, 0xf4, 0x3)       = 0
mmap(0x400000, 2363392, PROT_NONE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x400000
mmap(0x400000, 2241500, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x400000
cacheflush(0x400000, 0xf4, 0x3)         = 0
cacheflush(0x4000f4, 0x2232e8, 0x3)     = 0
mprotect(0x400000, 2241500, PROT_READ|PROT_EXEC) = 0
varac commented 2 years ago

Well I just found that this is a know issue with upx and their latest release doesn't work on mips :/

varac commented 2 years ago

Ooh, nice I uncompressed it using upx on my laptop and now it works ! Thx @maddie for the hint. Might be good to document this in the README.

maddie commented 2 years ago

No problem. I'll close this issue as fixed.