跳到主要內容

Building Wt with Visual Studio 2012 on Windows 8 x64 PC

安裝 Wt 花了許多時間,主要的問題是「在 cmake configure 時,會出現如下圖錯誤的訊息」,導致我一直認為這種問題,在按下「 Generate 」鍵之後,不會產出 Visual Studio Project 相關的檔案。因此,上網找了解決方式,依照這個解決方式將 mspdb110.dll

copy  C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\mspdb110.dll
into  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin or C:\Windows\System

這是不需要的,因為這個錯誤的動作,導致後續的 Compile 無法完成。而發現這個問題是來自:在清除 wt build 目錄之後,重新 cmake wt project 時,會產生
The C compiler "C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/cl.exe" is not able to compile a simple test program.
由於之前都沒有這種現象的發生,測試了幾台電腦以後,出現相同的錯誤現象,才開始懷疑可能是將 mspdb110.dll copy into C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin or C:\Windows\System 所導致的錯誤。


果不其然,真的是 copy mspdb110.dll into C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin or C:\Windows\System 所產生的問題。

所以,結論是:「不可以這樣做。如果在 Cmake 按下 Configure 時,出現上圖的錯誤訊息,不需要理會它,依然可以產生 vs 的 project 檔。」

首先說明我目前系統的環境及使用軟體的版本,接著再說明整個安裝的過程。目前所使用的作業系統是:
  •  x64 bits Windows 8 的系統
  • Visual Studio 2012 for Desktop
  • CMake 2.8.10.2 版本
下載的軟體及版本為(僅提供安裝開發環境的所需軟體):
  • boost 1.53
  • wt-3.3.0-rc4
下載的 source code 都解壓縮到 d:\porject 目錄之下

 安裝的步驟:[1]
  • 安裝 boost:
  1. 解壓縮 source code 到 d:\projects\boost_1_53_0
  2. cd d:\projects\boost_1_53_0 , 執行 bootstrap.bat
  3. 執行 b2.exe install --prefix=d:\library\boost agdress-mode=64(Compiling to 64-bits) --build-type=complete --with-mpi  (complete, so it also builds the dll's)
  4. copy include, lib 目錄下的檔案到 d:\libraries 目錄中
  • Configure Wt
  1. 執行 cmake-gui,指定 
    • Where is source code: D:/project/wt-3.3.0-rc4
    • Where is to build binaries: D:/project/wt-3.3.0-rc4/build <- 自行輸入 build
    • Ungrouped Entries -- MULTI_THREADED : 打勾
    • Ungrouped Entries -- SHARED_LIBS : 打勾
    • Boost -- Boost_INCLUDE_DIR : d\libraries\include
    • Boost -- Boost_LIB_DIR : d\libraries\lib
    • Cmake -- CMAKE_INSTALL_PREFIX : D:\libraries\wt
    • INSTALL -- INSTALL_EXAMPLES : 打勾
    • INSTALL -- INSTALL_RESOURCES : 打勾
  2. 按下「Configure」按鈕,會出現如上圖的錯誤訊息以及紅色的 High Light,不需要管它,然後再按一次 「Configure」按鈕
  3. 按下「Generate」按鈕
  •  Building Wt
  1. 開啟 c:\project\wt-3.3.0-rc4\build 目錄中 WT.sln 的 project
  2. 使用 Visual Studio Selector 選擇 Visual Studio for Desktop
  3. Build 時產生最小 size 的 library : 在 Wt project 中按下右鍵,選 Properties 會出現下圖的畫面,依照下圖將 wt, wtdbo, wtdbosqlite3, wthttp, hello.wt 設成最小的 size 
  4. Build wt, wthttp, hello.wt
  5. Build INSTALL

  • Testing Hello.wt
  1. 加入 Debugging 參數:在 Wt project 中按下右鍵,選 Properties 會出現下圖的畫面,在 Configuration Progerties > Debugging > Command Argument 中加入 --http-address=0.0.0.0 --http-port=8080 --deploy-path=/hello --docroot=. 
  2. 點選 DEBUG > Start Without Debugging or 在 Visual Studio 中按下 |> Local Windows Debugger 或出現  找不到 wt.dll, wthttpd.dll 檔案的錯誤訊息,需要將這兩個檔(C:\project\wt-3.3.0-rc4\build\src\http\Debug\wthttpd.dll and C:\project\wt-3.3.0-rc4\build\src\Debug\wt.dll) copy 到 c:\Windows\system 目錄中
  3. 使用 Browser 開啟 http://localhost:8080/hello
不知道為何?辦公室的電腦無法開啟讓 http  8080 port,只好將 Command Argument 改成 --http-port=80 這樣才能 Work?

2013.10.03
----------------------
再次在 office Desktop compile Wt source code, 卻出現 error C2039: 'default_token' : is not a member of 'boost::random::random_device' 的錯誤訊息,主要是問題是在 Cmake 中,將 Wt 選項的 WT_NO_BOOST_RANDOM 項目被勾選,檢查 Cmake 的 configure 檔的 log 才得知,將  WT_NO_BOOST_RANDOM 選項不勾選就可以 Compile 成功。

 -----------------------------------------------------
[1] http://redmine.webtoolkit.eu/boards/2/topics/3574?r=4541#message-4541
[2] http://andres.jaimes.net/761/how-to-compile-wt-witty-on-windows/

留言