-
Notifications
You must be signed in to change notification settings - Fork 21
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
Nerves support - precompiled artifacts #130
Comments
Update: can confirm that these are two separate issues. I added
EDIT: I should also note that I didn't have any issues with this dependency while developing locally on my Mac. Not sure what about the prod build for the target which broke it instead... |
Additionally, I poked around and saw that I can set the
However, now I'm getting some other compilation errors, relating to incompatible pointer types. They're treated as errors though, so it might work if I can find a way to force the compilation...
|
Hey @gworkman, thanks for checking out the project and for sharing your attempts at fixing the compilation. I never tested Vix with nerves yet. My first guess is that I have to update NIF compilation scripts to respect |
Hi @akash-akya! Thanks for the prompt response on this :) that totally makes sense. I'd be happy to help poke around some more to see if I can compile it, if I can get some pointers on where to start. I have to admit though I haven't the most experience with more than a basic makefile. |
Hi @gworkman, Btw, you should be able to compile firmware if you run the compilation process on rpi3 itself. I'll look into the possibility of supporting cross-compilation, but with my currently understanding it needs significant changes and might take a while. Thanks! |
Thanks @akash-akya for looking into it! Makes sense that it's going to have some issue on the function generation if it can't read the NIF at compile time. Have you pushed the updated script to a branch? I'd love to test building on a separate RPi3. Additionally, one thought I have is that when creating a custom nerves system, it compiles a custom Linux kernel and Elixir dependencies in a Docker container. I'm wondering if we can put Vix in the nerves system's mix.exs and take advantage of that Docker build step? Edit: docs to nerves custom system https://hexdocs.pm/nerves/customizing-systems.html I'm happy to give this idea a try later today 🙂 |
No change required for this, you should be able to build NIF as it is. Let me know if you face any issues. The changes I made were to make cross-compilation work. If you are compiling on RPi3 itself, then it should work by default.
Interesting. I have to check more details on this. Basically the architecture where we compile the code and where we run the code should be the same. With docker, the CPU arch would still be the host machine, right?
That's great! Let me know how it goes or if you need any help 🙂 |
Hi @akash-akya! Sorry for the radio silence on my end - things got busy! I had a chance to try things out today. Using the latest 0.25.0 release, I tested compilation again for my nerves target. Unfortunately, I still had to do a bunch of the workarounds listed above to even get it to try to compile things. This includes:
Even then, it doesn't compile the NIF correctly, as it errors with the same as above:
I noticed that the commit you referenced from a few weeks back added the precompiled versions, but it doesn't seem like it worked for me? At least, from above it seems like it isn't picking up the correct toolchain automatically. Also, as you suspected, the attempt to compile in Docker didn't work either. The architecture stuff makes sense, I don't use it too much so not an expert. For reference, I'm working on an intel-based Mac, with Elixir version Thanks for your time on this - I'd love to migrate away from OpenCV for this project. Let me know where I should poke around next 🙂 |
Hi @gworkman, thanks for testing it! Can you ssh to RPi3 and test this and share result?
Mix.install([{:vix, "~> 0.25.0"}])
alias Vix.Vips.{Image, Operation}
:ok =
Operation.black!(500, 500, bands: 3)
|> Image.write_to_file("black.jpg")
If you see any errors, please share.
I can understand, I am on a similar boat. Please take your time |
Ah, this looks like where we are differing! I'm specifically targeting Nerves, which compiles the firmware (including Elixir release and NIFs) on the host device, in my case an Intel-based MacBook. So yea, I think that would be cross compiling, because Nerves ships a toolchain to compile the native code for the target platform. EDIT Here's the steps to reproduce what I'm doing:
I'd be happy to do the above steps and push it to a minimum reproducible example repo if you'd like 🙂
I appreciate the help (and enthusiasm!) you've provided so far, be sure to take care of yourself as well! |
I see. Yeah this won't work because Vix library must load the NIF (which is compiled for RPi3) to generate elixir code on macos like I mentioned before. But you could be able to do this on RPi itself though. I mean build the nerves firmware on the RPi3 itself. There are few others options, such as building firmware using github actions, or using a virtual machine. I'll look into if it is possible to compile multiple NIF and load different nifs based on target |
Yeah this makes complete sense. I think I intuitively understand this, but was excited that you mentioned you got it to work. I probably don't want to compile on GHA/a separate RPi3 because it will significantly reduce my workflow speed, but the approach to compile multiple NIFs and load different ones at runtime seems promising! Is there a way I can contribute? |
Hello! First, thanks for such a great library. I've primarily been working with OpenCV, and I've been enjoying using something a little lighter-weight but still full featured. However, I'm running into some issues for my Nerves deployment, and hoping to find a fix.
I am trying to use Image/Vix in a Nerves project, based on a Raspberry Pi 3B. I'm running into some issues with the precompiled artifacts - I can see that when I try to make a firmware by running
MIX_ENV=prod MIX_TARGET=rpi3 mix firmware
that it is trying to downloadlibvips
for Mac. I think I need would need the vix-nif-2.17-armv7l-linux-gnueabihf-0.23.1.tar.gz and libvips-8.14.2-linux-armv7.tar.gz precompiled artifacts instead.I haven't used
elixir_make
before, so not sure if this is just a quick config thing to set.I'm a little perplexed though because it look like it isn't even a compilation problem - rather the
:http_util
module isn't available for the download? I found this similar issue about the code load paths changing in OTP 26/Elixir 1.15Thanks!
The text was updated successfully, but these errors were encountered: