Error when compiling free4chat

This is probably pretty basic but I'm at square one. I get an error when I'm compiling free4chat, a user-contributed elixir app that depends on membrane. > mix ecto.reset
==> free4chat
Unchecked dependencies for environment dev:
* membrane_rtc_engine (https://github.com/membraneframework/membrane_rtc_engine.git)
could not find an app file at "_build/dev/lib/membrane_rtc_engine/ebin/membrane_rtc_engine.app". This may happen if the dependency was not yet compiled or the dependency indeed has no app file (then you can pass app: false as option)
** (Mix) Can't continue due to errors on dependencies
==> free4chat
Unchecked dependencies for environment dev:
* membrane_rtc_engine (https://github.com/membraneframework/membrane_rtc_engine.git)
could not find an app file at "_build/dev/lib/membrane_rtc_engine/ebin/membrane_rtc_engine.app". This may happen if the dependency was not yet compiled or the dependency indeed has no app file (then you can pass app: false as option)
** (Mix) Can't continue due to errors on dependencies
how do I make sure the membrane dep is built first?
6 Replies
sgfn
sgfn•11mo ago
Hi @michaelh! Correct me if I'm wrong, but it appears like the app you're referring to is locking onto the master branch of the membrane_rtc_engine github repo instead of a specific version or commit. This is highly discouraged and should never be done, as the Engine is under constant development and its API can change between releases. The reason you're seeing this specific error is due to a restructure of the repo we've done around half a year ago. Starting with v0.16.0, you have to explicitly specify the Endpoints you're using (in your case, probably only membrane_rtc_engine_webrtc) as well as the membrane_rtc_engine package. To fix this error, try replacing the relevant line in mix.exs with
{:membrane_rtc_engine, "~> 0.20.0"},
{:membrane_rtc_engine_webrtc, "~> 0.6.0"},
{:membrane_rtc_engine, "~> 0.20.0"},
{:membrane_rtc_engine_webrtc, "~> 0.6.0"},
I can't guarantee that this will make the app compile, though, as there may have been changes to the API since the restructure. You might need to roll back the Engine version a bit and find the most recent one that works. If the app you've mentioned is still maintained, you might additionally want to notify their maintainers of this issue 😉
michaelh
michaelhOP•11mo ago
@sgfn hey thanks, that actually helped a lot and I'm at the point where I'm just hitting runtime errors due to library deprecation. so for rtc engine 0.6.0 it looks like there is no longer a Membrane.RTC.Engine.Message.MediaEvent because I got this error:
** (CompileError) lib/free4chat/room.ex:94: Membrane.RTC.Engine.Message.MediaEvent.__struct__/0 is undefined, cannot expand struct Membrane.RTC.Engine.Message.MediaEvent. Make sure the struct name is correct. If the struct name exists and is correct but it still cannot be found, you likely have cyclic module usage in your code
** (CompileError) lib/free4chat/room.ex:94: Membrane.RTC.Engine.Message.MediaEvent.__struct__/0 is undefined, cannot expand struct Membrane.RTC.Engine.Message.MediaEvent. Make sure the struct name is correct. If the struct name exists and is correct but it still cannot be found, you likely have cyclic module usage in your code
def handle_info(%Message.MediaEvent{to: :broadcast, data: data}, state) do
def handle_info(%Message.MediaEvent{to: :broadcast, data: data}, state) do
so I know my choice is either to rollback or fix the error. What would you recommend? Would it be as simple as trying to find the changelog for the rtc engine in the attempt to upgrade the codebase or maybe just rollback? UPDATE: after trying to rollback both dependencies, I keep running into conflicts. Looks like I'll have to learn more about membrane in general
sgfn
sgfn•11mo ago
Rollback will definitely be easier, especially if you're not too familiar with Membrane This version of the engine is rather ancient. You certainly won't find any upgrade guides, and the changelogs will probably be limited to github autogenerated release notes, so it will be an arduous task to upgrade it Yeah, it's easy to end up in dependency hell when dealing with all of the packages. I'd suggest looking at the time when that app was first written and trying to find a version that was around then
michaelh
michaelhOP•10mo ago
Ok I’ll give it one more try I almost got this to compile with these dependencies but because I need SimulcastConfig%{} from a newer library, compilation fails
{:membrane_rtc_engine, "== 0.9.1"},
{:membrane_webrtc_plugin, "== 0.11.0"},
{:membrane_core, "== 0.10.0"},
{:membrane_rtc_engine, "== 0.9.1"},
{:membrane_webrtc_plugin, "== 0.11.0"},
{:membrane_core, "== 0.10.0"},
but I get this error:
== Compilation error in file lib/free4chat/room.ex ==
** (KeyError) key :default_encoding not found
(membrane_rtc_engine 0.9.1) expanding struct: Membrane.RTC.Engine.Endpoint.WebRTC.SimulcastConfig.__struct__/1
lib/free4chat/room.ex:148: Free4chat.Room.handle_info/2
== Compilation error in file lib/free4chat/room.ex ==
** (KeyError) key :default_encoding not found
(membrane_rtc_engine 0.9.1) expanding struct: Membrane.RTC.Engine.Endpoint.WebRTC.SimulcastConfig.__struct__/1
lib/free4chat/room.ex:148: Free4chat.Room.handle_info/2
Strangely, this is in a much newer library: https://hexdocs.pm/membrane_rtc_engine_webrtc/0.1.0/Membrane.RTC.Engine.Endpoint.WebRTC.SimulcastConfig.html
sgfn
sgfn•10mo ago
Endpoint.WebRTC.SimulcastConfig was part of membrane_rtc_engine prior to v0.16.0. Try {:membrane_rtc_engine, "== 0.6.0"},. This was the last version with the :default_encoding key in this struct
michaelh
michaelhOP•10mo ago
That was it! It compiled. Thanks
{:membrane_rtc_engine, "== 0.6.0"},
{:membrane_webrtc_plugin, "== 0.8.0"},
{:membrane_core, "== 0.10.0"},
{:membrane_rtc_engine, "== 0.6.0"},
{:membrane_webrtc_plugin, "== 0.8.0"},
{:membrane_core, "== 0.10.0"},
Want results from more Discord servers?
Add your server