-
-
Notifications
You must be signed in to change notification settings - Fork 297
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 support for OpenWRT #169
Comments
Sure, glad you like it :) Does the generic binary in the releases work on OpenWRT? |
@imsnif The generic binary raises following error when I try to run it.
|
Wow, that's really odd! I don't know a lot about OpenWRT, but are you able to run other musl binaries normally? Could you walk me through the process you did from downloading the binary until running? Maybe there's a clue there? |
@imsnif I actually never run musl binary directly in OpenWRT. I will check more about running musl binary in OpenWRT. Can you let me know where the building code reside? |
Sounds to me like your OpenWRT is installed on a non-x86 architecture and can't run x86_64 binaries. If execve() returns ENOEXEC (An executable is not in a recognized format, is for the wrong architecture, or has some other format error that means it cannot be executed.), the shell falls back to /bin/sh, which prints a ridiculous error. To fix, compile for the correct architecture, not x86_64. To find which architecture you're on, use |
@Alcaro I am using Linksys WRT3200ACM which seems like using arm processor.
|
@safwanrahman - I think your best bet in this case, as @Alcaro mentions, would be to compile the source with cargo (directly on the openwrt machine), as described here: https://github.com/imsnif/bandwhich#other-linux-flavours |
@imsnif Thanks. Can you guide me how you are building currently? As I need to build it in my host machine for ARM then transfer it to the router. |
Compiling anything needs a lot of RAM, CPU and storage - resources which are typically not abundant on routers. I think your best bet would be installing Cargo on a PC and telling it to cross compile. Googling 'rust openwrt' returns a few relevant-looking things, or you can try 'rust cross compile armv7l'. Alternatively, you may be able to install an emulated armv7l environment on your PC, using (for example) QEMU. Emulating an ARM is slower than a native cross compiler, but may be easier to set up. Or maybe it's harder - I don't know how easy Rust is to cross compile. |
Thanks very much for your input @Alcaro! I think the idea of running bandwhich on OpenWRT is quite interesting. So @safwanrahman - if you get it to work, I would very much like to hear more. Maybe we could make it easier for others wanting to do this. |
I do a Doing some searching, this seems like a good place to start: https://github.com/japaric/rust-cross Please feel free to reach out if you're having trouble. |
Hi! Sorry to jump in out of nowhere, but could you run EDIT: Whoops, I totally missed the different CPU architecture, you'll likely still need to cross compile. Sorry about that! |
@TheLostLambda Thanks for the concern! I have run |
Seems like not possible at this moment because of rust bug rust-lang/rust#37507 |
So after working a lot the night and day, Finally I have got a suggestion of my fellow friend @mominul to use rust-embedded/cross to cross compile for OpenWRT machine and it worked! 🥳 🚀 At first I compiled with |
I'm really happy to hear that, @safwanrahman - great work! Would you be willing to create a pull request to add these instructions to the README? I think it will be really helpful to others wanting to do the same. Either that or if you prefer, you can write down the commands you used here and I'll add it. |
@imsnif Sure, I am writing the process below. I am currently trying to figure out to cross compile for the targets so that it can be installed by the Opkg Package Manager.
@imsnif Can you arrange the instruction and write it down in the README? I can not figure out how to put it in there. BTW, thanks a lot @Alcaro for pointing the architecture issue. I would have never found it if you did not mention in the earlier comment. |
Thank you very much @safwanrahman! I'll write it up in the README in the next few days. |
I added these instructions to the readme. Thanks again @safwanrahman for sharing these! |
Oh, I just noticed this. I don't know why you were mentioning me, but I'm glad that this seems to have been closed. |
By the way, since I don't use macOS anymore and use Windows (WSL2) and Void Linux, I will mainly update the Void Linux's package repository. Of course, it's not impossible for me to maintain Homebrew one, so please let me know if you need it. |
Oh, I see. No worries 🙂 |
Since we're doing cross-compile stuff in #401, we might as well revisit this and add prebuilt binaries for armv7 targets. |
Thanks a lot for the nice and useful package. As OpenWRT is also a linux distribution, is it possible to build a binary for OpenWRT?
The text was updated successfully, but these errors were encountered: