發文作者:wekon | 九月 19, 2008

How to build Google Gears for Windows Mobile on Windows Server 2003 (1)

之前怎麼 build 都會發生錯誤
一度上網問了網友 (http://forums.microsoft.com/MSDN-CHT/ShowPost.aspx?PostID=3896758&SiteID=14)
現在終於知道原因了
原因其實只是因為 VS 的環境變數沒有設定好
正確的編譯方式如下


首先,一樣是照著網頁上的說明進行基本安裝
Install the following to create the build environment:

除此之外,要 build for Windows Mobile 的程式要安裝 Windows Mobile SDk:
http://www.microsoft.com/downloads/details.aspx?familyid=83A52AF2-F524-4EC5-9155-717CBE5D25ED
安裝 Windows Mobile SDK 之前,要先裝 ActiveSync
http://www.microsoft.com/windowsmobile/en-us/help/synchronize/activesync45.mspx
接下來,根據以下說明:

Follow the instructions at http://code.google.com/p/gears/source to set up your source tree.

Finally open a command prompt, setup your build environment, and build Gears. (These instructions assume you put Gears in c:\svn-gears and installed Visual Studio and the Platform SDK to their default locations.)

重點在於 “setup your build environment" 這句話
到底要怎麼設定 VS 的環境變數呢
我對 Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat 進行了以下設定
@set PATH=C:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\SDKTools;C:\Program Files\Microsoft Visual Studio 8\VC\ce\bin\x86_arm;C:\Program Files\Microsoft Visual Studio 8\Common7\IDE;C:\Program Files\Microsoft Visual Studio 8\VC\BIN;C:\Program Files\Microsoft Visual Studio 8\Common7\Tools;C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\bin;C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\bin;C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\bin;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;C:\Program Files\Microsoft Visual Studio 8\VC\VCPackages;%PATH%
@set INCLUDE=C:\Program Files\Microsoft Visual Studio 8\VC\ce\include;C:\Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Pocket PC SDK\Include\Armv4i;C:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE;C:\Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Pocket PC SDK\Include;C:\Program Files\Microsoft Visual Studio 8\VC\ce\atlmfc\include;C:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\SQL Server\Mobile\v3.0;%INCLUDE%
@set LIB=C:\Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Pocket PC SDK\Lib\ARMV4I;C:\Program Files\Microsoft Visual Studio 8\VC\ce\atlmfc\lib\armv4i;C:\Program Files\Microsoft Visual Studio 8\VC\ce\lib\ARMV4I;C:\Program Files\Microsoft Visual Studio 8\VC\ATLMFC\LIB;C:\Program Files\Microsoft Visual Studio 8\VC\LIB;C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib;C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\lib;%LIB%
@set LIBPATH=C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;C:\Program Files\Microsoft Visual Studio 8\VC\ATLMFC\LIB
@set SRC=C:\Program Files\Microsoft Visual Studio 8\VC\ce\atlmfc\src\atl;C:\Program Files\Microsoft Visual Studio 8\VC\ce\atlmfc\src\mfc;C:\Program Files\Microsoft Visual Studio 8\VC\ce\crt\src;

接下來,依序執行
cd C:\gears-read-only\gears\
“c:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat"
“c:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\SetEnv.cmd"
make BROWSER=IE MODE=opt OS=wince

如果設定正確,絕大多數的編譯都會過
不過還是會有一些小問題
會先碰到以下錯誤:

url_utils_test.cc

base/common/url_utils_test.cc : error C2220: warning treated as error – no ‘obje

ct’ file generated

base/common/url_utils_test.cc : warning C4819: The file contains a character tha

t cannot be represented in the current code page (950). Save the file in Unicode

 format to prevent data loss

make[1]: *** [bin-opt/wince-arm/ie/url_utils_test.obj] Error 2

make: *** [default] Error 2

只要針對此檔重新編譯,並且將 /WX 拿掉即可
指令如下:
cl -I.. -Ibin-opt/wince-arm/ie -Ibin-opt/wince-arm/common -I../third_party/npapi -I../third_party -I../third_party/googleurl -I../third_party/icu38/public/common -DPNG_USER_CONFIG -I../third_party/zlib -DNO_GZIP -DNO_GZCOMPRESS -DNO_ERRNO_H -I../third_party/breakpad/src -I../third_party/libgd /nologo -DSTRICT -D_UNICODE -DUNICODE -D_USRDLL -DWIN32 -D_WINDLL -D_CRT_SECURE_NO_DEPRECATE -DNOMINMAX -D_WIN32_WCE=0x501 -DWINVER=_WIN32_WCE -DUNDER_CE=0x501 -DWINCE -DWIN32_PLATFORM_PSPC -DARM -D_ARM_ -DPOCKETPC2003_UI_MODEL -D_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA -D_CE_CRT_ALLOW_WIN_MINMAX   -DNDEBUG=1 -DUSING_CCTESTS=1 -I../third_party/gtest/include -I../third_party/gtest /c /Fo"bin-opt/wince-arm/ie/url_utils_test.obj" /Fd"bin-opt/wince-arm/ie/url_utils_test.pdb" /W3 /GR- /MT  /Zi /Zc:wchar_t- /O2 -D_HAS_EXCEPTIONS=0 -D_ATL_NO_EXCEPTIONS -DU_STATIC_IMPLEMENTATION /TP/J -DBROWSER_IE=1 -DJS_THREADSAFE   base/common/url_utils_test.cc

再來,碰到了兩個之前就碰到的小問題
base/common/url_utils_test.cc : warning C4819: The file contains a character that cannot be represented in the current code page (950). Save the file in Unicode format to prevent data loss
以及
C:\Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Pocket PC SDK\Include\Armv4i\htmlctrl.h : warning C4819: The file contains a character that cannot b
e represented in the current code page (950). Save the file in Unicode format to prevent data loss
make[1]: *** [bin-opt/wince-arm/ie/html_dialog_ie.obj] Error 2 make: *** [default] Error 2
將兩個檔案中的第一行奇怪字元拿掉即可

最後,就可以將所有程式編譯完成
但是到了link 卻又出錯
uuid.lib(urlmon_i_guid27.obj) : warning LNK4099: 找不到 PDB ‘dummy.pdb’ (有 ‘C:\
Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Pocket PC SDK\Lib\ARMV4
I\uuid.lib’ 或位於 ‘C:\gears-read-only\gears\bin-opt\wince-arm\ie\dummy.pdb’),
當做沒有偵錯資訊,連結物件
uuid.lib(urlmon_i_guid19.obj) : warning LNK4099: 找不到 PDB ‘dummy.pdb’ (有 ‘C:\
Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Pocket PC SDK\Lib\ARMV4
I\uuid.lib’ 或位於 ‘C:\gears-read-only\gears\bin-opt\wince-arm\ie\dummy.pdb’),
當做沒有偵錯資訊,連結物件
uuid.lib(urlmon_i_guid17.obj) : warning LNK4099: 找不到 PDB ‘dummy.pdb’ (有 ‘C:\
Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Pocket PC SDK\Lib\ARMV4
I\uuid.lib’ 或位於 ‘C:\gears-read-only\gears\bin-opt\wince-arm\ie\dummy.pdb’),
當做沒有偵錯資訊,連結物件
uuid.lib(urlmon_i_guid16.obj) : warning LNK4099: 找不到 PDB ‘dummy.pdb’ (有 ‘C:\
Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Pocket PC SDK\Lib\ARMV4
I\uuid.lib’ 或位於 ‘C:\gears-read-only\gears\bin-opt\wince-arm\ie\dummy.pdb’),
當做沒有偵錯資訊,連結物件
uuid.lib(shguids_guid25.obj) : warning LNK4099: 找不到 PDB ‘dummy.pdb’ (有 ‘C:\P
rogram Files\Windows CE Tools\wce500\Windows Mobile 5.0 Pocket PC SDK\Lib\ARMV4I
\uuid.lib’ 或位於 ‘C:\gears-read-only\gears\bin-opt\wince-arm\ie\dummy.pdb’),當
做沒有偵錯資訊,連結物件
uuid.lib(msxml2_i_guid59.obj) : warning LNK4099: 找不到 PDB ‘dummy.pdb’ (有 ‘C:\
Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Pocket PC SDK\Lib\ARMV4
I\uuid.lib’ 或位於 ‘C:\gears-read-only\gears\bin-opt\wince-arm\ie\dummy.pdb’),
當做沒有偵錯資訊,連結物件 rm bin-opt/obj_list.temp

相當奇怪的問題,目前尚無法解決
可能要再問問人了 …


Responses

  1. […] How to build Google Gears for Windows Mobile on Windows Server 2003 (2) 繼續昨天的 cab 檔建立 (https://wekon.wordpress.com/2008/09/19/how-to-build-google-gears-for-windows-mobile-on-windows-server…) […]


發表迴響

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 變更 )

Twitter picture

You are commenting using your Twitter account. Log Out / 變更 )

Facebook照片

You are commenting using your Facebook account. Log Out / 變更 )

Google+ photo

You are commenting using your Google+ account. Log Out / 變更 )

連結到 %s

分類

%d 位部落客按了讚: