【问题标题】:undefined function :wx_object.start/3未定义函数:wx_object.start/3
【发布时间】:2016-09-09 20:15:46
【问题描述】:

我尝试在我的 Mac 64 位 Capitan 上安装 ErLang,我尝试通过 brew 安装它,但是当我尝试运行 :observer.start 时出现此错误:

** (UndefinedFunctionError) undefined function :wx_object.start/3 (module :wx_object is not available)
    :wx_object.start(:observer_wx, [], [])
    observer_wx.erl:72: :observer_wx.start/0

我也尝试使用 erlang 解决方案安装 erLang otp 18.3,但我遇到了同样的错误。

有什么想法吗?

编辑

如果我尝试直接从 Erlang shell 启动观察者:

^CiMac:~ Apple$ erl 
Erlang/OTP 18 [erts-7.3] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V7.3  (abort with ^G)
1> observer:start().
** exception error: undefined function wx_object:start/3
     in function  observer_wx:start/0 (observer_wx.erl, line 72)

EDIT2

iMac:~ Apple$ brew info erlang
erlang: stable 18.3 (bottled), HEAD
Programming language for highly scalable real-time systems
https://www.erlang.org/
/usr/local/Cellar/erlang/18.3 (7,489 files, 273.8M)
  Poured from bottle on 2016-05-13 at 12:24:59
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/erlang.rb
==> Dependencies
Build: autoconf ✔, automake ✔, libtool ✔
Required: openssl ✔
Recommended: wxmac ✔
Optional: fop ✘
==> Options
--with-dirty-schedulers
    Enable experimental dirty schedulers
--with-fop
    Build with fop support
--with-native-libs
    Enable native library compilation
--without-docs
    Do not install documentation
--without-hipe
    Disable building hipe; fails on various OS X systems
--without-wxmac
    Build without wxmac support
--HEAD
    Install HEAD version
==> Caveats
Man pages can be found in:
  /usr/local/opt/erlang/lib/erlang/man

Access them with `erl -man`, or add this directory to MANPATH.
iMac:~ Apple$ which erl
/opt/local/bin/erl

brew info 的 erl 是: /usr/local/Cellar/erlang/18.3 但是,哪个erl是: /opt/local/bin/erl 指向/opt/local/lib/erlang/bin/erl

如果我开始 /usr/local/Cellar/erlang/18.3/bin/erl 观察者将工作!

所以,我用鼠标删除了别名,然后我:

sudo ln -s /usr/local/Cellar/erlang/18.3/lib/erlang/bin/erl /opt/local/bin/erl

但我不确定/opt/local/lib/erlang/bin/erl 它是如何创建的.. 无论如何,它现在可以工作了..

【问题讨论】:

  • Erlang 好像没有 WxWidgets。你可以试试brew info erlang,它会告诉你安装了哪个版本以及是否安装了wxmac依赖。您确定实际上您正在启动正确的erl吗? brew安装的那个? (控制台中的“which erl”是否打印预期的路径?)
  • 谢谢!,brew info 显示我指的是不同的路径,请参阅编辑 2
  • 从源代码编译 Erlang 通常会跳过 wxWidgets、crypto 和 odbc。获得完整 Erlang 的最简单方法是使用来自 Erlang Solutions 站点的软件包:erlang-solutions.com/resources/download.html 请确保不要安装企业软件包(它们是 borken),但标准软件包运行良好并节省时间。
  • @simo 我很高兴它现在可以工作了!那么请接受我的回答:-)
  • 当然,我很高兴能用 elixir & Erlang 开始新的旅程 :)

标签: erlang elixir


【解决方案1】:

在许多系统上,默认情况下不支持带有 wx 的 Erlang。它可以通过编译选项启用。有时有一个单独的包已经用 wx 支持编译,例如erlang-wx 在 FreeBSD 上。

快速的 Google 搜索显示了这篇示例文章,其中提供了一些关于启用 recompiling Erlang on Mac with wx 的信息。

【讨论】:

    【解决方案2】:

    鉴于您使用 Elixir 的语法:-)

    无论如何,一个可能的答案是您需要使用 WxWidgets 构建的 Erlang,这是观察者使用的 GUI 工具包。

    如果我查看 Erlang (http://brewformulas.org/Erlang) 的自制公式,它表明它将安装“Wxmac”依赖项,因此它应该引入 WxWidgets...

    如果你尝试如下直接从 Erlang shell 启动观察者会发生什么?

    1> observer:start().

    (我已经用 MacPorts 安装了它,它开箱即用)。

    编辑

    Erlang 看起来确实没有 WxWidgets。你可以试试brew info erlang,它会告诉你安装了哪个版本以及是否安装了wxmac依赖。

    您确定实际上您正在启动正确的 erl 吗? brew安装的那个? (控制台中的“which erl”是否打印预期的路径?)

    【讨论】:

      猜你喜欢
      • 2019-01-12
      • 1970-01-01
      • 2017-11-14
      • 1970-01-01
      • 2020-10-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多