파이어폭스 브라우저 소스코드 컴파일에서 주의할 점 몇가지

기초지식이 일천한 상태에서 맨 땅에 헤딩하기가 너무 어렵다.
나중을 위해 기록으로 남긴다.

  1. MozillaBuild package  install이것이 잘못되면 해결안 되는 build error가 발생한다.

======  사례  ==============

aesopc@aesopc-Pad /d/mozilla-central
$ ./mach build
0:02.17 c:\mozilla-build\mozmake\mozmake.EXE -f client.mk MOZ_PARALLEL_BUILD=4 -s
0:06.62 client.mk:201: d:/mozilla-central/obj-test/.mozconfig.mk: No such file or directory
0:09.92 Clobber not needed.
0:21.56 Adding client.mk options from d:/mozilla-central/.mozconfig:
0:21.56 MOZ_MAKE_FLAGS=-j4
0:21.56 MOZ_OBJDIR=d:/mozilla-central/obj-test
0:21.57 OBJDIR=d:/mozilla-central/obj-test
0:21.57 FOUND_MOZCONFIG=d:/mozilla-central/.mozconfig
0:26.38 cd d:/mozilla-central/obj-test
0:26.42 d:/mozilla-central/configure
0:29.54 Adding configure options from d:/mozilla-central/.mozconfig
0:29.54 --disable-gamepad
0:29.54 --enable-optimize=-O2
0:29.54 --disable-tests
0:29.54 --disable-accessibility
0:29.54 --disable-update-channel
0:29.54 --disable-debug
0:29.55 --enable-official-branding
0:29.55 --disable-crashreporter
0:32.12 creating cache ./config.cache
0:34.06 checking host system type... i686-pc-mingw32
0:34.81 checking target system type... i686-pc-mingw32
0:35.57 checking build system type... i686-pc-mingw32
0:35.62 checking for mawk... no
0:35.64 checking for gawk... gawk
0:35.81 checking for python2.7... /c/mozilla-build/python/python2.7
0:35.94 Creating Python environment
0:37.04 New python executable in d:/mozilla-central/obj-test/_virtualenv\Scripts\python2.7.exe
0:37.05 Also creating executable in d:/mozilla-central/obj-test/_virtualenv\Scripts\python.exe
0:42.47 Installing setuptools, pip...done.
0:44.36 running build_ext
0:44.36
0:44.36 building 'psutil._psutil_windows' extension
0:44.36
0:44.36 c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\amd64_x86\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -DPSUTIL_VERSION=311 -D_WIN32_WINNT=0x
0601 -D_AVAIL_WINVER_=0x0601 -D_CRT_SECURE_NO_WARNINGS -DPSAPI_VERSION=1 -Ic:\mozilla-build\python\include -Id:\mozilla-central\obj-test\_virtualenv\PC /Tcpsuti
l/_psutil_windows.c /Fobuild\temp.win32-2.7\Release\psutil/_psutil_windows.obj
0:44.36
0:44.36 _psutil_windows.c
0:44.36
0:44.36 d:\mozilla-central\python\psutil\psutil\arch\windows\ntextapi.h(189) :error C2365: 'ProcessDebugPort' : redefinition; previous definition was 'enumera
tor'
0:44.37
0:44.37 C:\Program Files (x86)\Windows Kits\8.1\include\um\winternl.h(304) : see declaration of 'ProcessDebugPort'
...

0:56.27 d:/mozilla-central/configure: line 5838: test: /c/mozilla-build/moztools-x64/bin/c: binary operator expected
0:56.27 no
0:56.27 checking for make... /usr/local/bin/make
0:57.81 checking for X... no
0:59.89 checking that static assertion macros used in autoconf tests work... yes
1:00.38 checking for 64-bit OS... no
1:03.98 checking whether the C++ compiler (cl -TP -nologo -D_HAS_EXCEPTIONS=0-W3 -Gy -arch:IA32 -FS -wd4251 -wd4244 -wd4267 -wd4345 -wd4351 -wd4800 -wd4819 -
we4553 -GR- -LARGEADDRESSAWARE -NXCOMPAT -DYNAMICBASE -SAFESEH) actually is a C++ compiler... yes
1:04.76 checking for malloc.h... yes
1:05.40 checking for alloca.h... no
1:05.90 checking for strndup... no
1:06.39 checking for posix_memalign... no
1:06.89 checking for memalign... no
1:07.40 checking for malloc_usable_size... no
1:07.53 checking for malloc.h... (cached) yes
1:08.03 checking whether malloc_usable_size definition can use const argument... yes
1:08.47 checking for valloc in malloc.h... no
1:08.79 checking for valloc in unistd.h... no
1:09.35 checking NSPR selection... source-tree
1:09.79 checking for YASM assembler... checking for yasm... yasm
1:10.49 checking for application to build... browser
1:10.74 checking if app-specific confvars.sh exists... d:/mozilla-central/browser/confvars.sh
1:11.86 configure: error: You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.
1:11.86 ------ config.log ------
...

1:11.93 configure:14785: checking NSPR selection
1:11.94 configure:15483: checking for YASM assembler
1:11.94 configure:15489: checking for yasm
1:11.94 configure:16485: checking for application to build
1:11.94 configure:16666: checking if app-specific confvars.sh exists
1:11.94 configure: error: You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.
1:11.95 *** Fix above errors and then restart with\
1:11.95 "c:/mozilla-build/mozmake/mozmake.EXE -f client.mk build"
1:11.96 d:/mozilla-central/client.mk:361: recipe for target 'configure' failed
1:11.96 mozmake.EXE[2]: *** [configure] Error 1
1:11.97 d:/mozilla-central/client.mk:375: recipe for target 'd:/mozilla-central/obj-test/Makefile' failed
1:11.97 mozmake.EXE[1]: *** [d:/mozilla-central/obj-test/Makefile] Error 2
1:11.97 client.mk:171: recipe for target 'build' failed
1:11.97 mozmake.EXE: *** [build] Error 2
1:12.04 0 compiler warnings present.
2

================================================

MozillaBuild version을 2.0.0–> 1,11.0으로 낮추었으나  또 다른 생소한 오류가 나타났음.
다시 2.0.0 으로 되돌아오니 정상 작동하기 시작..
하지만 이것이 원인이되었는지는 반복 테스트를 해보지 않아서 확신할 수 없음.
(문서에는 재 설치, 업그레이드 시 반드시 설칟된 버전을 완전히 삭제하는 것을 주의하라고 되어있음.
uninstall package가 없기 때문에 단순히 디렉토리를 삭제하는 것으로 대체함. )

  1. 앞 글에서 사례가 된 리비젼(#f4800de50e03 ) 로 업데이트 하면 mach command 가 비활성화된다.
    –> 생각할수있는 해결방법은 압축본을 받아서 덥어쓰기 해보는 것인데..
    일단 최신본의 빌드에 성공하고난 후에 복사본의 디렉토리를 만들고 그 곳에서 테스트

==>결과

aesopc@aesopc-Pad /d/mozilla-
$ ./mach build
 0:02.12 c:\mozilla-build\mozmake\mozmake.EXE -f client.mk -s
 0:03.08 client.mk:141: /d/mozilla-/.mozconfig.mk: No such file or directory
 0:03.08 mozmake.EXE: *** No rule to make target '/d/mozilla-/.mozconfig.mk'.  Stop.
 0:03.11 0 compiler warnings present.
2

=============================================
==> client.mk 파일이 달라서 발생하는 문제라고 보고
빌드에 성공한 경우의 파일을 복사해옴

==> 결과

aesopc@aesopc-Pad /d/mozilla-
$ ./mach build
 0:02.05 c:\mozilla-build\mozmake\mozmake.EXE -f client.mk -s
 0:12.99 Adding client.mk options from d:/mozilla-/.mozconfig:
 0:12.99     MOZ_OBJDIR=d:/mozilla-firefox/obj-i686-pc-mingw32
 0:12.99     OBJDIR=d:/mozilla-firefox/obj-i686-pc-mingw32
 0:12.99     FOUND_MOZCONFIG=d:/mozilla-firefox/.mozconfig
 0:17.59 cd d:/mozilla-firefox/obj-i686-pc-mingw32
 0:17.63 d:/mozilla-firefox/configure
 0:20.33 loading cache ./config.cache
 0:22.21 checking host system type... i686-pc-mingw32
 0:22.98 checking target system type... i686-pc-mingw32
 0:23.71 checking build system type... i686-pc-mingw32
 0:23.76 checking for mawk... no
 0:23.80 checking for gawk... gawk
 0:23.96 checking for python2.7... /c/mozilla-build/python/python2.7
 0:24.10 Creating Python environment
 0:24.49 checking Python environment is Mozilla virtualenv... Traceback (most recent call last):
 0:24.49   File "", line 1, in 
 0:24.49   File "d:\mozilla-firefox\python\mozbuild\mozbuild\base.py", line 14,in 
 0:24.49     import which
 0:24.50 ImportError: No module named which
 0:24.50 configure: error: Python environment does not appear to be sane.
 0:24.50 ------ config.log ------
 0:24.56 This file contains any messages produced by compilers while
 0:24.56 running configure, to aid debugging if configure makes a mistake.
 0:24.56
 0:24.56 configure:1200: checking host system type
 0:24.56 configure:1221: checking target system type
 0:24.56 configure:1239: checking build system type
 0:24.56 configure:1318: checking for mawk
 0:24.56 configure:1318: checking for gawk
 0:24.56 configure:1402: checking for python2.7
 0:24.56 configure:1512: checking Python environment is Mozilla virtualenv
 0:24.57 configure: error: Python environment does not appear to be sane.
 0:24.58 *** Fix above errors and then restart with\
 0:24.58                "c:/mozilla-build/mozmake/mozmake.EXE -f client.mk build"
 0:24.60 d:/mozilla-firefox/client.mk:359: recipe for target 'configure' failed
 0:24.60 mozmake.EXE[2]: *** [configure] Error 1
 0:24.60 d:/mozilla-firefox/client.mk:373: recipe for target 'd:/mozilla-firefox/obj-i686-pc-mingw32/Makefile' failed
 0:24.60 mozmake.EXE[1]: *** [d:/mozilla-firefox/obj-i686-pc-mingw32/Makefile] Error 2
 0:24.61 client.mk:171: recipe for target 'build' failed
 0:24.61 mozmake.EXE: *** [build] Error 2
 0:24.62 0 compiler warnings present.
2

===============================

3.  일단 에러가 나면 먼저 진행한  ‘obj-dir'가 남아있지 않은지 살펴보고 삭제한다.

(./mach clobber  // 명령은 ‘obj-dir'를 삭제하라는 뜻을 가진다.)

결과 :

====================================================

0:33.21 Also creating executable in d:/mozilla-firefox/obj-i686-pc-mingw32/_virtualenv\Scripts\python.exe
0:39.24 Installing setuptools, pip...done.
0:41.16 running build_ext
0:41.16
0:41.16 building 'psutil._psutil_windows' extension
0:41.16
0:41.16 c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\amd64_x86\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -DPSUTIL_VERSION=311 -D_WIN32_WINNT=0x0601 -D_AVAIL_WINVER_=0x0601 -D_CRT_SECURE_NO_WARNINGS -DPSAPI_VERSION=1 -Ic:\mozilla-build\python\include -Id:\mozilla-firefox\obj-i686-pc-mingw32\_virtualenv\PC /Tcpsutil/_psutil_windows.c /Fobuild\temp.win32-2.7\Release\psutil/_psutil_windows.obj

....

 0:41.19         C:\Program Files (x86)\Windows Kits\8.1\include\um\winternl.h(3
08) : see declaration of 'ProcessBreakOnTermination'
 0:41.20
 0:41.20 d:\mozilla-firefox\python\psutil\psutil\arch\windows\ntextapi.h(212) :
error C2086: '_PROCESSINFOCLASS2 ProcessBreakOnTermination' : redefinition
 0:41.20
 0:41.20         d:\mozilla-firefox\python\psutil\psutil\arch\windows\ntextapi.h
(212) : see declaration of 'ProcessBreakOnTermination'
 0:41.20
 0:41.20 error: command 'c:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\
VC\\BIN\\amd64_x86\\cl.exe' failed with exit status 2
 0:41.20
 0:41.21
 0:41.21 Error processing command. Ignoring because optional. (optional:setup.py
:python/psutil:build_ext:--inplace)
 0:41.21 d:/mozilla-firefox/python/mozbuild/mozbuild/virtualenv.py:318: UserWarn
ing: Hacking environment to allow binary Python extensions to build. You can mak
e this warning go away by installing Visual Studio 2008. You can download the Ex
press Edition installer from http://go.microsoft.com/?linkid=7729279
 0:41.21   warnings.warn('Hacking environment to allow binary Python '
...


1:37.67 js\src\ctypes\libffi> running C:/mozilla-build/msys/bin/sh d:/mozilla-firefox/js/src/ctypes/libffi/configure --build=i686-pc-mingw32 --host=i686-pc-mingw32 --disable-shared --enable-static --disable-raw-api AS=ml.exe CC=cl CXX=cl CPP=cl -E -nologo LD=link AR=lib RANLIB=echo not_ranlib STRIP=echo not_strip LD=link CPP=cl -nologo -EP CXXCPP=cl -nologo -EP SHELL=sh.exe CC=/d/mozilla-firefox/js/src/ctypes/libffi/msvcc.sh CXX=/d/mozilla-firefox/js/src/ctypes/libffi/msvcc.sh --cache-file=d:/mozilla-firefox/obj-i686-pc-mingw32/js/src/ctypes/libffi/conf
ig.cache
1:37.68 memory\jemalloc\src> configuring
1:37.68 memory\jemalloc\src> running C:/mozilla-build/msys/bin/sh d:/mozilla-firefox/memory/jemalloc/src/configure --build=i686-pc-mingw32 --host=i686-pc-mingw32 --enable-stats --with-jemalloc-prefix=je_ --disable-valgrind ac_cv_func_memalign=yes ac_cv_func_valloc=yes --without-export --disable-lazy-lock --disable-tls AS=ml.exe CC=cl CXX=cl CPP=cl -E -nologo LD=link AR=lib RANLIB=echo not_ranlibSTRIP=echo not_strip CPPFLAGS= EXTRA_CFLAGS= LDFLAGS= ac_cv_func_sbrk=false --enable-munmap --disable-cache-oblivious --cache-file=d:/mozilla-firefox/obj-i686-p
c-mingw32/memory/jemalloc/src/config.cache
1:37.73 nsprpub> configuring
1:37.73 nsprpub> running C:/mozilla-build/msys/bin/sh d:/mozilla-firefox/nsprpub/configure --build=i686-pc-mingw32 --with-ist-prefix=d:/mozilla-firefox/obj-i686-pc-mingw32/dist --with-mozilla --disable-debug --enable-optimize AS=ml.exe CC= CXX= CPP=cl -E -nologo LD=link AR=lib RANLIB=echo not_ranlib STRIP=echo not_strip --cache-file=d:/mozilla-firefox/obj-i686-pc-mingw32/nsprpub/config.cache
1:40.68 js\src> configuring
1:40.68 js\src> running C:/mozilla-build/msys/bin/sh d:/mozilla-firefox/js/src/configure --enable-threadsafe --enable-ctypes --disable-hared-js --with-nspr-cflags=-Id:/mozilla-firefox/obj-i686-pc-mingw32/dist/include/nspr --with-nspr-libs=d:/mozilla-firefox/obj-i686-pc-mingw32/dist/lib/nspr4.lib d:/mozilla-firefox/obj-i686-pc-mingw32/dist/lib/plc4.lib d:/mozilla-firefox/obj-i686-pc-mingw32/dist/lib/plds4.lib --prefix=d:/mozilla-firefox/obj-i686-pc-mingw32/dist --enable-jemalloc --cache-file=d:/mozilla-firefox/obj-i686-pc-mingw32/js/src/config.cache
1:40.68 nsprpub> configure: warning: AS=ml.exe: invalid host type
1:40.68 nsprpub> configure: warning: CC=: invalid host type
1:40.68 nsprpub> configure: error: can only configure for one host and one target at a time
1:40.69
5:37.75 *** Fix above errors and then restart with\
5:37.75 "c:/mozilla-build/mozmake/mozmake.EXE -f client.mk build"
5:37.76 d:/mozilla-firefox/client.mk:359: recipe for target 'configure' failed
5:37.76 mozmake.EXE[2]: *** [configure] Error 1
5:37.77 d:/mozilla-firefox/client.mk:373: recipe for target 'd:/mozilla-firefox/obj-i686-pc-mingw32/Makefile' failed
5:37.77 mozmake.EXE[1]: *** [d:/mozilla-firefox/obj-i686-pc-mingw32/Makefile] Error 2
5:37.77 client.mk:171: recipe for target 'build' failed
5:37.77 mozmake.EXE: *** [build] Error 2
5:37.80 0 compiler warnings present.
2

====================================================

 

종합 결론

앞에서 사례로 든 문서 https://wiki.mozilla.org/Education/Learning/ModifyBrowser 는 수 년전(2009년)에 작성된 것으로서 여기서 기재된  리비젼(#f4800de50e03 ) 도 또한 아주 오래된 버전(mozilla 1.9.2; firefox version3.6)이다.
그런데 문서 Obsolete Build Caveats and Tips 에   가보면  Firefox 10이하 부터는 visual Studio 2010 를 사용하라고 나온다.
지금까지 문제의 원인은 여기에있었던 것으로 생각된다.

visual Studio 2010 구해서 테스트 해보기 전까지는 일단 작업을 중단한다.

 

소셜댓글

Loading Disqus Comments ...

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다

이 사이트는 스팸을 줄이는 아키스밋을 사용합니다. 댓글이 어떻게 처리되는지 알아보십시오.