VirtualBox 4.3.6 编译 for 64bit Windows
来源:互联网 发布:linux清屏命令快捷键 编辑:程序博客网 时间:2024/06/08 03:49
泡 csdn 这么多年了,一篇博客都没有发过,2014了 嘿嘿
废话少说进入正题.
话说 VirtualBox 的Build 教程 估计想编的人都看过 但我估计编译成功的人不多.
这个是官方文档 https://www.virtualbox.org/wiki/Windows%20build%20instructions 也是需要看下的
准备官方要求的各种 64位库
首先就是下代码了... 以 最新的 VirtualBOx 4.3.6 为例吧
VirtualBox 4.3.6 找个目录解开
你解包的代码编码是有问题的需要转换下
先弄2个bat 文件
conv.bat
set path=%path%;"D:\Build64\libiconv\bin\"for /f "delims=" %%i in ('dir /b /a-d /s *.cpp *.h') do a2u %%i
a2u.bat
for %%f in (%1) do copy %%f %%f.ascIIfor %%f in (%1) do iconv -c -f ascii -t utf-8 %%f.ascII > %%f
保存到源代码根目录
这个 "D:\Build\libiconv\bin\" 是iconv 工具你要改到相应目录下
执行conv.bat 他会生成utf-8的代码
然后执行下 del *.ascII /s 删除垃圾 ps 这转换命令只能执行一次啊啊啊啊啊啊啊啊!!
有时会失败 把文件变成0字节... 失败了就解压重来一次么 ^ ^
这样你的代码编码 就转换了.
下来就是 把官方要求的 各种库 工具都装齐 有个顺序 先vs2010 再wdk 然后 vs2010sp1 要不然有个什么玩意冲突 麻烦!
windows sdk 可以不装 就用 vs自带的就行.
再来修改 configure.vbs 中文的那段
if (strPathVCCommon <> "") Then EnvAppend "PATH", ";" & strPathVCCommon & "/IDE" end if if Shell(DosSlashes(strPathVC & "/cl.exe"), True) <> 0 then MsgError "Executing '" & strClExe & "' (which we believe to be the Visual C++ compiler driver) failed." exit sub end if if (InStr(1, g_strShellOutput, "编译器 16.") <= 0) _ And (InStr(1, g_strShellOutput, "17.00") <= 0) then MsgError "The Visual C++ compiler we found ('" & strPathVC & "') isn't 10.0 or 11.0. Check the build requirements." exit sub end if ' ' Ok, emit build config variables. ' if InStr(1, g_strShellOutput, "编译器 16.") > 0 then CfgPrint "PATH_TOOL_VCC100 := " & g_strPathVCC CfgPrint "PATH_TOOL_VCC100X86 := $(PATH_TOOL_VCC100)" CfgPrint "PATH_TOOL_VCC100AMD64 := $(PATH_TOOL_VCC100)" if LogFileExists(strPathVC, "atlmfc/include/atlbase.h") then PrintResult "Visual C++ v10 with ATL", g_strPathVCC elseif LogFileExists(g_strPathDDK, "inc/atl71/atlbase.h")
我自己写了个跑configure.vbs脚本的bat 也贴上来吧
run.bat
set PATH=%PATH%;D:\build64\MinGW64\bin;D:\Python27
cscript configure.vbs --with-MinGW32="D:\build64\MinGW64\bin\" ^--with-libSDL="D:\build64\SDL" ^--with-openssl="D:\build64\OpenSSL" ^--with-libcurl="D:\build64\libcurl" ^--with-Qt4="D:\build64\Qt4" ^--with-MinGW-w64="D:\build64\MinGW64\bin\" ^--with-python="D:\Python27"
通过以上也可以看出我build时 使用的目录结构
打开 vs x64命令行 !!!!!! 别用cmd!!!!!
run 一下 生成一个 AutoConfig.kmk 其实罗嗦一大堆脚本 这个 AutoConfig.kmk 才是真正用到的
贴一下我的
# -*- Makefile -*-## Build configuration generated by cscript configure.vbs --with-MinGW32=D:\build64\MinGW64\bin\ --with-libSDL=D:\build64\SDL --with-openssl=D:\build64\OpenSSL --with-libcurl=D:\build64\libcurl --with-Qt4=D:\build64\Qt4 --with-MinGW-w64=D:\build64\MinGW64\bin\ --with-python=D:\Python27#VBOX_OSE := 1PATH_SDK_WINDDK71 := D:/WinDDK/7600.16385.1VBOX_WITH_WDDM_W8 := PATH_TOOL_VCC100 := C:/PROGRA~2/MICROS~2.0/VCPATH_TOOL_VCC100X86 := $(PATH_TOOL_VCC100)PATH_TOOL_VCC100AMD64 := $(PATH_TOOL_VCC100)VBOX_WITHOUT_COMPILER_REDIST=1PATH_TOOL_VCC100_ATLMFC_INC = D:/WinDDK/7600.16385.1/inc/atl71PATH_TOOL_VCC100_ATLMFC_LIB.amd64 = D:/WinDDK/7600.16385.1/lib/ATL/amd64PATH_TOOL_VCC100_ATLMFC_LIB.x86 = D:/WinDDK/7600.16385.1/lib/ATL/i386PATH_TOOL_VCC100AMD64_ATLMFC_INC = D:/WinDDK/7600.16385.1/inc/atl71PATH_TOOL_VCC100AMD64_ATLMFC_LIB = D:/WinDDK/7600.16385.1/lib/ATL/amd64PATH_TOOL_VCC100X86_ATLMFC_INC = D:/WinDDK/7600.16385.1/inc/atl71PATH_TOOL_VCC100X86_ATLMFC_LIB = D:/WinDDK/7600.16385.1/lib/ATL/i386PATH_SDK_WINPSDK71 := C:/PROGRA~2/MICROS~3/Windows/v7.0AVBOX_WINPSDK := WINPSDK71VBOX_MAIN_IDL := C:/PROGRA~2/MICROS~3/Windows/v7.0A/bin/Midl.exePATH_TOOL_MINGWW64 := D:/build64/MinGW64VBOX_WITH_OPEN_WATCOM := PATH_SDK_LIBSDL := D:/build64/SDLSDK_VBOX_OPENSSL_INCS := D:/build64/OpenSSL/includeSDK_VBOX_OPENSSL_LIBS := D:/build64/OpenSSL/lib/ssleay32.lib D:/build64/OpenSSL/lib/libeay32.libSDK_VBOX_BLD_OPENSSL_LIBS := D:/build64/OpenSSL/lib/ssleay32.lib D:/build64/OpenSSL/lib/libeay32.libSDK_VBOX_LIBCURL_INCS := D:/build64/libcurl/includeSDK_VBOX_LIBCURL_LIBS := D:/build64/libcurl/libcurl.libPATH_SDK_QT4 := D:/build64/Qt4PATH_TOOL_QT4 := $(PATH_SDK_QT4)VBOX_PATH_QT4 := $(PATH_SDK_QT4)VBOX_BLD_PYTHON := D:\Python27\python.exe
这里 第8行
PATH_TOOL_VCC100 := C:/PROGRA~2/MICROS~2.0/VC/bin
改成
PATH_TOOL_VCC100 := C:/PROGRA~2/MICROS~2.0/VC
他这个vbs脚本从一诞生就没怎么正常过 反正都要改 这里用的短路径 "~2" 你我可能不同
4.3 的 代码里多了个 VBOX_WITH_32_ON_64_MAIN_API 宏 注意凡是 -x86 后缀的文件名 都是32位的 link 的时候需要 32位的lib库
我嫌麻烦直接在 config.kmk里关掉了这个宏
line 517
#VBOX_WITH_32_ON_64_MAIN_API = 1
还有漏的比如这个
把 代码路径src\VBox\Runtime\Makefile.kmk 这段 删除 或者注掉
## VBoxRT-x86 - 32-bit version of VBoxRT#VBoxRT-x86_EXTENDS = VBoxRTVBoxRT-x86_TEMPLATE = VBoxR3Dll-x86VBoxRT-x86_SDKS = VBOX_LIBXML2ifdef VBOX_WITH_LIBCURL VBoxRT-x86_SDKS += VBOX_LIBCURL-x86endifVBoxRT-x86_SDKS += VBOX_OPENSSL-x86VBoxRT-x86_LIBS = \$(PATH_STAGE_LIB)/VBox-liblzf-x86$(VBOX_SUFF_LIB)if1of ($(KBUILD_TARGET_ARCH), amd64 x86)VBoxRT-x86_LIBS += \$(PATH_STAGE_LIB)/SUPR3-x86$(VBOX_SUFF_LIB)endififdef IPRT_WITH_KSTUFF VBoxRT-x86_LIBS += \$(PATH_STAGE_LIB)/VBox-kStuff-x86$(VBOX_SUFF_LIB)endififndef SDK_VBOX_LIBXML2_LIBS VBoxRT-x86_LIBS += \$(PATH_STAGE_LIB)/VBox-libxml2-x86$(VBOX_SUFF_LIB)endifVBoxRT-x86_LIBS += \$(SDK_VBOX_ZLIB_LIBS-x86)ifndef SDK_VBOX_OPENSSL_LIBS VBoxRT-x86_LIBS += \$(PATH_STAGE_LIB)/VBox-libcrypto-x86$(VBOX_SUFF_LIB) \$(PATH_STAGE_LIB)/VBox-libssl-x86$(VBOX_SUFF_LIB)endififdef IPRT_WITH_LZO VBoxRT-x86_LIBS += lzo2endifVBoxRT-x86_LIBS.linux = \cryptVBoxRT-x86_LIBS.darwin = \iconvVBoxRT-x86_LIBS.freebsd = \iconv \rtVBoxRT-x86_LIBS.haiku = \iconvVBoxRT-x86_LIBS.solaris = \kstat \contractifn1of ($(KBUILD_TARGET_ARCH), sparc32 sparc64) # SMBIOS not available on Solaris SPARC. VBoxRT-x86_LIBS.solaris += smbiosendifVBoxRT-x86_LIBS.win = \$(PATH_SDK_$(VBOX_WINDDK)_LIB.x86)/vccomsup.lib \$(PATH_SDK_$(VBOX_WINDDK)_LIB.x86)/wbemuuid.libVBoxRT-x86_SOURCES.win = $(filter-out %.def,$(VBoxRT_SOURCES.win)) \$(VBoxRT-x86_0_OUTDIR)/VBoxRT-x86.defif1of ($(DLLS), VBoxRT-x86)$$(VBoxRT-x86_0_OUTDIR)/VBoxRT-x86.def: \$(PATH_SUB_CURRENT)/r3/win/VBoxRT-win32.def \$(PATH_SUB_CURRENT)/r3/win/$(if $(VBOX_OSE),VBoxRT-openssl-ose.def,VBoxRT-openssl.def)$(RM) -f -- $@$(REDIRECT) -wto $@ -- $(CAT_EXT) $^endif
还有个testcase会出错 说找不到 /bin/nm.exe连目录直接删掉好了 或者注掉
src\VBox\VMM\testcase\Makefile.kmk
line 372
ifeq ($(KBUILD_HOST),win)# ifndef TOOL_MINGW32# include $(KBUILD_PATH)/tools/MINGW32.kmk# endif# VBOX_NM ?= $(PATH_TOOL_MINGW32)/bin/nm.exe -p#else VBOX_NM ?= nm -pendif因该是PATH 环境变量的问题 要把你mingw64\bin 放进去
按照官方的驱动测试模式 操作下
Only for 64 bit builds: setting up self signingPart 1: creating and installing the test certificateLaunch an elevated command line shell (Vista and later).makecert.exe -r -pe -ss my -n "CN=MyTestCertificate" mytestcert.cercertmgr.exe -add mytestcert.cer -s -r localMachine rootStart certmgr.exe and check that "MyTestCertificate" is listed both under "Personal" and "Trusted Root Certification Authorities".Keep the mytestcert.cer file in a safe place.Part 2: configuring the system to run test signed code (Vista and later)Launch an elevated command line shell (Vista and later).Run Bcdedit.exe -set TESTSIGNING ON on an elevated cmd.exe prompt.certmgr.exe -add mytestcert.cer -s -r localMachine rootcertmgr.exe -add mytestcert.cer -s -r localMachine trustedpublisherReboot.Vista: "Test Mode" will appear in all four corners of the desktop and "Microsoft (R) Windows (R) (Build 6000)" will appear on the top. Windows 7: "Test Mode<CR>Windows 7<CR>Build 7600" will appear in the lower right corner.Part 3: building VirtualBox with signing enabledIf you called the certificate something other than MyTestCertificate you'll have make the appropriate overrides in LocalConfig.kmk. See the Code Signing section of Config.kmk for what can be overridden.Add VBOX_SIGNING_MODE=test to LocalConfig.kmk.Build (incremental is sufficient).
注册下环境变量
set LIB_TARGET=amd64set VBOX_PATH_SELFSIGN=D:/WinDDK/7600.16385.1/bin/selfsignset VBOX_SIGNTOOL="D:/WinDDK/7600.16385.1/bin/amd64/SignTool.exe"set VBOX_CROSS_CERTIFICATE_FILE=D:/build64/VirtualBox/mytestcert.cerset VBOX_INF2CAT="D:/WinDDK/7600.16385.1/bin/selfsign/Inf2Cat.exe"call kbuild\envwin.sh -release -win64call env.bat
kmk 喽
正常情况就编完了 断了就改改代码喽...
有什么问题我以后再补充
作者从事多年 VirtualBox开发 和 安卓模拟器开发
如果有技术外包需求可入群联系 310028809
- VirtualBox 4.3.6 编译 for 64bit Windows
- VirtualBox 4.3.6 编译 for 64bit Windows
- 在VS2012编译LibGizmo for 64bit
- 安装ANDROID开发工具(FOR WINDOWS 32BIT/64BIT)
- Driver Development for Windows 64-bit.
- compile ffmpeg for windows 64-bit
- numpy for python 2.7 (windows 64 bit)
- CentOS 64bit 安装virtualbox
- android 4.2 在12.4 for ubuntu 64bit 编译问题。
- php5.4.11 x64(64bit)for windows 的下载地址
- mysql 5.7 binary for windows 7 64bit 安装
- Visual Page Editor has experimental support for Windows 64-bit
- Windows 7 64bit编译rpy2 Python扩展
- How to Increase the Memory Limit for 32-bit Applications in Windows 64-bit OS
- MySQL-python 1.2.3 for Windows and Python 2.7, 32bit and 64bit versions
- UT-VPN server & Client install for Windows 7 32bit/64bit
- UT-VPN server & Client install for Windows 7 32bit/64bit
- 64bit windows 7 VMWare+ 64bit Ubuntu12.04 uboot ,kernel,android编译环境搭建教程
- Jetty 的工作原理以及与 Tomcat 的比较
- 四季
- Ubuntu下测试RT-Linux的性能
- linux下https连接本地站点
- vl4 linuxtv
- VirtualBox 4.3.6 编译 for 64bit Windows
- Ubuntu定时截屏功能
- Qt 实现登录功能
- AMQP消息服务器RabbitMQ
- 长微博图片实现:将文字转成图片
- LevelDB源码之SkipList原理
- 使用Winbase.h错误的解决
- WCF使用X509证书身份验证
- 上传图片