Blog

Error en :observer.start(): libwx_gtk3u_stc-3.0.so.0

Error en :observer.start(): libwx_gtk3u_stc-3.0.so.0

Al intentar iniciar el observer de Erlang en IEX saltaba el siguiente error:

iex(dd@localhost4)3> :observer.start()
2023-05-25T13:28:08.385Z [error] pid=<0.1522.0> WX ERROR: Could not load library: :load_failed
Failed to load NIF library /usr/lib/erlang/lib/wx-2.1.2/priv/wxe_driver: 'libwx_gtk3u_stc-3.0.so.0: cannot open shared object file: No such file or directory'
{:error,
 {{:error,
   {:load_failed,
    'Failed to load NIF library /usr/lib/erlang/lib/wx-2.1.2/priv/wxe_driver: \'libwx_gtk3u_stc-3.0.so.0: cannot open shared object file: No such file or directory\''}},
  [
    {:wxe_server, :start, 1, [file: 'wxe_server.erl', line: 65]},
    {:wx, :new, 1, [file: 'wx.erl', line: 115]},
    {:observer_wx, :init, 1, [file: 'observer_wx.erl', line: 108]},
    {:wx_object, :init_it, 6, [file: 'wx_object.erl', line: 404]},
    {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 226]}
  ]}}

Tenía instalado wxwidgets-gtk3 3.2.2.1-1, pero observer necesita la 3.0. Lo encontré en el AUR de Arch. Si embargo, después de instalarlo con makepkg -si observer.start mostraba este otro error:

iex(dd@localhost4)6> :observer.start()
Fatal Error: Mismatch between the program and library build versions detected.
                                                                              The library used 3.0 (wchar_t,compiler with C++ ABI 1013,wx containers,compatible with 2.8),
                                                                                                                                                                          and your program used 3.0 (wchar_t,compiler with C++ ABI 1016,wx containers,compatible with 2.8).

Hice este cambio en PKGBUILD:

j@bt ~/software/aur/wxwidgets3.0 (master) % git diff
diff --git a/PKGBUILD b/PKGBUILD
index 7d7d7fe..38d536c 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -15,7 +15,7 @@ sha256sums=('8aacd56b462f42fb6e33b4d8f5d40be5abc3d3b41348ea968aa515cc8285d813')
 
 build() {
        cd "$__pkgbasename-$pkgver"
-       export CXXFLAGS="$CXXFLAGS -fabi-version=13"
+       export CXXFLAGS="$CXXFLAGS -fabi-version=16"
        ./configure --prefix=/usr --with-gtk=3
        make
 }

borré los archivos temporales de pkg, src y wxwidgets3.0-3.0.5-3-x86_64.pkg.tar.zst, y volví a generar el paquete con makepkg -si, y ahora ya se mostraba la ventana del observer.

Supongo que otra opción sería compilar Erlang en lugar de utilizar el paquete de Arch. Podemos hacerlo nosotros mismos o igual mejor a través de la herramienta kerl.