Coder Social home page Coder Social logo

Comments (26)

grtcdr avatar grtcdr commented on September 7, 2024 1

Thank you so much for the great explinaton. But when i try this, all i get is -

~ $ ./macchina-linux
Failed to execute process './macchina-linux'. Reason:
exec: Exec format error
The file './macchina-linux' is marked as an executable but could not be run by the operating system.

I forgot to mention that macchina-linux (from the releases page) only runs on x86_64 machines, and Raspberry Pi is probably ARM right?

EDIT: I'll create an action that builds macchina for ARM machines.

from macchina.

uttarayan21 avatar uttarayan21 commented on September 7, 2024 1

There are two ways you can get it to run on your rpi

  • cargo supports cross compiling directly if you specify a linker and an ar for the target.
  • You can use cross which makes it super easy to cross compile.

Use this to list rust targets and then

rustup target list | grep arm

Using cross build with

cross build --target=arm-unknown-linux-gnueabi --release

Then copy the binary over to your Raspberry pi.

from macchina.

uttarayan21 avatar uttarayan21 commented on September 7, 2024 1

Oops, GitHub doesn't offer ARM runners and I don't have any ARM machines lying around to make a self-hosted runner, and creating an ARM VM on my x86_64 machine is beyond my realm of knowledge 😕

That is true but there are a lot of arm targets and I'm not sure for which one to build lol.

arm-linux-androideabi
arm-unknown-linux-gnueabi
arm-unknown-linux-gnueabihf
arm-unknown-linux-musleabi
arm-unknown-linux-musleabihf
armebv7r-none-eabi
armebv7r-none-eabihf
armv5te-unknown-linux-gnueabi
armv5te-unknown-linux-musleabi
armv7-linux-androideabi
armv7-unknown-linux-gnueabi
armv7-unknown-linux-gnueabihf
armv7-unknown-linux-musleabi
armv7-unknown-linux-musleabihf
armv7a-none-eabi
armv7r-none-eabi
armv7r-none-eabihf

If you want I can try to setup a github action for cross compiling for arm targets.

from macchina.

uttarayan21 avatar uttarayan21 commented on September 7, 2024 1

Well I'm working on a github action right now to compile for arm and a few other targets so you can directly download binaries.
I'll update when its done.

from macchina.

grtcdr avatar grtcdr commented on September 7, 2024 1

@Dan1jel you can try to download macchina-linux-aarch64 until a new tag is available on this repo.

I'll release a new version so he doesn't have to wait too long for the next release.

from macchina.

uttarayan21 avatar uttarayan21 commented on September 7, 2024 1

Can you try this binary ? macchina-linux-rpi3b
This is built for target armv7-unknown-linux-gnueabihf which is what Raspbian should be.

from macchina.

grtcdr avatar grtcdr commented on September 7, 2024

Building Rust code from source is usually like that, I recommend you download and run the prebuilt binaries that you can find in the releases page.

from macchina.

Dan1jel avatar Dan1jel commented on September 7, 2024

Building Rust code from source is usually like that, I recommend you download and run the prebuilt binaries that you can find in the releases page.

Ok, that could work, i mean its not the easiest but as long as it works. But for a newbie like me, how do i build from binaries? i tried to search the web but all i can think of is "cargo install" but that will make my Raspberry throttle (and probably fail the install).

from macchina.

grtcdr avatar grtcdr commented on September 7, 2024

Ok, that could work, i mean its not the easiest but as long as it works. But for a newbie like me, how do i build from binaries? i tried to search the web but all i can think of is "cargo install" but that will make my Raspberry throttle (and probably fail the install).

The releases page has prebuilt binaries, meaning source code that was built and can be run directly, you mentioned you're on trying to run macchina for your Raspberyy Pi, so you can click the macchina-linux link which will download the binary for you, and all you have to do is chmod +x macchina-linux to give it execute permissions.

After doing that, just run ./macchina-linux or place it in your PATH e.g. in ~/.local/share or /usr/bin/ which will then allow you to run it from anywhere on your system.

cargo install looks through the crates.io registry and builds the package you're looking for from source, meaning your CPU is going to be running at full throttle until the build process is finished.

from macchina.

Dan1jel avatar Dan1jel commented on September 7, 2024

Ok, that could work, i mean its not the easiest but as long as it works. But for a newbie like me, how do i build from binaries? i tried to search the web but all i can think of is "cargo install" but that will make my Raspberry throttle (and probably fail the install).

The releases page has prebuilt binaries, meaning source code that was built and can be run directly, you mentioned you're on trying to run macchina for your Raspberyy Pi, so you can click the macchina-linux link which will download the binary for you, and all you have to do is chmod +x macchina-linux to give it execute permissions.

After doing that, just run ./macchina-linux or place it in your PATH e.g. in ~/.local/share or /usr/bin/ which will then allow you to run it from anywhere on your system.

cargo install looks through the crates.io registry and builds the package you're looking for from source, meaning your CPU is going to be running at full throttle until the build process is finished.

Thank you so much for the great explinaton. But when i try this, all i get is -

~ $ ./macchina-linux
Failed to execute process './macchina-linux'. Reason:
exec: Exec format error
The file './macchina-linux' is marked as an executable but could not be run by the operating system.

from macchina.

Dan1jel avatar Dan1jel commented on September 7, 2024

Thank you so much for the great explinaton. But when i try this, all i get is -
~ $ ./macchina-linux
Failed to execute process './macchina-linux'. Reason:
exec: Exec format error
The file './macchina-linux' is marked as an executable but could not be run by the operating system.

I forgot to mention that macchina-linux (from the releases page) only runs on x86_64 machines, and Raspberry Pi is probably ARM right?

EDIT: I'll create an action that builds macchina for ARM machines.

That is correct, i was just about to update my post but yes its because Raspberry is ARM based that it wont work.

That would be great! And more people can enjoy this as well with ARM machines.

from macchina.

grtcdr avatar grtcdr commented on September 7, 2024

Oops, GitHub doesn't offer ARM runners and I don't have any ARM machines lying around to make a self-hosted runner, and creating an ARM VM on my x86_64 machine is beyond my realm of knowledge 😕

from macchina.

Dan1jel avatar Dan1jel commented on September 7, 2024

Oops, GitHub doesn't offer ARM runners and I don't have any ARM machines lying around to make a self-hosted runner, and creating an ARM VM on my x86_64 machine is beyond my realm of knowledge 😕

Aaaw that's sad :/ hope that gets change in the future but thanks for looking in to it anyway.

from macchina.

grtcdr avatar grtcdr commented on September 7, 2024

Oops, GitHub doesn't offer ARM runners and I don't have any ARM machines lying around to make a self-hosted runner, and creating an ARM VM on my x86_64 machine is beyond my realm of knowledge confused

That is true but there are a lot of arm targets and I'm not sure for which one to build lol.

arm-linux-androideabi
arm-unknown-linux-gnueabi
arm-unknown-linux-gnueabihf
arm-unknown-linux-musleabi
arm-unknown-linux-musleabihf
armebv7r-none-eabi
armebv7r-none-eabihf
armv5te-unknown-linux-gnueabi
armv5te-unknown-linux-musleabi
armv7-linux-androideabi
armv7-unknown-linux-gnueabi
armv7-unknown-linux-gnueabihf
armv7-unknown-linux-musleabi
armv7-unknown-linux-musleabihf
armv7a-none-eabi
armv7r-none-eabi
armv7r-none-eabihf

If you want I can try to setup a github action for cross compiling for arm targets.

Yeah, give it a go!

I personally didn't feel comfortable making a mess out of it, because as you mentioned, there's so many ARM targets out there, and that was partly what made me so confused.

from macchina.

Dan1jel avatar Dan1jel commented on September 7, 2024

There are two ways you can get it to run on your rpi

  • cargo supports cross compiling directly if you specify a linker and an ar for the target.
  • You can use cross which makes it super easy to cross compile.

Use this to list rust targets and then

rustup target list | grep arm

Using cross build with

cross build --target=arm-unknown-linux-gnueabi --release

Then copy the binary over to your Raspberry pi.

Great tip but i just can't get it to work.

from macchina.

grtcdr avatar grtcdr commented on September 7, 2024

Where exactly are you finding problems?

from macchina.

Dan1jel avatar Dan1jel commented on September 7, 2024

Where exactly are you finding problems?

By doing/trying these commands, my system don't know what to do with these commands.

 rustup target list | grep arm
cross build --target=arm-unknown-linux-gnueabi --release

from macchina.

grtcdr avatar grtcdr commented on September 7, 2024

Where exactly are you finding problems?

By doing/trying these commands, my system don't know what to do with these commands.

 rustup target list | grep arm

You may not have rustup installed then. But here's the output of that command:

arm-linux-androideabi
arm-unknown-linux-gnueabi
arm-unknown-linux-gnueabihf
arm-unknown-linux-musleabi
arm-unknown-linux-musleabihf
armebv7r-none-eabi
armebv7r-none-eabihf
armv5te-unknown-linux-gnueabi
armv5te-unknown-linux-musleabi
armv7-linux-androideabi
armv7-unknown-linux-gnueabi
armv7-unknown-linux-gnueabihf (installed)
armv7-unknown-linux-musleabi
armv7-unknown-linux-musleabihf
armv7a-none-eabi
armv7r-none-eabi
armv7r-none-eabihf
cross build --target=arm-unknown-linux-gnueabi --release

I don't know why this wouldn't work if you've correctly installed both cross and docker (with the docker.service running in the background).

from macchina.

uttarayan21 avatar uttarayan21 commented on September 7, 2024

Another thing, depending on the version of your Raspberry PI, you might need to use --target=aarch64-unknown-linux-gnu.

from macchina.

Dan1jel avatar Dan1jel commented on September 7, 2024

Where exactly are you finding problems?

By doing/trying these commands, my system don't know what to do with these commands.

 rustup target list | grep arm

You may not have rustup installed then. But here's the output of that command:

arm-linux-androideabi
arm-unknown-linux-gnueabi
arm-unknown-linux-gnueabihf
arm-unknown-linux-musleabi
arm-unknown-linux-musleabihf
armebv7r-none-eabi
armebv7r-none-eabihf
armv5te-unknown-linux-gnueabi
armv5te-unknown-linux-musleabi
armv7-linux-androideabi
armv7-unknown-linux-gnueabi
armv7-unknown-linux-gnueabihf (installed)
armv7-unknown-linux-musleabi
armv7-unknown-linux-musleabihf
armv7a-none-eabi
armv7r-none-eabi
armv7r-none-eabihf
cross build --target=arm-unknown-linux-gnueabi --release

I don't know why this wouldn't work if you've correctly installed both cross and docker (with the docker.service running in the background).

Rustup and cross is not available on apt install

It would be nice to have macchina and i could maybe get it to work eventually but my thought was that it maybe could be easy to get this running. Also an idea was to maybe do a easy script to install it again (if i get a new harddrive or rpi), this is making it a little hard to have on a simple install script in the future.

from macchina.

uttarayan21 avatar uttarayan21 commented on September 7, 2024

@Dan1jel you can try to download macchina-linux-aarch64 until a new tag is available on this repo.

from macchina.

Dan1jel avatar Dan1jel commented on September 7, 2024

@Dan1jel you can try to download macchina-linux-aarch64 until a new tag is available on this repo.

I'll release a new version so he doesn't have to wait too long for the next release.

I'm really glad that you all being this helpful, but i still can't use this.

~ $ ./macchina-linux-aarch64

Failed to execute process './macchina-linux-aarch64'. Reason: exec: Exec format error

The file './macchina-linux-aarch64' is marked as an executable but could not be run by the operating system.

from macchina.

uttarayan21 avatar uttarayan21 commented on September 7, 2024

Can you run uname -m in the rpi and post the output ?

I can then try to post a binary for your hardware target.

from macchina.

Dan1jel avatar Dan1jel commented on September 7, 2024

Can you run uname -m in the rpi and post the output ?

I can then try to post a binary for your hardware target.

Sure thing, armv7l (Raspberry 3B)

from macchina.

Dan1jel avatar Dan1jel commented on September 7, 2024

Can you try this binary ? macchina-linux-rpi3b
This is built for target armv7-unknown-linux-gnueabihf which is what Raspbian should be.

This works like a charm! thank you so much for quick reply and helping me with this.

from macchina.

uttarayan21 avatar uttarayan21 commented on September 7, 2024

No problem :)
Happy to help.

from macchina.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.