2017年4月9日 星期日

Install WxPerl on Windows 備忘錄2

時隔多日,組了新電腦,決定再來嘗試WxPerl。

作業系統Windows 10 (10.0.14393)
Wx 在不同active Perl版本支援的狀況,得知v5.24無法支援。
http://code.activestate.com/ppm/Wx/



1. ActivePerl 降版為v5.22.3
2. 開啟cmd,輸入 ppm install Wx,終於成功了!!

C:\>ppm install Wx
Downloading ActiveState Package Repository dbimage...done
Syncing site PPM database with .packlists...done
Downloading Wx-0.9928...done
Downloading Alien-wxWidgets-0.67...done
Unpacking Wx-0.9928...done
Unpacking Alien-wxWidgets-0.67...done
Generating HTML for Wx-0.9928...done
Generating HTML for Alien-wxWidgets-0.67...done
Updating files in site area...done
1154 files installed


首先來個Hello world吧~
use Wx;
my $app = Wx::SimpleApp->new;
my $frame = Wx::Frame->new( undef, -1, 'Hello, world!' );
$frame->Show;
$app->MainLoop;

17/05/26 補充:缺少DLL檔案問題

在實驗室使用ppm安裝Wx時,順利安裝完成後,執行使用Wx的perl程式,系統卻回報缺少DLL檔。

原因是Wx 的依賴模組 Alien-wxWidgets,ppm並沒有正確安裝。

缺少下圖的Config 以及 msw_3_0_2_uni_gcc_3_4兩個資料夾。



解決方式:

0. 使用ppm解除已安裝的Alien-wxWidgets。Wx 可保留不用移除。

1. 自行從CPAN下載安裝源檔,Alien-wxWidgets-0.69.tar.gz
http://search.cpan.org/~mdootson/Alien-wxWidgets-0.69/

2. 使用7-zip 解壓縮至c:\Alien-wxWidgets-0.69

3. 開啟 CMD切換目錄至c:\Alien-wxWidgets-0.69,並輸入: perl Build.PL
系統將詢問一些問題,回答內容如下所示:

c:\Users\TC>cd c:\Alien-wxWidgets-0.69
c:\Alien-wxWidgets-0.69>perl Build.PL
Do you want to fetch and build wxWidgets from sources? [yes ]yes
Which wxWidgets version? (2.8.10, 2.8.11, 2.8.12, 2.9.0, 2.9.1, 2.9.2, 2.9.3, 2.9.4, 3.0.0, 3.0.1, 3.0.2) [3.0.2 ]3.0.2
3.0.2
Which archive type? tar.bz2
tar.bz2
Do you want to include OpenGL support [yes ]yes
Created MYMETA.yml and MYMETA.json
Creating new 'Build' script for 'Alien-wxWidgets' version '0.69'

4. 依序輸入以下指令,即可完成安裝(ps. perl Build 需等候許久時間)
perl Build
perl Build test
perl Build install

5. 最後,可移除已無用的Alien-wxWidgets-0.69資料夾。

失敗紀錄:
ActivePerl (v5.24.1)
1. 先用內建的ppm 搜尋並依次安裝dmake, MinGW
一切順利,除了MinGW 需下載時間很久。

2. cpan Wx
依然失敗(Wx-0.9928)

ActivePerl (v5.22.3)
1.使用cpan 安裝Alien-wxWidgets-0.69,卻回報dmake is not OK。---失敗!

沒有留言:

張貼留言