MozTW 討論區 https://forum.moztw.org/ |
|
Windows下使用Intel C++ Compiler编译Firefox https://forum.moztw.org/viewtopic.php?f=18&t=29376 |
第 1 頁 (共 1 頁) |
發表人: | coolypf [ 2010-01-27, 17:41 ] |
文章主題 : | Windows下使用Intel C++ Compiler编译Firefox |
PGO编译成功,详情请去我的博客观赏。 http://hi.baidu.com/coolypf Linux下用icc替换gcc编译Firefox比较容易,Windows下用icl替换cl则很困难。 下面的程序可以帮助骗过configure脚本,将编译所得程序重命名为cl,放入msys/bin目录中。 make -f client.mk build启动编译,遇到错误停止时,configure步骤已经过去, 可以用make -f client.mk build CC=icl CXX=icl继续编译。 目前测试,可以顺利完成整个编译过程(有些代码要稍加修改)。 代碼: /*********************************
* ICC wrapper for Mozilla Build * * by coolypf 20100127 * *********************************/ #include <stdio.h> #include <stdlib.h> #include <windows.h> #include <string> using std::string; char cl[]="c:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\BIN\\cl.exe"; char icl[]="c:\\Program Files (x86)\\Intel\\Compiler\\11.1\\051\\Bin\\ia32\\icl.exe"; char clflags[]="/O2"; char iclerr[]=": error: "; PROCESS_INFORMATION pi; HANDLE Exec(const char *cmd) { SECURITY_ATTRIBUTES sa; HANDLE hRead,hWrite; sa.nLength = sizeof(SECURITY_ATTRIBUTES); sa.lpSecurityDescriptor = NULL; sa.bInheritHandle = TRUE; if (!CreatePipe(&hRead,&hWrite,&sa,0)) { printf("Error On CreatePipe()"); exit(-1); } STARTUPINFOA si; si.cb = sizeof(STARTUPINFO); GetStartupInfoA(&si); si.hStdError = hWrite; si.hStdOutput = hWrite; si.wShowWindow = SW_HIDE; si.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES; if (!CreateProcessA(NULL,_strdup(cmd),NULL,NULL,TRUE,NULL,NULL,NULL,&si,&pi)) { printf("Error on CreateProcess()"); exit(-1); } CloseHandle(hWrite); return hRead; } int main(int argc, char **argv) { string arg; for(int i=1; i<argc; ++i) { arg.append(" "); arg.append(argv[i]); } string clcmd=cl+string(" ")+clflags+" "+arg; string iclcmd=icl+string(" ")+arg; char buf[10241]; unsigned long count; HANDLE h; h=Exec(clcmd.c_str()); while(ReadFile(h, buf, 10240, &count, 0)) { buf[count]=0; printf("%s", buf); } WaitForSingleObject(pi.hProcess, INFINITE); unsigned long e1; if(!GetExitCodeProcess(pi.hProcess, &e1)) e1=0; h=Exec(iclcmd.c_str()); bool r=false; while(ReadFile(h, buf, 10240, &count, 0)) { buf[count]=0; if(strstr(buf, iclerr)) { r=true; break; } } WaitForSingleObject(pi.hProcess, INFINITE); unsigned long e2; if(!GetExitCodeProcess(pi.hProcess, &e2)) e2=0; if(r) Exec(clcmd.c_str()); if(e1==0 || e2==0) return 0; return e1; } |
發表人: | s793016 [ 2010-01-28, 09:22 ] |
文章主題 : | Re: Windows下使用Intel C++ Compiler編譯Firefox |
coolypf 寫: 目前測試,可以順利完成整個編譯過程(有些代碼要稍加修改),但ICC啟用PGO選項後編譯出來的程序沒法運行。 跟我當初測的結果差不多,不過 Intel C++ 沒了 PGO 那還不如用 VC++ 就好 ![]() |
發表人: | coolypf [ 2010-01-28, 11:58 ] |
文章主題 : | Re: Windows下使用Intel C++ Compiler編譯Firefox |
s793016 寫: coolypf 寫: 目前測試,可以順利完成整個編譯過程(有些代碼要稍加修改),但ICC啟用PGO選項後編譯出來的程序沒法運行。 跟我當初測的結果差不多,不過 Intel C++ 沒了 PGO 那還不如用 VC++ 就好 ![]() 确实,ICC用-O3 -QxHost选项编译出来的程序比VC的PGO要慢一些。 目前我正在尝试: "-O3 -QxHost -Qparallel -Qipo-separate -Qprof-gen -Qprof-dird:/temp/ffprof" |
發表人: | s793016 [ 2010-01-28, 23:31 ] |
文章主題 : | Re: Windows下使用Intel C++ Compiler編譯Firefox |
您加油,我因工作加重,且 Seamonkey 2.0 出了,短時間內我已經不太想再自已編了。 當然,可以的話,也請最終整理一下編譯的作法並發篇簡短的教學吧,因中文的世界這種文真的太少了,少到幾乎沒有。 當年寫的東西,獻醜一下: VS2005 編譯 Gecko 1.8 VS2008 編譯 Gecko 1.8 這個是別人寫的: Win32 MingW 編譯 Firefox |
發表人: | s793016 [ 2010-05-01, 00:15 ] |
文章主題 : | Re: Windows下使用Intel C++ Compiler编译Firefox |
目前測試編 firefox 3.6.3 intel c++ v11 無 pgo 版已編譯成功,待全部研究完後再寫專文。 ps: 用的不是樓主的方法。 |
發表人: | 某A [ 2010-05-06, 15:25 ] |
文章主題 : | Re: Windows下使用Intel C++ Compiler编译Firefox |
我抓了樓主的來試用。不過一直出現錯誤… 找了libmmd.dll來也一樣動不了。 我的電腦是 Intel Core 2 Duo T5450 處理器, 作業系統是Windows Vista Home Premium x86 w/SP2繁體中文版 |
發表人: | cecilyen [ 2010-05-26, 11:11 ] |
文章主題 : | Re: Windows下使用Intel C++ Compiler编译Firefox |
很好奇, 用icc 11 pgo編出來的 Firefox 是否會快過用 GCC 4.5 pgo編的 根據這裡, 在Linux下這兩個本版的效能差不多 |
發表人: | s793016 [ 2010-05-26, 23:16 ] |
文章主題 : | Re: Windows下使用Intel C++ Compiler编译Firefox |
cecilyen 寫: 很好奇, 用icc 11 pgo編出來的 Firefox 是否會快過用 GCC 4.5 pgo編的 根據這裡, 在Linux下這兩個本版的效能差不多 目前 google 看得到的 icl 編譯 firefox 都沒有 pgo,有 pgo 的只有樓主的版本。 我目前自己編是無法完成 icl pgo。 而我測試過自編的 icl firefox 無 pgo 的版本是比官版 pgo 來得慢。 |
發表人: | s793016 [ 2010-05-30, 23:15 ] | ||
文章主題 : | Re: Windows下使用Intel C++ Compiler编译Firefox | ||
這邊提供無 PGO 的版本供測試:載點 使用的最佳化參數是這樣: -fast -QaxAVX,SSE4.2,SSE4.1,SSE3_ATOM,SSSE3,SSE3,SSE2 -QxSSE2 -W0 -Qparallel -Qmultibyte-chars -GLT -GS- -fp:fast=2 -MP:2 -D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -wd4624 -wd4952 -Quse-intel-optimized-headers -Qopt-multi-version-aggressive -Qopt-prefetch:4 -Qipo-jobs:2 -Qopt-mem-bandwidth2 想自己編的人,下載附件的 patch 回去打上就可以編了。不過 pgo 編不過哦,會出現這個問題。目前無解: 引言回覆: xilib -NOLOGO -OUT:"migration_s.lib" nsProfileMigrator.obj nsBrowserProfileMigratorUtils.obj nsNetscapeProfileMigratorBase.obj nsSeamonkeyProfileMigrator.obj nsPhoenixProfileMigrator.obj nsDogbertProfileMigrator.obj nsOperaProfileMigrator.obj nsIEProfileMigrator.obj
(0): internal error: 0_0 xilib: error #10014: problem during multi-file optimization compilation (code 4) xilib: error #10014: problem during multi-file optimization compilation (code 4) make[7]: *** [migration_s.lib] Error 1 make[7]: Leaving directory `/d/mozilla/comm-1.9.1/obj/browser/components/migration/src' make[6]: *** [libs] Error 2 make[6]: Leaving directory `/d/mozilla/comm-1.9.1/obj/browser/components/migration' make[5]: *** [libs] Error 2 make[5]: Leaving directory `/d/mozilla/comm-1.9.1/obj/browser/components' make[4]: *** [libs] Error 2 make[4]: Leaving directory `/d/mozilla/comm-1.9.1/obj/browser' make[3]: *** [libs_tier_app] Error 2 make[3]: Leaving directory `/d/mozilla/comm-1.9.1/obj' make[2]: *** [tier_app] Error 2 make[2]: Leaving directory `/d/mozilla/comm-1.9.1/obj' make[1]: *** [default] Error 2 make[1]: Leaving directory `/d/mozilla/comm-1.9.1/obj' make: *** [build] Error 2
|
第 1 頁 (共 1 頁) | 所有顯示的時間為 UTC + 8 小時 |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |