Skip to content
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

vendoring and precompilation #20

Open
kevinschweikert opened this issue Oct 23, 2024 · 6 comments
Open

vendoring and precompilation #20

kevinschweikert opened this issue Oct 23, 2024 · 6 comments

Comments

@kevinschweikert
Copy link
Contributor

Hey, just wanted to ask you, if in the context of elixir-nx/bumblebee#403 it would make sense to vendor the libs and support precompilation as mentionen by the bumblebee maintainers.
Would you be open to it?

@mickel8
Copy link
Member

mickel8 commented Oct 23, 2024

Hi, I tried providing ffmpeg as precompiled dependency but it wasn't too easy. Anyway, I am open for suggestions :)

@kevinschweikert
Copy link
Contributor Author

I'm absolutely no expert in this matter but wouldn't it be enough to add ffmpeg dev dependencies in CI and add configure elixir_make like in this Precompilation Guide? Or am i missing something?

@kevinschweikert kevinschweikert changed the title vendorring and precompilation vendoring and precompilation Oct 23, 2024
@mickel8
Copy link
Member

mickel8 commented Oct 24, 2024

But this only instructs how to create a precompiled version of OUR NIF, correct? And what we need to do at first is to make Xav download precompiled version of FFmpeg instead of using the one installed on your OS. If we have the latter one, we can think about precompiling Xav itself. Does it make sesne?

@mickel8
Copy link
Member

mickel8 commented Oct 29, 2024

Hi @kevinschweikert, any ideas what to do with this one 😅

@kevinschweikert
Copy link
Contributor Author

Okay, here are my thoughts. Currently, we dynamically link iibav packages and expect them to be available on the system which runs xav. We could either precompile the NIF with statically linked libraries for each of the operating systems/architectures. That should(?) be possible with CI.
The other thing I was thinking about using the zig build chain, to cross compile from a single host system. This would make CI much simpler. We wouldn't have to write Zig code because zig can compile C/C++ code natively.
I was looking at https://github.com/allyourcodebase/ffmpeg where they compile ffmpeg with zig. The https://github.com/burrito-elixir/burrito project also uses zig to compile an Elixir application to a cross-platform executable.
I would need some time, to figure out, how all this works and if the zig way is a good way but would be happy to work on it, when you think, that this could be a benefit for xav

@kevinschweikert
Copy link
Contributor Author

kevinschweikert commented Nov 12, 2024

Hey @mickel8 i'm slooooowly wrapping my head around this! The missing piece for me was that libavcodec for example is also already a precompiled artifact and not the source code itself. Somehow i missed that in my understanding. That's why you said, that we would have to precompile ffmpeg ourselves! I watched some talks about zigler and with E-xyza/zigler#479 it could be a great solution. I will investigate more about compiling libav/ffmpeg with zig and zigler

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants