今天想要在 erlang 環境下使用 obserevr 的工具,下了命令之後

Martin-MacBook-Pro:~ martin$ erl
Erlang R16B (erts-5.10.1) [source] [64-bit] [smp:2:2] [async-threads:10] [kernel-poll:false]

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


跳出錯誤,說明沒有定義 wx_object,Google爬文一下,原來erlang許多的GUI工具都是基於 wx 函式庫,所以在Mac OS 則需要 wxWidgets 的套件,就直接用 port 來安裝這個套件吧。



sudo port install wxWidgets


然後就耐心的等、等、等,等待安裝一堆相依的套件,然後 console 出現這段訊息

The port wxMaxima requires wxWidgets. The port wxWidgets cannot be installed under Mac OS 10.8 (message "wxWidgets does not build on 10.8 due to missing Carbon support, please use port wxWidgets30 instead"). Even if wxWidgets30 is installed, installation of wxMaxima fails because its Portfile requires wxWidgets.


安裝結果還是跳出錯誤,因為作業系統是 Mac OS 10.8 Mountain Lion 版本,所以提示你得裝wxWingets30版..

好吧,改裝版本,再來一次..


sudo port install wxWidgets-3.0


這次就順利裝起來囉,重新回到 erlang 環境,下 command 叫出 observer..
結果錯誤訊息還是同樣一個,仍舊殘念,到底怎麼回事呢?..

繼續爬文~ 爬文~..

網路上的文章沒有人提到這種狀況,我猜想之前用 port 安裝 erlang 環境,並沒有任何安裝參數可以設定要連結 wxWidgets Library,所以現在只有唯一的一條路可以走,就是手動編譯 erlang source。

先使用 port 把安裝好的 erlang 環境移除。

sudo port uninstall erlang


然後到 erlang 官方網站去下載 source
http://www.erlang.org/

官方網站的連結導引,在這裡下載 R16B 版本64bit for Mac OS X 的 source.
https://www.erlang-solutions.com/downloads/download-erlang-otp


下載後,解壓縮source,先來 configure,用LLVM 來 compile,記得要加上 wxgtk參數讓它能去 link library

CFLAGS=-O0 ./configure --disable-hipe --enable-smp-support --enable-threads  --enable-kernel-poll --enable-darwin-64bit --with-ssl --with-wxgtk

之後就是 make;make install


手動編譯 erlang source 並且完成erlang的安裝後,再來把 profile 加上環境變數

ERL_HOME=/usr/local/lib/erlang
PATH=$ERL_HOME/bin:$PATH
export ERL_HOME PATH

 

之後來驗收結果..重新下 observer command..

當畫面跑出這個視窗時,真的感動呀!!~    漂亮,又解決了一個問題了..

 

  

參考網址: erlang 官方安裝文件  http://www.erlang.org/doc/installation_guide/INSTALL.html

 

-----

2013.06.16 補充

目前 Erlang 的新版是 R16B01_RC1,對於記憶分配的效率更高,所以乾脆趁今天假日在家沒事,上 GitHub 直接 clone source 回來重新編譯,換掉 R16B 版。

erlang/otp github  https://github.com/erlang/otp

 

-----

2013.06.20 補充

Erlang R16B01 在今天正式 released ,這一版主要的差異如下..


●Migration of memory carriers between allocator instances, when enabled it will result in reduced memory footprint when the memory load is unevenly distributed between scheduler specific allocator instances.
●Interruptible term_to_binary, (thanks to Erik Stenman)
●Added the +sfwi <interval> Scheduler Forced Wakeup Interval
●All crypto functions except the block chipers will now chunk large input into several calls to avoid blocking the scheduler for too long.
●Elliptic curve support in crypto, ssl and ssh(thanks to Andreas Schultz)
●Lift static limitation (FD_SETSIZE) for file descriptors on Mac OS X. (thanks to Anthony Ramine)
●Removed a lock around GC statistics counter
●Many small improvements and in Diameter
●60 user contributions

 

可以到官方網站直接下載打包好的檔案   http://www.erlang.org/download.html

 

-----

2013.10.11

今天又重做系統,發現用 port 安裝的 wxWidgets 會有問題,所以徹底要解決這個狀況,乾脆直接去抓 wxWidgets 的 Source code 回來編譯..

首先先去官方網站下載  http://www.wxwindows.org/downloads/

如果你的 Mac OS 是 10.8.5 以上建議請抓 wxWidgets 2.9.5 版的 source code 回來。     

./configure;make;make install   就能搞定安裝好這個套件,然後接下來就是下載 erlang source,編譯、安裝。

 

 

arrow
arrow

    wjhwang 發表在 痞客邦 留言(1) 人氣()