WebKit 빌드 절차

Dev 2009. 11. 27. 10:01

웹킷 빌드 절차 요약

 

작년에 웹킷을 처음 빌드한지 1년이 지난 지금,

최신 웹킷 소스를 다운 받아 다시 빌드하게 됐다. 작년보다 빌드 절차가 다소 간소해졌다. 웹킷 프로젝트가 더욱 정돈되었구나 느꼈다. 개선됐다고 느낀 점은 다음 2가지다.

l  dos2unix 를 통해 웹킷 소스 파일들의 eol (end of line) 포맷을 바꾸어 주지 않아도 빌드가 됐다. 이는 웹킷 소스가 개선됐기 때문일 수도 있고 cygwin 같은 빌드에 사용되는 툴이 개선됐기 때문일 수도 있다.

l  Webkit.sln 파일을 열어 대부분의 프로젝트에 /wd4819 컴파일 옵션을 부여하는 절차를 생략해도 빌드가 됐다. DumpRenderTree 라는 프로젝트만 컴파일 옵션을 조정해주면 깔끔하게 빌드가 끝난다.

 

작년에 썼던 빌드 성공담은 http://ingeec.tistory.com/1 에서 확인할 수 있다.

빌드가 수월해지기는 했지만 여전히 약간의 산을 넘어야 한다. 덕분에 빌드만 끝내도 약간의 성취감(?)을 느낄 수 있다. 빌드 성공담을 공유한다. 아래의 빌드 절차는 Windows XP 32bit PC 위에서 수행했다.

 

 

1. 툴설치

웹킷 빌드에 필요한 툴들을 설치한다. 다음과 같은 툴들이 필요했다.

l  Cygwin

n  설치할 때 “all/ install” 옵션을 선택했다.

l  Tortoise

n  1.6.6.17493 (32bit): 2009.11.19. 현재 최신 버전이다.

l  VS 2005

n  2개의 PC에서 빌드해봤다. PC는 영문 버전을 사용했고, 다른 PC에서는 한글 버전을 사용했다. PC 모두 빌드하는데 문제 없었다.

l  QuickTime SDK

n  http://webkit.org/building/tools.html 페이지를 참조한다.

 

툴 관련 팁

l  Cygwin 콘솔에서 SVN 관련 메시지가 깨져 나올 때

ð  C:\cygwin\usr\share\locale 아래 있는 ko 폴더를 지우거나 다른 이름으로 바꾸면SVN 관련 메시지가 영문으로 출력된다. 한글은 아니지만 이상한 난수로 깨져나오는 것보다는 낫다.

l  VS2005 한글 버전을 쓸 때

ð  http://trac.webkit.org/wiki/BuildingOnWindows 페이지를 보면 VS2005 관련 서비스팩들을 깔아야 한다고 안내되어 있다. 그런데 그페이지에 가이드된 서비스팩들은 영문버전용이라서 그런지 한글 VS2005 위에는 설치되지 않았다. 서비스팩들을 깔지 않고 그냥 있는 그대로 시도해도 문제 없었다.

 

 

2. 소스 트리 작성

l  작업 디렉토리 아래 src 폴더와 out 폴더를 만들었다. 빌드를 위해 구축한 폴더 구조는 다음과 같다.

l  src 폴더는 WebKit 소스서버(http://svn.webkit.org/repository/webkit/trunk)로부터 최신 소스를 다운로드 받을 폴더이다. 이후 $(SrcHome) 이라고 언급하기로 한다.

l  out 폴더는 웹킷 소스를 빌드한 결과물을 담을 폴더이다.


 

3. WebKit 소스 체크아웃

l  “2009-11-09, rev 50632” 버전과 “2009-11-20, rev 51226” 버전으로 빌드 절차를 확인했다.

 

 

4. WebKitSupportLibrary.zip 다운로드 & 복사

l   http://developer.apple.com/opensource/internet/webkit_sptlib_agree.html 

l  WebKitSupportLibrary.zip 파일을 다운로드 해서 $(SrcHome) 폴더에 복사한다.

 

 

5. 환경변수 등록

l  WEBKITOUTPUTDIR 환경변수와 WEBKITLIBRARIESDIR 환경변수를 등록한다.

l  WEBKITOUTPUTDIR 환경변수에는 임의의 path를 지정해도 되지만,
WEBKITLIBRARIESDIR
환경변수에는 WebKit 소스트리 안에 있는

$(SrcHome)\WebKitLibraries\win path
(Window Style) 지정해야 한다.

l  참고로 필자는 Cygwin bash에서 환경변수 등록을 위해 다음과 같은 스크립트 파일을 사용했다.

 

스크립트 파일 (webkitenv.sh) 내용

export WEBKITOUTPUTDIR=E:\\Work\\webkit\\out

export WEBKITLIBRARIESDIR=E:\\Work\\webkit\\src\\WebKitLibraries\\win

 

스크립트 파일을 이용한 환경변수 등록 절차 (cygwin bash 콘솔출력)

ingee@ingeedev ~

$ pwd

/cygdrive/e/Work

 

ingee@ingeedev ~

$ cd webkit/

 

ingee@ingeedev ~/webkit

$ source webkitenv.sh

 

ingee@ingeedev ~/webkit

$ env |grep WEBKIT

WEBKITLIBRARIESDIR=E:\Work\webkit\src\WebKitLibraries\win

WEBKITOUTPUTDIR=E:\Work\webkit\out

 

ingee@ingeedev ~/webkit

$

 

 

 

6. update-webkit 스크립트 실행

l  $(SrcHome)/WebKitTools/Scripts/update-webkit 스크립트를 실행하여 소스를 업데이트 한다.

 

cygwin bash 콘솔출력

ingee@ingeedev ~/webkit/src

$ pwd

/cygdrive/e/Work/webkit/src

 

ingee@ingeedev ~/webkit/src

$ ls WebKitSupportLibrary.zip

WebKitSupportLibrary.zip*

 

ingee@ingeedev ~/webkit/src

$ WebKitTools/Scripts/update-webkit

Updating OpenSource

U    WebCore/rendering/style/StyleRareNonInheritedData.h

U    WebCore/rendering/style/RenderStyleConstants.h

U    WebCore/rendering/style/RenderStyle.h

U    WebCore/rendering/RenderThemeWin.cpp

A    LayoutTests/fast/forms/script-tests/ValidityState-stepMismatch-range.js

A    LayoutTests/fast/forms/script-tests/input-type-change3.js

A    LayoutTests/fast/forms/script-tests/ValidityState-typeMismatch-datetime.js

A    LayoutTests/fast/forms/ValidityState-typeMismatch-date-expected.txt

U    WebKitSite/ChangeLog

U    WebKitSite/css/main.css

U    WebKitSite/coding/coding-style.html

U    WebKitSite/coding/commit-review-policy.html

U    WebKitSite/security/security-group-members.html

 U   .

Updated to revision 51372.

Checking Last-Modified date of WebKitAuxiliaryLibrary.zip...

Current WebKitAuxiliaryLibrary is up to date

 

ingee@ingeedev ~/webkit/src

$

 

 

7. 빌드 스크립트 실행

l  WebKitTools/Scripts/build-webkit –debug 스크립트를 실행한다.

l  build-webkit 스크립트를 실행하면 FAIL 이라는 메시지가 뜬다. 하지만 이상태에서도 out 폴더를 확인해보면 WebKit.dll 을 비롯 필요한 모든 결과물이 생성된 것을 확인할 수 있다. FAIL이 난 것은 WebKit 관련 여러 프로젝트중 DumpRenderTree 라는 유틸리티 프로그램 프로젝트 뿐이다.

 

cygwin bash 콘솔출력

ingee@ingeedev ~/webkit/src

$ pwd

/cygdrive/e/Work/webkit/src

 

ingee@ingeedev ~/webkit/src

$ WebKitTools/Scripts/build-webkit –-debug

Checking mod-date of WebKitSupportLibrary.zip...

 

Installing WebKitSupportLibrary...

The WebKitSupportLibrary has been sucessfully installed in

 /cygdrive/e/Work/webkit/src/WebKitLibraries/win

Building results into: /cygdrive/e/Work/webkit/out

WEBKITOUTPUTDIR is set to: E:\Work\webkit\out

WEBKITLIBRARIESDIR is set to: E:\Work\webkit\src\WebKitLibraries\win

/cygdrive/e/Work/webkit/src/WebKitTools/Scripts/pdevenv /useenv win\WebKit.vcproj\

WebKit.sln /build Debug

15>DumpRenderTree.cpp

15>LayoutTestControllerWin.cpp

15>E:\Work\webkit\src\WebKitLibraries\win\Include\ConditionalMacros.h : error C2220: warning treated as error - no 'object' file generated

15>E:\Work\webkit\src\WebKitLibraries\win\Include\ConditionalMacros.h : warning C4819: The file contains a character that cannot be represented in the current code page (949). Save the file in Unicode format to prevent data loss

15>DumpRenderTree - 1 error(s), 3 warning(s)

========== Build: 14 succeeded, 1 failed, 2 up-to-date, 0 skipped ==========

 

===== BUILD FAILED ======

Please ensure you have run WebKitTools/Scripts/update-webkit to install dependencies.

 

You can view build errors by checking the BuildLog.htm files located at:

/cygdrive/e/Work/webkit/out/obj/<project>/<config>.

 

ingee@ingeedev ~/webkit/src

$

          

l  FAIL 메시지는 DumpRenderTree 프로젝트에서 발생한 것이다. 다음 단계 절차에 따라 해결할 수 있다.

 

 

8. C4819 컴파일 에러 해결

l  DumpRenderTree 프로젝트의 C4819 에러를 해결하기 위해 DumpRenderTree 프로젝트의 컴파일 옵션을 수정한다.

l  $(SrcHome)\WebKit\win\WebKit.vcproj\WebKit.sln VS2005 솔루션 파일을 오픈한다.
솔루션 파일을 열기전에 Windows 시스템에 WEBKITOUTPUTDIR 환경변수와

WEBKITLIBRARIESDIR
환경변수가 등록되어 있는지 확인하자. 지금까지 Cygwin 콘솔에서만 작업했다면 Windows 시스템에는 해당 환경변수들이 등록되어 있지 않을 것이다.

l  DumpRenderTree 프로젝트의 all configuration Compile Option으로 /wd4819 부여한다.

 

 

9. 다시 빌드

l  WebKitTools/Scripts/build-webkit --clean 스크립트를 실행한다.

l  WebKitTools/Scripts/build-webkit --debug 스크립트를 실행한다.

 

cygwin bash 콘솔출력

ingee@ingeedev ~/webkit/src

$ pwd

/cygdrive/e/Work/webkit/src

 

ingee@ingeedev ~/webkit/src

$ WebKitTools/Scripts/build-webkit –-clean

17>파일 삭제 - E:\Work\webkit\out\obj\JavaScriptCore\DerivedSources\RegExpObject

.lut.h

17>파일 삭제 - E:\Work\webkit\out\obj\JavaScriptCore\DerivedSources\StringProtot

ype.lut.h

17>파일 삭제 - E:\Work\webkit\out\obj\JavaScriptCore\DerivedSources\docs\bytecod

e.html

========== Clean: 17 succeeded, 0 failed, 0 skipped ==========

 

ingee@ingeedev ~/webkit/src

$ WebKitTools/Scripts/build-webkit --debug >buildlog.txt

 

ingee@ingeedev ~/webkit/src

$

          

l  빌드가 성공했다. 빌드하면서 생성한 buildlog.txt 파일을 첨부한다.

 

 

빌드 팁 (몇가지 문제와 대처방법)

l  qmake 를 찾는 에러가 날 때

 

cygwin bash 콘솔출력

ingee@ingeenote /cygdrive/d/work/webkit/src

$ ./WebKitTools/Scripts/build-webkit --debug > buildlog.txt

Use of uninitialized value $defaults in pattern match (m//) at /cygdrive/d/work/

webkit/src/WebKitTools/Scripts/webkitdirs.pm line 795.

Can't exec "qmake": No such file or directory at /cygdrive/d/work/webkit/src/Web

KitTools/Scripts/webkitdirs.pm line 1217.

Use of uninitialized value $mkspec in scalar chomp at /cygdrive/d/work/webkit/sr

c/WebKitTools/Scripts/webkitdirs.pm line 1217.

sh: qmake: command not found

Failed to setup build environment using qmake!

 

          

ð  Qt 버전으로 빌드하려 했기 때문이다. build-webkit 스크립트를 분석한 결과, cygwin 환경변수중에 QTDIR이 정의되어 있으면 Qt 버전으로 빌드하려 한다는 것을 알았다. cygwin bash 콘솔에서 unset QTDIR 하여 QTDIR 환경 변수를 제거하면 해결된다.

 

 

l  unicode/uchar.h, pthread.h 등의 헤더 파일을 못찾을 때

 

cygwin bash 콘솔출력

ingee@ingeenote /cygdrive/d/work/webkit/src

$ ./WebKitTools/Scripts/build-webkit –debug

2>------ Build started: Project: WTF, Configuration: Debug Win32 ------

2>Performing Pre-Build Event...

2>/usr/bin/bash

2>Compiling...

2>CollatorDefault.cpp

2>e:\Work\webkit\src\JavaScriptCore\wtf/unicode/icu/UnicodeIcu.h(27) : fatal error

C1083: Cannot open include file: 'unicode/uchar.h': No such file or directory

2>FastMalloc.cpp

2>..\..\wtf\FastMalloc.cpp(83) : fatal error C1083: Cannot open include file: 'pthread.h': No such file or directory

          

ð  WEBKITLIBRARIESDIR 환경변수가 잘못 지정됐기 때문이다.
WEBKITOUTPUTDIR
환경변수에는 임의의 path를 지정해도 되지만
,
WEBKITLIBRARIESDIR
환경변수에는 WebKit 소스트리 안에 있는

$(SrcHome)\WebKitLibraries\win path
(Window Style) 지정해야 한다.

 

 

(이상입니다.)

 

 

Posted by ingeeC
,