android-example-app icon indicating copy to clipboard operation
android-example-app copied to clipboard

No driver found for wx

Open Nicd opened this issue 3 years ago • 7 comments

My app immediately crashes on startup with

20:39:12.827 [error] ERROR: Could not find 'wxe_driver.so' in: /data/user/0/io.elixirdesktop.example/files/app/lib/wx-2.2/priv
20:39:12.834 [notice] Application desktop exited: Desktop.start(:normal, []) returned an error: shutdown: failed to start child: Desktop.Env
        ** (EXIT) an exception was raised:
            ** (ErlangError) Erlang error: {:load_driver, 'No driver found'}
                (wx 2.2) wxe_server.erl:65: :wxe_server.start/1
                (wx 2.2) wx.erl:115: :wx.new/1
                (desktop 1.4.1) lib/desktop/env.ex:28: Desktop.Env.init/1
                (stdlib 4.0.1) gen_server.erl:848: :gen_server.init_it/2
                (stdlib 4.0.1) gen_server.erl:811: :gen_server.init_it/6
                (stdlib 4.0.1) proc_lib.erl:240: :proc_lib.init_p_do_apply/3

Everything builds correctly though.

Nicd avatar Aug 26 '22 17:08 Nicd

This was due to the run_mix script stripping all *.so files from the built app.zip. When I include the library, I'm getting

20:52:44.691 [error] WX ERROR: Could not load library: :load_failed
    Failed to load NIF library /data/user/0/io.elixirdesktop.example/files/app/lib/wx-2.2/priv/wxe_driver: 'dlopen failed: "/data/data/io.elixirdesktop.example/files/app/lib/wx-2.2/priv/wxe_driver.so" has bad ELF magic: cffaedfe'

so I'm guessing there was a reason for the stripping.

Nicd avatar Aug 26 '22 17:08 Nicd

There seems to be something wrong with how the release is built. wxWidgets WebView is not available on the phones and thus the sample app is packaging a drop-in-replacement package "bridge" that is using the phones native webview. Try to replace :wx with bridge in your release build, and then it should work.

dominicletz avatar Aug 26 '22 18:08 dominicletz

This is the relevant part in the desktop library: https://github.com/elixir-desktop/desktop/blob/dc1575c1963950ff18b2682a3fdb1887ac3a9ffa/mix.exs#L87

dominicletz avatar Aug 26 '22 18:08 dominicletz

Thanks, that does it! I guess it should be added to instructions somewhere. I can make a PR later, I'm now trying to get this to work.

Btw is there a chat avenue for this library? It would be possibly faster / lower friction than talking in the issues. :) If you use Discord, we could make a separate #elixir-desktop channel on the Elixir server.

Nicd avatar Aug 26 '22 19:08 Nicd

It's the #desktop channel on the Elixir slack https://join.slack.com/t/elixir-lang/shared_invite/zt-1f13hz7mb-N4KGjF523ONLCcHfb8jYgA

dominicletz avatar Aug 26 '22 19:08 dominicletz

I guess I need to rejoin Slack then. :)

I have just gotten the app to run for the first time! This is glorious! Thanks so much. <3

Nicd avatar Aug 26 '22 19:08 Nicd