membraneframework / membrane_core

The core of the Membrane Framework, advanced multimedia processing framework
https://membrane.stream
Apache License 2.0
1.22k stars 35 forks source link

Cannot run on livebook windows #775

Closed RudolfVonKrugstein closed 2 months ago

RudolfVonKrugstein commented 3 months ago

Hi,

When I try this part of the livebook on my windows machine:

Logger.configure(level: :info)

Mix.install([
  :membrane_hackney_plugin,
  :membrane_mp3_mad_plugin,
  :membrane_portaudio_plugin
])

I get

** (Mix.Error) Bundlex: Unable to find Visual Studio root directory. Please ensure that it is either located in "c:\Program Files (x86)\Microsoft Visual Studio *" or VISUAL_STUDIO_ROOT environment variable pointing to its root is set.
    (mix 1.15.7) lib/mix.ex:577: Mix.raise/2
    (bundlex 1.4.6) lib/bundlex/toolchain/visual_studio.ex:70: Bundlex.Toolchain.VisualStudio.run_vcvarsall/1
    (bundlex 1.4.6) lib/bundlex/toolchain/visual_studio.ex:30: Bundlex.Toolchain.VisualStudio.before_all!/1
    (bundlex 1.4.6) lib/mix/tasks/compile.bundlex.ex:36: Mix.Tasks.Compile.Bundlex.run/1
    (mix 1.15.7) lib/mix/task.ex:455: anonymous fn/3 in Mix.Task.run_task/5
    (mix 1.15.7) lib/mix/tasks/compile.all.ex:124: Mix.Tasks.Compile.All.run_compiler/2
    (mix 1.15.7) lib/mix/tasks/compile.all.ex:104: Mix.Tasks.Compile.All.compile/4

I have Visual Studio 2022 installed.

When I look in the failing code in bundlex, it seems to me that it looks for the Visual Studio Directory at C:\Program Files (x86)\Microsoft Visual Studio, which is a directory that exists on my Machine. Then it looks into the VC sub-directory and needs the vcvarsall.bat script.

On my Machine this script is located at C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build.

Is my installation if Visual Studio wrong? Do I need to install something else or how can I fix this?

Thanks!

FelonEkonom commented 2 months ago

Hi! I am very sorry for responding you so late 😞, we somehow omitted your issue. Our tool used to compile native dependencies (Bundlex) doesn't really support Windows for now. You can try to setup your livebook server on Linux or MacOS. Livebook has a section in readme about running it using Docker, I haven't done it for my own but I think that it should be helpful

mat-hek commented 2 months ago

To add to @FelonEkonom 's answer, you can use WSL to run Membrane on Windows. Unfortunately, accessing the camera, microphone and speakers doesn't work through WSL. If you're using Livebook, you can try https://github.com/membraneframework-labs/membrane_kino_plugin. As for now, we don't plan to support Windows, but we are open to contributions in that regard.

OndrejValenta commented 1 month ago

Just to add to this..

After I fixed the path where budlex is looking for vcvarsall like this

image

I get a new error which is more related to some inner workings of bundlex

image

mat-hek commented 1 month ago

Yes, that's because the Windows toolchain doesn't support libs, which are the Bundlex way to share C code between Mix projects. I created a very basic example: https://github.com/membraneframework-labs/bundlex_simple_example that doesn't use any of the complex features - I suggest starting with that and then we'll figure out the rest ;)