مقدمة
إنها حقيقة معروفة لكثير من مستخدمي إصدار Windows من VirtualBox (من الآن فصاعدًا ،
VB ؛ يجب عدم الخلط بينه وبين Visual Basic) التي تبدأ بـ 4.3.14 أضاف المطورون ما يسمى بـ "تصلب" المصمم لمنع الحقن الخبيثة في VB. على الرغم من أن النوايا كانت جيدة ، إلا أن التنفيذ تسبب في تعارضات عديدة مع منتجات مشروعة تمامًا مثل برامج مكافحة الفيروسات ووحدات التشفير وحتى بعض تحديثات Windows نفسه ، وعندما يحدث مثل هذا التعارض ، يتوقف VB ببساطة عن العمل. يتعين على المستخدمين الانتظار لمدة شهر على الأقل حتى يتم إصدار إصدار VB الجديد مع إضافة الاستبعادات المناسبة. الأسوأ من ذلك هو أنه يجب إلغاء تثبيت التطبيق أو التحديث المتعارضين ، أو يجب إعادة تصنيف VB نفسه إلى الإصدار 4.3.12 الذي كان الأحدث دون تصلب. العديد من الطلبات لإضافة قائمة استبعاد يسيطر عليها المستخدم ، أو خيار لتعطيل التصلب ، لم يتم الرد عليها جميعًا. يبدو الرد الوحيد من المطورين مثل "إذا كنت لا ترغب في بنائه من الكود المصدري بنفسك". حسنًا ، يبدو أننا سنحتاج إلى.
على الرغم من أن تعليمات الإنشاء
موصوفة في المشروع الرسمي Wiki ، إلا أنها غير مكتملة وعفا عليها الزمن إلى حد ما ، بينما يفشل إجراء الإنشاء غالبًا مع وجود رسائل خطأ غامضة. لذلك عندما ، في النهاية ، نجحت في العمل ، اعتقدت أن الأمر يستحق التوثيق بتفاصيل كاملة في مقالة منفصلة. يتم تحديث هذه التعليمات من وقت لآخر ، وفي الوقت الحالي يتم تكييفها لبناء الإصدار 6.0.4 من VB. ومع ذلك ، إذا كنت بحاجة إلى معلومات حول إنشاء إصدارات سابقة من VB أو المكتبات المساعدة ، فيمكنك دائمًا الحصول عليها من
تاريخ التغييرات .
جدول المحتويات
» بيان المشكلة
» كلمة تحذير
بناء بيئة التحضير
» تطبيقات تثبيت المراوغات
» اللمسات الاخيرة
» بناء فيرتثلبوإكس
» الخاتمة
» التعديلات
بيان المشكلة
في البداية ، أردت أن أبسط الأمر ببساطة عن طريق إعادة بناء المكونات الثنائية ونسخها في أعلى الإصدار المثبت من التوزيع الرسمي. ومع ذلك ، فقد كان هذا بعيدًا عن البساطة لأن التثبيت يعتمد على بعض واجهات برمجة التطبيقات للنظام الغامض ويتطلب تثبيت برامج التشغيل وتسجيل مكونات COM. لقد تساءلت عما إذا كان من المجدي معرفة كيفية عمل كل هذا وكتابة برنامج نصي لأتمتة هذه المهام ، لكن بعد بعض الاعتبارات قررت أن أذهب إلى حجم كبير وأن أقوم بتوزيع كامل يكون أقرب إلى التوزيع الرسمي قدر الإمكان ، فقط دون تصلب.
يجب أن أقول إن هذه المهمة كانت صعبة حقًا ، وفشلت في تحقيقها بنسبة 100٪. ما تعثرت به هو إضافات الضيوف التي يتم توفيرها لأنظمة Windows (32 و 64 بت) و OS / 2 و Linux وبعض أنظمة * NIX الأخرى. تشير التعليقات في Makefile المقابلة إلى أنها جميعًا مبنية على أجهزة بعيدة مختلفة ، وبالتأكيد لم أكن أتطلع إلى إدارة مثل هذا المصنع. لذلك كان الحل النهائي هو بناء كل شيء من أكواد المصدر ، باستثناء الإضافات ، لكن التقاط صورة ISO الرسمية معهم ووضعها في التوزيع كما هي. لم أتحقق مما إذا كانت الإضافات لها نفس آلية التصلب ، لكن حتى إذا لم تكن قد سمعت عن أي شكوى من ذلك.
كلمة تحذير
• الاعتبارات الأمنية
لم تتم إضافة تصلب على نزوة ، كان حلاً لإغلاق ثغرة أمنية في VB. للأسف ، أوراكل ترفض تقديم وصف مفصل لهذه المشكلة ، على الرغم من أنه تم إصلاحها منذ سنوات عديدة. بشكل عام ، يتعلق الأمر بآلية حقن DLL في Windows والتي ، في حالة VB ، يمكن أن تؤدي إلى رفع الامتياز غير المصرح به على الكمبيوتر المضيف ، وهناك مآثر عمل لهذه الثغرة الأمنية. لذا كن حذرًا إذا قررت استخدام إصدار أقل صلابة على أي حال.
• توقيع السائقين
بدءًا من نظام التشغيل Vista ، لا يمكن للمستخدمين في إصدارات Windows 64 بت تحميل برامج تشغيل عشوائية. يجب أن يتم توقيع برامج التشغيل بواسطة شهادة مع سلسلة شهادات مشتركة تصل إلى المرجع المصدق لـ Microsoft (وفي Windows 10 مع تمكين التمهيد الآمن ، يجب أن تكون برامج التشغيل موقعة من قبل Microsoft نفسها). قبل الشروع في رحلة بناء VB ، عليك أن تقرر كيفية حل هذه المشكلة. يمكنك إما إنفاق بعض المال وشراء شهادتك الخاصة ، أو محاولة الاتصال ببعض شركات الطرف الثالث التي تقدم خدمات توقيع لمشاريع مفتوحة المصدر (إذا وافقت على توقيع برامج تشغيل ضعيفة) ، أو قم بتعيين Windows الخاص بك في وضع الاختبار الذي يسمح بتحميل برامج تشغيل وقعت مع شهادة اختبار ولدت محليا.
في المقالة ، سأشير ضمنيًا إلى السيناريو الأخير ، لكنني سأذكر كيف يتغير الإجراء إذا كان لديك شهادة تجارية "كاملة النمو".
بناء إعداد البيئة
يوصي الدليل الرسمي باستخدام Windows 7 إلى 10 كنظام بناء. لقد قمت بكل العمل في Windows 7 SP1 x64 ، ولا أعتقد أن إصدار نظام التشغيل يؤثر على الإجراء كثيرًا. من فضلك ، ضع في اعتبارك أن الجهاز (حقيقي أو افتراضي) الذي ستستخدمه لإنشاء VB يجب أن يكون لديه اتصال بالإنترنت.
تتطلب بيئة البناء مجموعة كبيرة من الأدوات. إذا كان لدى بعض البرامج إصدار محمول ، فأفضل أن أغتنم ذلك بدلاً من استخدام برنامج التثبيت.
الآن ، لا يمكن الحصول على البرامج التالية إلا كتوزيعات قابلة للتثبيت (على الأقل ، رسميًا). بالنسبة لبرنامج Visual Studio و SDK / WDK ، من المهم اتباع ترتيب التثبيت على النحو المحدد أدناه. بعد الانتهاء معهم ، أوصي بشدة بتشغيل Windows Update وجلب آخر التحديثات لجميع منتجات Microsoft.
يتم تنزيل البرامج الأخرى كأرشيفات محمولة أو أكواد مصدر:
ستحتاج أيضًا إلى المحفوظات التالية:
ماذا يجب أن تريد كل هذا؟إذا كنت لا ترغب في إنشاء نفس الحزمة تمامًا مثلي ، فقد تتمكن من التخلص من بعض الأدوات المذكورة أعلاه. حتى هنا سأقدم بعض التفاصيل لغرضهم في عملية البناء.
- SDK 8.1
يتم إجراء الإنشاء الفعلي باستخدام SDK 7.1 ، لكنك ستحتاج إلى برنامج SignTool من 8.1 ، لأن الواحد من 7.1 غير قادر على تنفيذ توقيع SHA-1 / SHA-256 المزدوج. إذا كان لديك SDK 8.1 مثبتًا في مكان آخر ، يمكنك فقط نسخ signtool.exe
بكل تبعياته من هناك ، وتحديد المسار إليه في ملف LocalConfig.kmk
(انظر أدناه ). - WIX
هذا هو الإطار لإنشاء حزم MSI. على الرغم من أن توزيع VB النهائي هو EXE ، إلا أنه يحتوي على ملفي MSI داخل ، لذلك تحتاج إلى WiX لإنشاءها. ومع ذلك ، إذا كنت تنوي فقط إنشاء ملفات VB الثنائية دون تعبئتها ، فيمكنك القيام بذلك دون WiX. - SDL
يتم استخدام هذه المكتبة VBoxSDL.exe
الأمامية التبسيطية الإضافية التي يمكن استخدامها بدلاً من VirtualBox.exe
. من الناحية النظرية ، إذا لم تكن بحاجة إلى هذا المكون ، فيجب أن تكون قادرًا على تشغيل البنية دون استخدام SDL ، لكنني لم أجرب ذلك. - gSOAP
تستخدم هذه المكتبة لإنشاء VBoxWebSrv.exe
، خدمة إدارة عن بعد VB. إذا لم يكن لديك gSOAP ، فسيتم تخطي هذا المكون بصمت أثناء الإنشاء. - libvpx ، libopus
هذه هي برامج ترميز الفيديو والصوت المستخدمة لتسجيل شاشة VM. إذا لم يكن لديك هذه التطبيقات ، فسيظل التصميم ينتهي بنجاح ، وسيظل VB لديه كل خيارات التقاط الفيديو ، ولكن سيتم تجاهل هذه الخيارات (على الرغم من أنه سيتم تشغيل الرسوم المتحركة الملتقطة ، لن يتم حفظ أي تسجيل فعلي) . - سيغوين
مطلوب لبناء libvpx. - MiKTeX
يستخدم MiKTeX لتجميع وثائق PDF ( doc\UserManual.pdf
). بدون هذا البرنامج ، سيتم حذف ملف PDF بصمت من البناء والتعبئة. - NASM
المجمع يستخدم أثناء بناء OpenSSL. يمكنك إنشاؤها أيضًا دون استخدام المجمّع ، لكن ما زلت أوصي باستخدامها لإنشاء رمز أكثر تحسينًا.
فيما يلي ملخص لجميع الأدوات والمكتبات التي أستخدمها ، بما في ذلك الإصدارات الدقيقة (حيثما أمكن ذلك) ومسارات التثبيت التي اخترتها على نظام الإنشاء الخاص بي. يستخدم التعيين "
{x32|x64}
" لمواقع تثبيت الإصدار 32 و 64 بت منفصلة.
البرنامج / الأداة | نص | مسار التثبيت |
---|
استوديو مرئي | 2010 المهنية | C:\Program Files (x86)\Microsoft Visual Studio 10.0\ |
SDK | 7.1 | C:\Program Files\Microsoft SDKs\Windows\v7.1\ |
SDK | 8.1 | C:\Programs\DevKits\8.1\ |
WDK | 7.1.0 | C:\WinDDK\7600.16385.1\ |
ActivePerl | 5.26.1 بناء 2601 × 64 | C:\Programs\Perl\ |
ActivePython | 2.7.14.2717 x64 | C:\Programs\Python\ |
WIX | 3.11.1.2318 | C:\Programs\WiX\ |
كيو تي | 5.6.3 | C:\Programs\Qt\5.6.3-{x32|x64}\ |
مينغو-32 | 4.5.4 | C:\Programs\mingw32\ |
مينغو-64 | 4.5.4 | C:\Programs\mingw64\ |
سيغوين | - | C:\Programs\cygwin64\ |
SDL | 1.2.15 | C:\Programs\SDL\{x32|x64}\ |
الضفيرة | 7.64.1 | C:\Programs\curl\{x32|x64}\ |
بينسل | 1.1.1b | C:\Programs\OpenSSL\{x32|x64}\ |
gSOAP | 02/08/82 | C:\Programs\gSOAP\ |
libvpx | 1.7.0 | C:\Programs\libvpx\ |
libopus | 1.3 | C:\Programs\libopus\ |
MiKTeX المحمولة | 2.9.6942 | C:\Programs\MiKTeX\ |
NASM | 2.14.02 × 64 | C:\Programs\nasm\ |
DocBook XML DTD | 4.5 | C:\Programs\DocBook\xml\ |
أوراق أنماط XSL في DocBook | 1.69.1 | C:\Programs\DocBook\xsl\ |
المراوغات تثبيت التطبيقات
هنا أقدم بعض الإرشادات حول تثبيت بعض الأدوات المذكورة أعلاه حيث الإجراء غير واضح أو يتطلب إجراءات إضافية.
• ويندوز SDK v7.1
قد يفشل تثبيت SDK هذا لأنه يتضمن الإصدارات القديمة من مكتبات برنامج التحويل البرمجي ووقت التشغيل. بعد تثبيت VS 2010 ، هناك إصدارات أحدث من تلك الموجودة في النظام ، وبالتالي فإن الإصدارات القديمة تفشل في التثبيت ، ويعتبر المثبت الرئيسي أنه خطأ فادح. لحل هذه المشكلة ، تحتاج إلى إلغاء تحديد خانات الاختيار المقابلة ، أو قبل تثبيت SDK ، إلغاء تثبيت الحزم المسماة
"Microsoft Visual C ++ 2010 <arch> القابلة لإعادة التوزيع" ،
"Microsoft Visual C ++ 2010 <arch> Runtime" ،
"Microsoft المترجمون المرئيون C ++ ... " اسمح لـ SDK بتثبيت الإصدارات القديمة من تلك الإصدارات ، ثم قم بتشغيل Windows Update للحصول على أحدث الإصدارات المتاحة.
عند تثبيت SDK ، تأكد من التحقق من عينات البرنامج (تطوير رمز Windows الأصلي -> عينات): تحتوي على بعض البرامج النصية المستخدمة من قبل قواعد بناء VB. بدونها ، لن تكون قادرًا على إنشاء حزم MSI.
• ويندوز SDK v8.1
ما عليك سوى تثبيت المكون "Windows Software Development Kit".
• WDK v7.1
تحتاج فقط إلى تثبيت المكون "بناء البيئات".
• كيو تي 5.6.3
بدءًا من الإصدار QT 5.7.0 ، تحتاج إلى إنشاء برنامج Visual Studio 2012 أو إصدارًا أحدث لذلك ، لذلك نحن ملتزمون بـ 5.6.x.
نظرًا لعدم وجود تصميمات رسمية لبرنامج Visual Studio 2010 ، يتعين علينا إنشاء Qt من شفرة المصدر بأنفسنا.
- قم بفك أرشيف كود مصدر Qt في
C:\Programs\Qt\
ثم أعد تسمية الدليل qt-everywhere-opensource-src-5.6.3
إلى 5.6.3-src
. - بجانبه قم بإنشاء دليل
build-x32
حيث سيتم البناء. - افتح وحدة التحكم وقم بتشغيل الأوامر التالية لإعداد البيئة:
cd /d C:\Programs\Qt\build-x32 SET QTVER=5.6.3 "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /Release /x86 /win7 COLOR 07 SET QTDIR=C:\Programs\Qt\%QTVER%-x32 SET PATH=%QTDIR%\bin;%PATH% SET QMAKESPEC=win32-msvc2010
أمر color
اختياري ، فهو يتخلص من اللون الأخضر الذي تم تعيينه بواسطة البرنامج النصي SetEnv.Cmd
. - الآن نحن بحاجة إلى تشغيل البرنامج النصي
5.6.3-src
من 5.6.3-src
. لا يستخدم VB معظم ما يتضمنه Qt ، لذلك يمكننا تقليل وقت الإنشاء بشكل كبير عن طريق تعطيل المكونات المختلفة ، ولكن يرجى ملاحظة أن بعض الخيارات حاسمة بالنسبة لـ VB. على وجه الخصوص ، لقد اكتشفت أن:- برنامج OpenGL ES 2 غير مدعوم (عند إنشاء VB ، فشل المحول البرمجي في العثور على بعض ملفات الرأس).
- يجب تمكين دعم FreeType (وإلا لن يتم إنشاء البرنامج المساعد
qoffscreen
، وهو مطلوب من أجل VB).
هذا هو سطر الأوامر الكامل الذي انتهى بي: ..\5.6.3-src\configure.bat -prefix c:\Programs\Qt\5.6.3-x32 -mp -opensource -confirm-license -nomake tests -nomake examples -no-compile-examples -release -shared -pch -no-ltcg -accessibility -no-sql-sqlite -opengl desktop -no-openvg -no-nis -no-iconv -no-evdev -no-mtdev -no-inotify -no-eventfd -largefile -no-system-proxies -qt-zlib -qt-pcre -no-icu -qt-libpng -qt-libjpeg -qt-freetype -no-fontconfig -qt-harfbuzz -no-angle -incredibuild-xge -no-plugin-manifests -qmake -qreal double -rtti -strip -no-ssl -no-openssl -no-libproxy -no-dbus -no-audio-backend -no-wmf-backend -no-qml-debug -no-direct2d -directwrite -no-style-fusion -native-gestures -skip qt3d -skip qtactiveqt -skip qtandroidextras -skip qtcanvas3d -skip qtconnectivity -skip qtdeclarative -skip qtdoc -skip qtenginio -skip qtgraphicaleffects -skip qtlocation -skip qtmacextras -skip qtmultimedia -skip qtquickcontrols -skip qtquickcontrols2 -skip qtscript -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip qtx11extras -skip qtxmlpatterns
- مسار تثبيت Qt المحدد هنا (في الخيار
-prefix
) يتم -prefix
في ملفات التعليمات البرمجية المصدر المتوسطة بواسطة البرنامج النصي للتكوين ، لذلك ستتذكره الملفات الثنائية أيضًا. سيبحث أي تطبيق يستند إلى Qt تم إنشاؤه باستخدام هذه المكتبة عن المكونات الإضافية المطلوبة في هذا المسار أولاً ، وفقط إذا لم يتم العثور عليها ، فسيستخدم الموقع الحالي الخاص به. في معظم الحالات ، لا بأس بهذا ، لكن لنفترض على جهاز الكمبيوتر المثبت عليه برنامج VB ، أن هناك بنية أخرى لـ Qt موجودة في c:\Programs\Qt\5.6.3-x32
، لكن تم تجميعها بخيارات مختلفة أو عن طريق مترجم مختلف؟ ثم سيحاول VB تحميل هذه الإضافات (غير المتوافقة) وتعطلها.
هناك طريقتان ممكنتان لتجنب هذه المشكلة. أولاً ، يتم إضافة ملف إضافي يسمى qt.conf
إلى التثبيت بالنص التالي: [Paths] Plugins=.
والآخر هو إصلاح مسار التثبيت المحفوظ هذا قبل إنشاء Qt ، بحيث يشير إلى دليل التطبيق. قررت اتباع الطريقة الأخيرة ، لم أحب فكرة امتلاك ملفات إضافية لما كان لتوزيع Oracle VB. تحتاج إلى فتح الملف C:\Programs\Qt\build-x32\qtbase\src\corelib\global\qconfig.cpp
تم إنشاؤه بواسطة البرنامج النصي للتكوين ، ابحث عن السطر التالي: static const char qt_configure_prefix_path_str [512 + 12] = "qt_prfxpath=c:/Programs/Qt/5.6.3-x32";
واستبدل المسار بنقطة واحدة ، بحيث بدا هذا الخط كما يلي: static const char qt_configure_prefix_path_str [512 + 12] = "qt_prfxpath=.";
سيؤثر هذا التغيير فقط على سلوك وقت تشغيل VB. ستستخدم خطوة التثبيت الخاصة بـ Qt نفسها المسار الأصلي ، لأنه يتم تخزينه الآن في Makefiles والتي لا نقوم بتعديلها. - بعد ذلك ، قم بتشغيل
nmake
باستخدام الأمر nmake
- وتثبيت مكتبة بنيت باستخدام
nmake install
افتح الآن نافذة وحدة تحكم جديدة وافعل الشيء نفسه بالنسبة للإصدار 64 بت. ستحتاج إلى استبدال "x32" بـ "x64" في جميع المسارات ، وستظهر أوامر إعداد البيئة على النحو التالي:
md C:\Programs\Qt\build-x64 cd /d C:\Programs\Qt\build-x64 SET QTVER=5.6.3 "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /Release /x64 /win7 COLOR 07 SET QTDIR=C:\Programs\Qt\%QTVER%-x64 SET PATH=%QTDIR%\bin;%PATH% SET QMAKESPEC=win32-msvc2010
بعد الانتهاء من التثبيت ، يمكن حذف الدلائل
build-x32
و
build-x64
و
5.6.3-src
.
• MinGW
ببساطة فك حزم المحفوظات 32 و 64 بت في دلائل التثبيت الخاصة بكل منها.
• سيغوين
أثناء التثبيت ، تحتاج إلى اختيار الحزم التي
make
بها
yasm
.
• SDL
- قم بفك ضغط أرشيف SDL مرتين في مسارات منفصلة:
C:\Programs\SDL\x32\
و C:\Programs\SDL\x64\
. - نقل كافة محتويات الدليل الفرعي
C:\Programs\SDL\x64\lib\x64\
إلى الدليل الأصل (أي ، إلى C:\Programs\SDL\x64\lib\
) ، ثم احذف الدلائل الفرعية C:\Programs\SDL\x64\lib\x86
و x64
. - افعل الشيء نفسه بالنسبة للإصدار 32 بت: انقل المحتويات من
C:\Programs\SDL\x32\lib\x86\
إلى C:\Programs\SDL\x32\lib\
، ثم احذف C:\Programs\SDL\x64\lib\x86
و x64
.
• NASM
قم بفك
nasm-2.14.02-win64.zip
أرشيف
nasm-2.14.02-win64.zip
في
C:\Programs\
، ثم
nasm-2.14.02
تسمية الدليل الناتج
nasm-2.14.02
كـ
nasm
.
• OpenSSL
- قم بفك
C:\Programs\OpenSSL\
أرشيف OpenSSL في C:\Programs\OpenSSL\
مرتين ، وإعادة تسمية نسخ الدليل openssl-1.1.1b
كـ openssl-1.1.1b-x32
و openssl-1.1.1b-x64
. - افتح وحدة التحكم وقم بإنشاء وتثبيت الإصدار 32 بت عن طريق تشغيل:
"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /Release /x86 /win7 COLOR 07 set PATH=%PATH%;C:\Programs\nasm cd /d C:\Programs\OpenSSL\openssl-1.1.1b-x32\ perl Configure VC-WIN32 no-shared --prefix=C:\Programs\OpenSSL\x32 --openssldir=C:\Programs\OpenSSL\x32\ssl nmake nmake test nmake install
إذا أخرجت خطوة التهيئة تحذيرًا مخيفًا بشأن برنامج التحويل البرمجي المفقود ، فالرجاء ، تجاهل هذه الرسالة ، إنها تكذب بشدة.
إذا كنت لا ترغب في استخدام NASM ، فعليك فقط تخطي الأمر باستخدام تعديل PATH
، وبالنسبة للبرنامج النصي ، حدد المعلمة الإضافية no-asm
. - افتح الآن نافذة وحدة تحكم جديدة وافعل الشيء نفسه بالنسبة للإصدار 64 بت:
"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /Release /x64 /win7 COLOR 07 set PATH=%PATH%;C:\Programs\nasm cd /d C:\Programs\OpenSSL\openssl-1.1.1b-x64\ perl Configure VC-WIN64A no-shared --prefix=C:\Programs\OpenSSL\x64 --openssldir=C:\Programs\OpenSSL\x64\ssl nmake nmake test nmake install
تعطيل NASM هو نفسه كما في 32 بت. - الآن يمكنك حذف الدلائل
C:\Programs\OpenSSL\openssl-1.1.1b-x32
و openssl-1.1.1b-x64
.
• حليقة
- قم بفك
C:\Programs\curl\
أرشيف cURL في C:\Programs\curl\
وإعادة تسمية الدليل الفرعي الناتج curl-7.64.1
إلى curl-7.64.1-x32
. - افتح الملف
C:\Programs\curl\curl-7.64.1-x32\winbuild\MakefileBuild.vc
في محرر نصوص ، وابحث عن كتلة التعليمات البرمجية التالية (حول الأسطر No.61–69): !IF "$(VC)"=="6" CC_NODEBUG = $(CC) /O2 /DNDEBUG CC_DEBUG = $(CC) /Od /Gm /Zi /D_DEBUG /GZ CFLAGS = /I. /I../lib /I../include /nologo /W4 /wd4127 /GX /DWIN32 /YX /FD /c /DBUILDING_LIBCURL !ELSE CC_NODEBUG = $(CC) /O2 /DNDEBUG CC_DEBUG = $(CC) /Od /D_DEBUG /RTC1 /Z7 /LDd CFLAGS = /I. /I ../lib /I../include /nologo /W4 /wd4127 /EHsc /DWIN32 /FD /c /DBUILDING_LIBCURL !ENDIF
بعد هذه السطور ، أضف التوجيه الجديد: CFLAGS = $(CFLAGS) /DCURL_DISABLE_LDAP
إذا لم تقم بذلك ، فسوف تفشل بنية VB مع وجود أخطاء في الارتباط. - الآن افتح الملف
C:\Programs\curl\curl-7.64.1-x32\winbuild\gen_resp_file.bat
، وبعد السطر الأول ( @echo OFF
) ، أدخل هذا الأمر: cd .
لا يفعل أي شيء ، باستثناء إعادة تعيين رمز ERRORLEVEL
. البرنامج النصي بسيط جدًا بحيث يمكن إكماله دون تشغيل أي أمر من شأنه تغيير رمز الخطأ. لذلك إذا حدث أن هذا الرمز غير صفري قبل بدء البرنامج النصي ، فسوف يحتفظ بقيمته عند خروج البرنامج النصي ، ويعتقد nmake
أنه البرنامج النصي الذي قام بإرجاع رمز الخطأ هذا ، وإنهاء الإنشاء مع الفشل. مضيفا أن cd
وهمية cd
المشكلة. - اصنع الآن نسخة كاملة من
curl-7.64.1-x32
تحت اسم curl-7.64.1-x64
. - افتح وحدة التحكم ، وقم بإنشاء الإصدار 32 بت ونسخ الملفات التي نحتاجها:
"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /Release /x86 /win7 COLOR 07 cd /d C:\Programs\curl\curl-7.64.1-x32\winbuild md C:\Programs\curl\x32 nmake /f Makefile.vc mode=static WITH_SSL=static DEBUG=no MACHINE=x86 SSL_PATH=C:\Programs\OpenSSL\x32 ENABLE_SSPI=no ENABLE_WINSSL=no ENABLE_IDN=no copy ..\builds\libcurl-vc-x86-release-static-ssl-static-ipv6\lib\libcurl_a.lib ..\..\x32\libcurl.lib xcopy /E ..\builds\libcurl-vc-x86-release-static-ssl-static-ipv6\include\curl ..\..\x32\include\curl\
- افتح نافذة وحدة تحكم أخرى وقم بإنشاء إصدار 64 بت:
"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /Release /x64 /win7 COLOR 07 cd /d C:\Programs\curl\curl-7.64.1-x64\winbuild md C:\Programs\curl\x64 nmake /f Makefile.vc mode=static WITH_SSL=static DEBUG=no MACHINE=x64 SSL_PATH=C:\Programs\OpenSSL\x64 ENABLE_SSPI=no ENABLE_WINSSL=no ENABLE_IDN=no copy ..\builds\libcurl-vc-x64-release-static-ssl-static-ipv6\lib\libcurl_a.lib ..\..\x64\libcurl.lib xcopy /E ..\builds\libcurl-vc-x64-release-static-ssl-static-ipv6\include\curl ..\..\x64\include\curl\ copy ..\builds\libcurl-vc-x64-release-static-ssl-static-ipv6\bin\curl.exe ..\..\x64\curl.exe
لاحظ أنه بالإضافة إلى ما فعلناه للإصدار 32 بت ، هنا نقوم أيضًا بنسخ الملف curl.exe
. سنستخدمها لاحقًا لتنزيل صورة إضافات الضيف. - لم تعد هناك حاجة إلى الدلائل
C:\Programs\curl\curl-7.64.1-x32
و curl-7.64.1-x64
ويمكن إزالتها.
• libvpx
- قم بفك ضغط أرشيف libvpx في
C:\Programs\libvpx-build\
. - إطلاق محطة Cygwin ، سيتم تنفيذ البناء هناك. برنامجنا الأساسي هو Visual Studio 2010 ؛ يدعم نظام
msbuild.exe
ذلك جزئيًا فقط: سيحاول تشغيل msbuild.exe
الفعلي باستخدام msbuild.exe
ولكنه لا يعمل لسبب ما ؛ لقد فشلت في معرفة السبب. بدلاً من ذلك ، يمكننا ببساطة تشغيل Visual Studio نفسه واستخدامه لبناء المشروع. لحسن الحظ ، يمكن استخدامه من سطر الأوامر ، لذلك ليس من الضروري تشغيل IDE الفعلي (على الرغم من إمكانية ذلك إذا كنت ترغب في ذلك ، في هذه الحالة سيكون عليك تعديل متغير PATH
وإضافة المسار C:\Programs\cygwin64\bin
إليها ، أو بأي طريقة أخرى تسمح VS للعثور على yasm.exe
الموجود هناك والمطلوب للبناء). لذلك ، لأداء بنية كلا المعماريين ، قم بتشغيل الأوامر التالية في محطة Cygwin: mkdir -p /cygdrive/c/Programs/libvpx-build/build32 cd /cygdrive/c/Programs/libvpx-build/build32 ../libvpx-1.7.0/configure --target=x86-win32-vs10 --disable-install-bins --disable-examples --disable-tools --disable-docs --prefix=../../libvpx make "/cygdrive/c/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/devenv.com" vpx.sln /Project vpx.vcxproj /Rebuild "Release|Win32" make install mkdir -p /cygdrive/c/Programs/libvpx-build/build64 cd /cygdrive/c/Programs/libvpx-build/build64 ../libvpx-1.7.0/configure --target=x86_64-win64-vs10 --disable-install-bins --disable-examples --disable-tools --disable-docs --prefix=../../libvpx make "/cygdrive/c/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/devenv.com" vpx.sln /Project vpx.vcxproj /Rebuild "Release|x64" make install
- أغلق Cygwin ، لن نحتاج إليها بعد الآن. يمكن إزالة الدليل
C:\Programs\libvpx-build
.
• libopus
- قم بفك أرشيف opus في
C:\Programs\libopus-build\
، انتقل إلى الدليل الفرعي opus-1.3\win32\VS2015
. - تم تصميم هذا المشروع لإصدار Visual Studio الأحدث ، لذلك نحن بحاجة إلى تعديله لجعله بناء في الإصدار لدينا 2010. يمكنك القيام بذلك إما باستخدام IDE ، أو محرر نص عادي. اخترت هذا الأخير. افتح الملف
opus.vcxproj
وقم بما يلي:- العثور على جميع الخطوط التي تحتوي على النص
<PlatformToolset>v140</PlatformToolset>
واستبدال v140
مع v100
. إذا كنت تستخدم IDE ، فهذا هو خيار التكوين "Platrofm Toolset" الموجود في صفحة خصائص التكوين -> عام. لا تنسى محددات التكوين والنظام الأساسي في أعلى مربع الحوار. - بعد ذلك ، ابحث عن مجموعة التعليمات البرمجية هذه:
<ItemDefinitionGroup> <ClCompile>
وأضف علامة جديدة بداخله: <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
في IDE يمكنك القيام بذلك عن طريق فتح صفحة خصائص التكوين -> C / C ++ -> عام وتعيين "Debug Information Format" في "ProgramDatabase (/ Zi)". في الواقع ، يمكنك تعيينها على أي قيمة صالحة أخرى ، لسنا بحاجة إلى قاعدة بيانات تصحيح الأخطاء على الإطلاق ، ولكن مع وجود قيمة غير صالحة سيفشل المشروع في الإنشاء.
- الآن لنقم بإنشاء إصدار الإصدار لكلا
opus.lib
(باستخدام إما VS IDE أو سطر الأوامر) ونسخ مكتبة opus.lib
الفرعي include\
في مسار وجهتنا: cd /d C:\Programs\libopus-build\opus-1.3\win32\VS2015 md C:\Programs\libopus\lib\x64 md C:\Programs\libopus\lib\Win32 xcopy /EC:\Programs\libopus-build\opus-1.3\include C:\Programs\libopus\include\ "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.com" opus.sln /Project opus.vcxproj /Rebuild "Release|x64" copy x64\Release\opus.lib C:\Programs\libopus\lib\x64\ "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.com" opus.sln /Project opus.vcxproj /Rebuild "Release|Win32" copy Win32\Release\opus.lib C:\Programs\libopus\lib\Win32\
- يمكن إزالة الدليل
C:\Programs\libopus-build
.
• gSOAP
افتح الأرشيف ،
gsoap-2.8\gsoap
إلى الدليل الفرعي
gsoap-2.8\gsoap
وفك محتوياته في
C:\Programs\gSOAP\
. يتطلب OpenSSL 1.1.x إصدار gSOAP 2.8.41 أو أعلى. إذا كنت ترغب في استخدام إصدار أقدم لسبب ما ، فستحتاج إلى تطبيق
التصحيح الذي أنشأته
Mattias Ellert . يمكن تنفيذ التصحيح إما يدويًا (التنسيق سهل: افتح الملفات المذكورة ، أو احذف الأسطر التي تحمل علامة ناقص ، أو أضف أسطرًا عليها علامة زائد ؛ والباقي هو السياق) ، أو احصل على أداة
patch
المنقولة لنظام Windows واستخدمها.
• ميكتكس
- فك الأرشيف في
C:\Programs\MiKTeX\
. - افتح وحدة التحكم وتثبيت وحدات إضافية:
"C:\Programs\MiKTeX\texmfs\install\miktex\bin\mpm.exe" --verbose --install=koma-script --install=ucs --install=tabulary --install=url --install=fancybox --install=fancyvrb --install=bera --install=charter --install=mptopdf
• DocBook
بالنسبة إلى XML DTD ، تحتاج إلى إنشاء دليل وفك محتويات الأرشيف هناك. بالنسبة إلى XSL Stylesheets ، كل المحتويات موجودة بالفعل في دليل واحد ، لذلك تحتاج إلى استخراج ذلك وإعادة تسميته بعد ذلك.
اللمسات النهائية
بيئة البناء جاهزة تقريبًا ، وهناك حاجة إلى بضع خطوات أخرى. قم بتنزيل أرشيف شفرة مصدر VirtualBox (إذا لم تقم بذلك بعد) وقم بفك ضغطه إلى المكان الذي تريد العمل فيه. لقد اخترت
C:\Devel\
لهذا الغرض ، وضعت هناك رموز المصدر غير المعبأة وأعدت تسمية الدليل الفرعي إلى
VirtualBox-src
.
• إضافة شهادات
إذا لم يكن لديك شهادة مدفوعة ، فإنني أوصيك على الأقل بإنشاء شهادة شخصية موقعة ذاتياً: من الأسهل تحميل Windows برامج تشغيل موقعة ذاتياً بدلاً من تلك الموقعة. للقيام بذلك ، افتح وحدة التحكم بامتيازات مرتفعة ، وقم بتشغيل الأوامر التالية التي ستضيف شهادتين (SHA-1 و SHA-256) واستوردهما في وحدة التخزين الشخصية الخاصة بك:
"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /Release /x64 /win7 COLOR 07 makecert.exe -a sha1 -r -pe -ss my -n "CN=Roga and Kopyta Ltd" C:\Devel\testcert_1.cer makecert.exe -a sha256 -r -pe -ss my -n "CN=Roga and Kopyta Ltd" C:\Devel\testcert_256.cer certmgr.exe -add C:\Devel\testcert_1.cer -s -r localMachine root certmgr.exe -add C:\Devel\testcert_256.cer -s -r localMachine root
يمكنك بالطبع اختيار اسمك للشهادات بدلاً من "Roga and Kopyta Ltd" ، ومسار لتخزين الملفات. الآن نحن بحاجة إلى الحصول على بصمات الأصابع للشهادات التي تم إنشاؤها. افتح وحدة التحكم في إدارة الشهادات (عن طريق تشغيل
certmgr.msc
) وانتقل إلى التخزين الشخصي. سترى الشهادتين الجديدتين المسمى "Roga and Kopyta Ltd" هناك. انقر نقرا مزدوجا فوق أول واحد. في مربع الحوار الذي يظهر ، انتقل إلى علامة التبويب "
تفاصيل" . يحتوي حقل "خوارزمية التوقيع" على اسم الخوارزمية: sha256RSA أو sha1RSA. قم بالتمرير لأسفل للحصول على حقل "بصمة الإبهام" الذي يحتوي على تسلسل الأرقام السداسية عشرية. انسخ هذه القيمة الكاملة واكتبها في مكان ما. تفعل الشيء نفسه بالنسبة للشهادة الثانية ؛ لا تنس أن تضع علامة بصمة الإبهام على SHA-1 ، وأيضًا SHA-256.
• بناء xmllint
ستحتاج إحدى خطوات
xmllint
برنامج
xmllint
. لم أضعها في قائمة متطلبات الإنشاء لأن مصادرها مضمنة في أرشيف VirtualBox. ولكن لا يزال يتعين عليك بناء ذلك بنفسك ، لأن قواعد إنشاء VB لا تفعل ذلك. اخترت
C:\Programs\xmllint
كدليل الوجهة.
- انسخ الدليل
C:\Devel\VirtualBox-src\src\libs\libxml2-2.9.4
إلى C:\Programs\
للتأكد من أن C:\Devel\VirtualBox-src\src\libs\libxml2-2.9.4
الخاصة به لا تؤثر على VB بأي طريقة. - افتح وحدة التحكم وقم بتشغيل الأوامر التالية:
"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /Release /x64 /win7 COLOR 07 cd /d C:\Programs\libxml2-2.9.4\win32 cscript.exe configure.js cruntime=/MT prefix=C:\Programs\xmllint iconv=no nmake /f Makefile.msvc nmake /f Makefile.msvc install
- قم بإزالة الدليل
C:\Programs\libxml2-2.9.4
.
• تعديلات على ملفات VB
قبل بدء الإنشاء ، نحتاج أيضًا إلى إدخال بعض التغييرات في شفرة مصدر VB. يتم تقديم المجموعة الكاملة منها هنا كملف تصحيح يمكن تنزيله يمكن تطبيقه إما يدويًا أو باستخدام أداة
patch
(التي تحتاج إلى تنزيلها بشكل منفصل):
»
Vbox_build.patchإذا لم تكن هناك مشاكل في تطبيق التصحيح ، يمكنك الانتقال إلى
الخطوة التالية . ومع ذلك ، إذا كانت لديك بعض المشكلات وتحتاج إلى مزيد من المعلومات حول تغييرات معينة ، أو إذا كنت تريد فقط فهم ما الذي تم تغييره ولماذا ، فنحن نرحب بك للمتابعة وقراءة التفاصيل الواردة أدناه. يرجى ملاحظة أن التغييرات تأتي هنا بترتيب مختلف مقارنة بملف التصحيح. يتم تحديد المسارات إلى الملفات نسبة إلى دليل التعليمات البرمجية المصدر VB
C:\Devel\VirtualBox-src
.
- ملف
configure.vbs
:- سطر الكود:
if Shell(DosSlashes(strPathVC & "/bin/cl.exe"), True) <> 0 then
يتم استبدال بـ: if Shell(DosSlashes(strPathVC & "/bin/cl.exe") & " /?", True) <> 0 then
ينفذ هذا السطر عملية التحقق من المحول البرمجي ولكنه ينسى أن cl.exe
بدون أي وسيطات يُرجع خطأً ، وبالتالي يعتبر مترجمًا غير صالح. مضيفا " /?
"تجعل الوسيطة إخراج التعليمات والخروج برمز غير خطأ 0. - الآن دعنا
CheckForMinGW32Sub
إلى وظيفة CheckForMinGW32Sub
. كما يقول الاسم ، فإنه يتحقق من صحة MinGW 32 بت. ومع ذلك ، فقد تم تصميمه للإصدار 3.3.3 ، بينما أستخدم 4.5.4 الذي له هيكل ملف / دليل مختلف ، لذلك قمت باستبدال الوظيفة بأكملها بالكود التالي (والذي هو في الأساس مجرد نسخة من CheckForMinGWw64Sub
مقتبسة من أجل البديل 32 بت): function CheckForMinGW32Sub(strPathMingW32, strPathW32API) g_strSubOutput = "" if strPathW32API = "" then strPathW32API = strPathMingW32 LogPrint "trying: strPathMingW32=" &strPathMingW32 & " strPathW32API=" & strPathW32API if LogFileExists(strPathMingW32, "bin/gcc.exe") _ And LogFileExists(strPathMingW32, "bin/ld.exe") _ And LogFileExists(strPathMingW32, "bin/objdump.exe") _ And LogFileExists(strPathMingW32, "bin/dllwrap.exe") _ And LogFileExists(strPathMingW32, "bin/dlltool.exe") _ And LogFileExists(strPathMingW32, "bin/as.exe") _ And LogFileExists(strPathMingW32, "include/bfd.h") _ And LogFileExists(strPathMingW32, "lib32/libgcc_s.a") _ And LogFileExists(strPathMingW32, "i686-w64-mingw32/lib/dllcrt1.o") _ And LogFileExists(strPathMingW32, "i686-w64-mingw32/lib/dllcrt2.o") _ And LogFileExists(strPathMingW32, "i686-w64-mingw32/lib/libmsvcrt.a") _ And LogFileExists(strPathMingW32, "i686-w64-mingw32/lib/libmsvcr100.a") _ And LogFileExists(strPathMingW32, "i686-w64-mingw32/include/_mingw.h") _ And LogFileExists(strPathMingW32, "i686-w64-mingw32/include/stdint.h") _ And LogFileExists(strPathMingW32, "i686-w64-mingw32/include/windows.h") _ then if Shell(DosSlashes(strPathMingW32 & "/bin/gcc.exe") & " -dumpversion", True) = 0 then dim offVer, iMajor, iMinor, iPatch, strVer
CheckForCurlSub
التالية هي CheckForCurlSub
، CheckForCurlSub
الشفرة المراد تحريرها هو: if LogFileExists(strPathCurl, "include/curl/curl.h") _ And LogFindFile(strPathCurl, "libcurl.dll") <> "" _ And LogFindFile(strPathCurl, "libcurl.lib") <> "" _
إنه يتحقق من صحة libcurl ، لكنه يتطلب إصدار مرتبط ديناميكيًا وفشل في حالة تعذر العثور على ملف DLL. نحن نستخدم إصدارًا ثابتًا بشكل ثابت ، لذلك يجب أن يتحقق التحقق من وجود DLL بشكل مؤسف ويترك لنا: if LogFileExists(strPathCurl, "include/curl/curl.h") _ And LogFindFile(strPathCurl, "libcurl.lib") <> "" _
- انتقل الآن إلى الدالة
CheckForPython
حيث يتم إنشاء المتغير VBOX_BLD_PYTHON
: CfgPrint "VBOX_BLD_PYTHON := " & strPathPython & "\python.exe"
يجب استبدال python.exe
المائل العكسي أمام python.exe
الأمامي: "/python.exe"
(بدون هذا الإصلاح ، ستفشل بعض عمليات التدقيق أثناء إجراء "/python.exe"
؛ لم ألاحظ أي تأثيرات ضارة أخرى ، ولكنها أجمل دون رسائل الفشل ، وعلى أي حال أفضل آمنة من آسف). - لا يدعم إصدار Windows من البرنامج النصي للتكوين libvpx و libopus ، لذلك أضفتهم بنفسي. بالطبع ، كانت أبسط طريقة فقط هي تحويل مسارات الأقراص الصلبة إلى المكتبات ، لكنني فضلت تنفيذها تمامًا مثل باقي المكونات ، مع تمرير المسار في سطر الأوامر ، وإجراء اختبارات الصلاحية الصحيحة. يتكون الكود الرئيسي لهذا من وظيفتي الشيك:
يستخدم usage
الوظيفة لطباعة قائمة وسائط سطر الأوامر ؛ إلحاق حججينا جديدة هناك: Print " --with-libvpx=PATH " Print " --with-libopus=PATH "
في بداية الوظيفة يتم تحديد العديد من المتغيرات Main
لتخزين مسارات للمكونات ، نحتاج إلى إضافة اثنين جديدين هناك: strOptVpx = "" strOptOpus = ""
المزيد قليلاً من الأسفل يذهب كتلة select-case
التي تعالج الوسيطات وتعبئتها في المتغيرات ؛ مضيفا مساهمتنا: case "--with-libvpx" strOptVpx = strPath case "--with-libopus" strOptOpus = strPath
وأخيرًا ، في نهاية الملف تقريبًا ، توجد سلسلة من جميع استدعاءات وظائف الشيك ، حيث نضيف استدعاء وظيفتين جديدتين: CheckForVpx strOptVpx CheckForOpus strOptOpus
- الملف التالي هو
src\VBox\Runtime\Makefile.kmk
. نحتاج إلى العثور على تعريفات المتغيرات VBoxRT_LIBS.win
و VBoxRT-x86_LIBS.win
، وإضافة مكتبتين جديدتين إليها ، crypt32.lib
و bcrypt.lib
. لذلك الكود التالي: VBoxRT_LIBS.win = \ $(PATH_SDK_$(VBOX_WINDDK)_LIB)/vccomsup.lib \ $(PATH_SDK_$(VBOX_WINDDK)_LIB)/wbemuuid.lib \ $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/delayimp.lib
يتحول إلى: VBoxRT_LIBS.win = \ $(PATH_SDK_$(VBOX_WINDDK)_LIB)/vccomsup.lib \ $(PATH_SDK_$(VBOX_WINDDK)_LIB)/wbemuuid.lib \ $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/delayimp.lib \ $(PATH_SDK_$(VBOX_WINPSDK)_LIB)/crypt32.lib \ $(PATH_SDK_$(VBOX_WINPSDK)_LIB)/bcrypt.lib
(لا تفوت شرطة مائلة للخلف زائدة بعد delayimp.lib
!) ؛ و ، على التوالي ، هذه الكتلة: VBoxRT-x86_LIBS.win = \ $(PATH_SDK_$(VBOX_WINDDK)_LIB.x86)/vccomsup.lib \ $(PATH_SDK_$(VBOX_WINDDK)_LIB.x86)/wbemuuid.lib \ $(PATH_TOOL_$(VBOX_VCC_TOOL_STEM)X86_LIB)/delayimp.lib
يصبح: VBoxRT-x86_LIBS.win = \ $(PATH_SDK_$(VBOX_WINDDK)_LIB.x86)/vccomsup.lib \ $(PATH_SDK_$(VBOX_WINDDK)_LIB.x86)/wbemuuid.lib \ $(PATH_TOOL_$(VBOX_VCC_TOOL_STEM)X86_LIB)/delayimp.lib \ $(PATH_SDK_$(VBOX_WINPSDK)_LIB.x86)/crypt32.lib \ $(PATH_SDK_$(VBOX_WINPSDK)_LIB.x86)/bcrypt.lib
هذا التغيير مطلوب من أجل الربط الناجح لـ VBoxRT.dll
. لست متأكدًا تمامًا من السبب وراء ذلك ، لا يحتوي إصدار Oracle على وقت التحميل على crypt32.dll
، حيث يتم تحميله في وقت التشغيل ، لذلك لا ينبغي أن يكون ملف LIB مطلوبًا. ومع ذلك بدونه لا يمكن للرابط العثور على بعض الوظائف والفشل. أظن أنه قد يكون مرتبطًا بخيارات إنشاء OpenSSL ، لكنني لم أختبر ذلك ، مضيفًا أن التبعية أسهل. والاعتماد الثاني ، bcrypt.dll
، هو شرط OpenSSL 1.1.1 الجديد. - إذا كان لديك gSOAP من الإصدار 2.8.79 أو أعلى ، فسيتعين عليك تحرير الملف
src\VBox\Runtime\r3\win\VBoxRT-openssl-1.1plus.def
وإضافة الأسطر التالية إلى قائمة الصادرات: OpenSSL_version_num DH_generate_parameters_ex DH_new ASN1_STRING_get0_data
تحدد هذه القائمة الوظائف التي يتم تصديرها بواسطة المكتبة VBoxRT.dll
(التي تحتوي على OpenSSL من الداخل). عندما يتم ربط أداة VBoxWebSrv.exe
، وفقًا لإصدار gSOAP ، فقد تتطلب وظائف OpenSSL إضافية. نظرًا لأنها مفقودة في قائمة الصادرات ، يضيف رابط OpenSSL نفسه ويشكو على الفور من الكثير من التعارضات بين OpenSSL الخارجي VBoxRT
الخاصة المضمنة بالفعل في VBoxRT
. إضافة الصادرات المذكورة أعلاه يعمل على حل المشكلة. - كما ذكرت في البداية ، لا أقوم بإعداد إضافات الضيف ، لكنني بحاجة إلى الحصول على صورة ISO كجزء من التوزيع. تم تصميم قواعد الإنشاء لهذا السيناريو ، لكنهم يتوقعون أن تظهر صورة ISO الجاهزة في المكان المناسب في الوقت المناسب. لقد أضفت هذا السحر إلى ملف
src\VBox\Makefile.kmk
. ابحث عن الكود التالي: ifdef VBOX_WITH_ADDITIONS include $(PATH_SUB_CURRENT)/Additions/Makefile.kmk endif
وأدناه يذهب للتنزيل التلقائي لملف الصور: ifndef VBOX_WITHOUT_ADDITIONS_ISO $(VBOX_PATH_ADDITIONS_ISO)/VBoxGuestAdditions.iso: $(QUIET)$(MKDIR) -p $(@D) $(VBOX_RETRY) $(TOOL_CURL_FETCH) http://download.virtualbox.org/virtualbox/$(VBOX_VERSION_STRING_RAW)/VBoxGuestAdditions_$(VBOX_VERSION_STRING_RAW).iso -o $@ endif
إذا قمت بتحرير الملفات يدويًا بدلاً من تطبيق التصحيح ، يرجى ملاحظة أن أوامر القاعدة يجب أن تبدأ بحرف الجدولة. - قبل الإصدار 6.0 ، كانت الوثائق واحدة من النظم الفرعية التي بنيت بنجاح دون أي تغييرات. لا أعرف ما هو الخطأ في ذلك ، ولكن تمت إعادة تصميمه بشكل كبير بحيث لم يعد يعمل على نظام الإنشاء الخاص بي. ليس لدي أي فكرة عن كيفية قيام Oracle أنفسهم ببناء الوثائق (ربما على نظام * NIX) ، ولكن بالنسبة لي بقيت قواعد الإنشاء تفقد علامات مائلة في المسارات ، أو إضافة فائض منها ، ونتيجة لذلك فشلوا في العثور على الملفات المستهدفة بسبب عدم التطابق في ملفات الكتالوج. تمكنت أخيرًا من الجمع بين بعض التغييرات التي سمحت بإنشاء الوثائق دون أخطاء. بادئ ذي بدء ، كان أحد الدلائل المستهدفة مفقودًا ، لذا تعذر إنشاء بعض الملفات الوسيطة. تم إصلاح هذه المشكلة في ملف
doc\manual\Makefile.kmk
، داخل كتلة التعليمات البرمجية التالية: define def_vbox_refentry_to_user_sect1 $$(VBOX_PATH_MANUAL_OUTBASE)/$(1)/user_$(2): $(3) \ $$(VBOX_PATH_MANUAL_SRC)/docbook-refentry-to-manual-sect1.xsl \ $$(VBOX_XML_CATALOG) $$(VBOX_XML_CATALOG_DOCBOOK) $$(VBOX_XML_CATALOG_MANUAL) \ $$(VBOX_VERSION_STAMP) | $$(dir $$@) $$(call MSG_TOOL,xsltproc $$(notdir $$(filter %.xsl,$$^)),,$$(filter %.xml,$$^),$$@) $$(QUIET)$$(RM) -f "$$@" $$(QUIET)$$(call VBOX_XSLTPROC_WITH_CAT) --output $$@ $$(VBOX_PATH_MANUAL_SRC)/docbook-refentry-to-manual-sect1.xsl $$< endef
مباشرة بعد $$(RM)
أضفت أمرًا لإنشاء الدليل المفقود: $$(QUIET)$$(MKDIR) -p "$$(@D)"
بالنسبة للشرطة المائلة ، توجد الإصلاحات في ملف doc\manual\Config.kmk
. لم أتمكن من إيجاد حل "طبيعي" لذلك ، ولكن هناك حل جيد بما فيه الكفاية لأغراض عملية ، مما يعني تكرار قواعد استبدال المسار للمسارات غير الصحيحة. أولاً ، أسفل الخط: VBOX_FILE_URL_MAYBE_SLASH = $(if $(eq $(KBUILD_HOST),win),/,)
I've created two new variables which basically contain the same paths as their origins, but with triple slash after the disk letter instead of a single slash: VBOX_PATH_MANUAL_SRC_SLASHED = $(subst :/,:///,$(VBOX_PATH_MANUAL_SRC)) VBOX_PATH_MANUAL_OUTBASE_SLASHED = $(subst :/,:///,$(VBOX_PATH_MANUAL_OUTBASE))
A little bit below that, there is a rule for creating the catalog file: $(VBOX_XML_CATALOG): $(MAKEFILE_CURRENT) | $$(dir $$@) $(call MSG_L1,Creating catalog $@) $(QUIET)$(APPEND) -tn "$@" \ '<?xml version="1.0"?>' \ '<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">' \ '<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">' \ ' <delegatePublic publicIdStartString="-//OASIS/ENTITIES DocBook XML" catalog="file://$(VBOX_FILE_URL_MAYBE_SLASH)$(VBOX_XML_CATALOG_DOCBOOK)"/>' \ ' <delegatePublic publicIdStartString="-//OASIS/DTD DocBook XML" catalog="file://$(VBOX_FILE_URL_MAYBE_SLASH)$(VBOX_XML_CATALOG_DOCBOOK)"/>' \ ' <delegateSystem systemIdStartString="http://www.oasis-open.org/docbook/" catalog="file://$(VBOX_FILE_URL_MAYBE_SLASH)$(VBOX_XML_CATALOG_DOCBOOK)"/>' \ ' <delegateURI uriStartString="http://www.oasis-open.org/docbook/" catalog="file://$(VBOX_FILE_URL_MAYBE_SLASH)$(VBOX_XML_CATALOG_DOCBOOK)"/>' \ ' <delegateSystem systemIdStartString="$(VBOX_PATH_MANUAL_SRC)" catalog="file://$(VBOX_FILE_URL_MAYBE_SLASH)$(VBOX_XML_CATALOG_MANUAL)"/>' \ ' <delegateURI uriStartString="$(VBOX_PATH_MANUAL_SRC)" catalog="file://$(VBOX_FILE_URL_MAYBE_SLASH)$(VBOX_XML_CATALOG_MANUAL)"/>' \ ' <delegateURI uriStartString="file://$(VBOX_FILE_URL_MAYBE_SLASH)$(VBOX_PATH_MANUAL_SRC)" catalog="file://$(VBOX_FILE_URL_MAYBE_SLASH)$(VBOX_XML_CATALOG_MANUAL)"/>' \ ' <delegateURI uriStartString="$(VBOX_PATH_MANUAL_OUTBASE)" catalog="file://$(VBOX_FILE_URL_MAYBE_SLASH)$(VBOX_XML_CATALOG_MANUAL)"/>' \ '</catalog>'
For each line which contains the variable VBOX_PATH_MANUAL_SRC
or VBOX_PATH_MANUAL_OUTBASE
(except for the line with the file://
prefix), I've appended the copy of the whole line, but with the variable replaced with its triple-slash counterpart. The result looks like this: $(VBOX_XML_CATALOG): $(MAKEFILE_CURRENT) | $$(dir $$@) $(call MSG_L1,Creating catalog $@) $(QUIET)$(APPEND) -tn "$@" \ '<?xml version="1.0"?>' \ '<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">' \ '<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">' \ ' <delegatePublic publicIdStartString="-//OASIS/ENTITIES DocBook XML" catalog="file://$(VBOX_FILE_URL_MAYBE_SLASH)$(VBOX_XML_CATALOG_DOCBOOK)"/>' \ ' <delegatePublic publicIdStartString="-//OASIS/DTD DocBook XML" catalog="file://$(VBOX_FILE_URL_MAYBE_SLASH)$(VBOX_XML_CATALOG_DOCBOOK)"/>' \ ' <delegateSystem systemIdStartString="http://www.oasis-open.org/docbook/" catalog="file://$(VBOX_FILE_URL_MAYBE_SLASH)$(VBOX_XML_CATALOG_DOCBOOK)"/>' \ ' <delegateURI uriStartString="http://www.oasis-open.org/docbook/" catalog="file://$(VBOX_FILE_URL_MAYBE_SLASH)$(VBOX_XML_CATALOG_DOCBOOK)"/>' \ ' <delegateSystem systemIdStartString="$(VBOX_PATH_MANUAL_SRC)" catalog="file://$(VBOX_FILE_URL_MAYBE_SLASH)$(VBOX_XML_CATALOG_MANUAL)"/>' \ ' <delegateSystem systemIdStartString="$(VBOX_PATH_MANUAL_SRC_SLASHED)" catalog="file://$(VBOX_FILE_URL_MAYBE_SLASH)$(VBOX_XML_CATALOG_MANUAL)"/>' \ ' <delegateURI uriStartString="$(VBOX_PATH_MANUAL_SRC)" catalog="file://$(VBOX_FILE_URL_MAYBE_SLASH)$(VBOX_XML_CATALOG_MANUAL)"/>' \ ' <delegateURI uriStartString="$(VBOX_PATH_MANUAL_SRC_SLASHED)" catalog="file://$(VBOX_FILE_URL_MAYBE_SLASH)$(VBOX_XML_CATALOG_MANUAL)"/>' \ ' <delegateURI uriStartString="file://$(VBOX_FILE_URL_MAYBE_SLASH)$(VBOX_PATH_MANUAL_SRC)" catalog="file://$(VBOX_FILE_URL_MAYBE_SLASH)$(VBOX_XML_CATALOG_MANUAL)"/>' \ ' <delegateURI uriStartString="$(VBOX_PATH_MANUAL_OUTBASE)" catalog="file://$(VBOX_FILE_URL_MAYBE_SLASH)$(VBOX_XML_CATALOG_MANUAL)"/>' \ ' <delegateURI uriStartString="$(VBOX_PATH_MANUAL_OUTBASE_SLASHED)" catalog="file://$(VBOX_FILE_URL_MAYBE_SLASH)$(VBOX_XML_CATALOG_MANUAL)"/>' \ '</catalog>'
Even further down, there is another rule for creating an auxiliary catalog file; the starting line is: $(VBOX_XML_CATALOG_MANUAL): $(MAKEFILE_CURRENT) | $$(dir $$@)
Here I'm doing the same operation as above. In addition, in the beginning of the generated file there are several lines defining the entries in the common/
subdirectory: ' <system systemId="$(VBOX_PATH_MANUAL_SRC)/common/oracle-accessibility-en.xml" uri="file://$(VBOX_FILE_URL_MAYBE_SLASH)$(VBOX_PATH_MANUAL_SRC)/en_US/oracle-accessibility-en.xml"/>' \ ' <system systemId="$(VBOX_PATH_MANUAL_SRC)/common/oracle-support-en.xml" uri="file://$(VBOX_FILE_URL_MAYBE_SLASH)$(VBOX_PATH_MANUAL_SRC)/en_US/oracle-support-en.xml"/>' \
With these we have the opposite problem: triple slash after the file
is replaced with a single slash. I worked this around by getting rid of the file
protocol altogether and replacing those URIs with direct file system paths in the target address (the uri
attribute). The result for these lines looks like this (including the aforementioned fix): ' <system systemId="$(VBOX_PATH_MANUAL_SRC)/common/oracle-accessibility-en.xml" uri="$(VBOX_PATH_MANUAL_SRC)/en_US/oracle-accessibility-en.xml"/>' \ ' <system systemId="$(VBOX_PATH_MANUAL_SRC_SLASHED)/common/oracle-accessibility-en.xml" uri="$(VBOX_PATH_MANUAL_SRC)/en_US/oracle-accessibility-en.xml"/>' \ ' <system systemId="$(VBOX_PATH_MANUAL_SRC)/common/oracle-support-en.xml" uri="$(VBOX_PATH_MANUAL_SRC)/en_US/oracle-support-en.xml"/>' \ ' <system systemId="$(VBOX_PATH_MANUAL_SRC_SLASHED)/common/oracle-support-en.xml" uri="$(VBOX_PATH_MANUAL_SRC)/en_US/oracle-support-en.xml"/>' \
- When VB is built with signing, most of its binaries receive the integrity check flag (the linker option
/IntegrityCheck
) which forces Windows to check digital signatures and forbids launching applications which are signed incorrectly. If you have a valid paid certificate that's not a problem; however with a self-signed certificate VB will refuse to start, even if Windows is booted in the test mode. I've modified the file Config.kmk
in such a way that this flag is only added when you have a full-grown certificate (the criterion of that is presence of a cross-certificate in LocalConfig.kmk
; see below ). The changes look like this:- A new variable
VBOX_INTEGRITY_CHECK
is added, which contains the desired value of the option: if defined(VBOX_SIGNING_MODE) && defined(VBOX_CROSS_CERTIFICATE_FILE) VBOX_INTEGRITY_CHECK := /IntegrityCheck else VBOX_INTEGRITY_CHECK := /IntegrityCheck:NO endif
- Below that there is the
editbin
call: $(VBOX_VCC_EDITBIN) /LargeAddressAware /DynamicBase /NxCompat /Release /IntegrityCheck \ /Version:$(VBOX_VERSION_MAJOR)0$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \ "$@"
Here I've replaced the unconditional /IntegrityCheck
with the new variable $(VBOX_INTEGRITY_CHECK)
. - Next, look for the blocks of the following kinds:
ifdef VBOX_SIGNING_MODE TEMPLATE_XXXXXX_LDFLAGS += -IntegrityCheck endif
or if defined(VBOX_SIGNING_MODE) && defined(VBOX_WITH_HARDENING) TEMPLATE_XXXXXX_LDFLAGS += -IntegrityCheck endif
where « XXXXXX
» stands for various component names. There are 6 such blocks in total, 3 of each kind. Here I've modified the condition by adding a check for cross-certificate. The first line then turns into, respectively: if defined(VBOX_SIGNING_MODE) && defined(VBOX_CROSS_CERTIFICATE_FILE)
or if defined(VBOX_SIGNING_MODE) && defined(VBOX_CROSS_CERTIFICATE_FILE) && defined(VBOX_WITH_HARDENING)
- Two more files modified by me do not take immediate part in building of VB:
src\VBox\Installer\win\Scripts\PackDriversForSubmission.cmd
and UnpackBlessedDrivers.cmd
. These auxiliary scripts can be used if you intend to send the drivers into Microsoft for Windows 10 signing. The first script prepares a CAB archive for sending; the second one unpacks the resultant ZIP archive with the signed drivers and verifies the signatures. In the packing script all I did was just fixing several typos. In the unpacking script I added ability to specify path to the signtool
program, and got rid of the unzip
tool by replacing it with a small Perl script. The signing procedure is described below. If you don't plan to get the Microsoft signature you can simply ignore all these changes in the scripts.
• VB build configuration file
Now we need to create the file
LocalConfig.kmk
in the VB sources directory, and write there all the paths and build parameters. You can use the following text as a template:
VBOX_WITH_HARDENING := VBOX_PATH_WIX := C:\Programs\WiX VBOX_GSOAP_INSTALLED := 1 VBOX_PATH_GSOAP := C:\Programs\gSOAP VBOX_WITH_COMBINED_PACKAGE := 1 VBOX_WITH_QT_PAYLOAD := 1 VBOX_WITH_QTGUI_V5 := 1 VBOX_SIGNING_MODE := release VBOX_CERTIFICATE_SUBJECT_NAME := Roga and Kopyta Ltd VBOX_CERTIFICATE_FINGERPRINT := XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX VBOX_CERTIFICATE_SHA2_SUBJECT_NAME := Roga and Kopyta Ltd VBOX_CERTIFICATE_SHA2_FINGERPRINT := XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX VBOX_TSA_URL := http://timestamp.digicert.com VBOX_TSA_SHA2_URL := http://timestamp.digicert.com VBOX_TSA_URL_ARGS := /t "$(VBOX_TSA_URL)" VBOX_TSA_SHA2_URL_ARGS := /tr "$(VBOX_TSA_SHA2_URL)" /td sha256 VBOX_CROSS_CERTIFICATE_FILE := VBOX_CROSS_CERTIFICATE_FILE_ARGS := VBOX_CROSS_CERTIFICATE_SHA2_FILE := VBOX_CROSS_CERTIFICATE_SHA2_FILE_ARGS := VBOX_PATH_SIGN_TOOLS := C:\Programs\DevKits\8.1\bin\x64 VBOX_PATH_SELFSIGN := C:\WinDDK\7600.16385.1\bin\selfsign VBOX_PATH_WISUMINFO := "C:\Program Files\Microsoft SDKs\Windows\v7.1\Samples\sysmgmt\msi\scripts\WiSumInf.vbs" VBOX_PATH_WISUBSTG := "C:\Program Files\Microsoft SDKs\Windows\v7.1\Samples\sysmgmt\msi\scripts\WiSubStg.vbs" VBOX_WITH_DOCS := 1 VBOX_WITH_DOCS_CHM := 1 VBOX_WITH_DOCS_PACKING := 1 VBOX_WITH_ADDITIONS := VBOX_WITH_ADDITIONS_PACKING := 1 VBOX_HAVE_XMLLINT := 1 VBOX_XMLLINT := C:\Programs\xmllint\bin\xmllint.exe VBOX_PATH_DOCBOOK := C:/Programs/DocBook/xsl VBOX_PATH_DOCBOOK_DTD := C:/Programs/DocBook/xml VBOX_PATH_HTML_HELP_WORKSHOP := "C:\Program Files (x86)\HTML Help Workshop" VBOX_PDFLATEX := C:\Programs\MiKTeX\texmfs\install\miktex\bin\pdflatex.exe VBOX_PDFLATEX_CMD := $(VBOX_PDFLATEX) -halt-on-error -interaction batchmode TOOL_CURL_FETCH := C:\Programs\curl\x64\curl.exe PATH_TOOL_NASM := C:/Programs/nasm VBOX_INSTALLER_LANGUAGES := en_US VBOX_WITH_TESTCASES := VBOX_WITH_VALIDATIONKIT := VBOX_WITH_VBOX_IMG := 1 VBOX_WITH_RECORDING := 1 VBOX_WITH_AUDIO_RECORDING := 1 SDK_VBOX_VPX := 1 VBOX_WITH_LIBVPX := 1 SDK_VBOX_OPUS := 1 VBOX_WITH_LIBOPUS := 1 VBOX_BUILD_PUBLISHER := _OSE
You'll need to edit this template:
- The variables
VBOX_CERTIFICATE_SUBJECT_NAME
and VBOX_CERTIFICATE_SHA2_SUBJECT_NAME
should contain the names of the SHA-1 and SHA-256 certificates, respectively. - The variables
VBOX_CERTIFICATE_FINGERPRINT
and VBOX_CERTIFICATE_SHA2_FINGERPRINT
should contain the thumbprints of those certificates; you've copied them earlier from the Certificates management console. - If you have a paid certificate you should delete the lines defining the variables
VBOX_CROSS_CERTIFICATE_FILE_ARGS
and VBOX_CROSS_CERTIFICATE_SHA2_FILE_ARGS
, then in the variables VBOX_CROSS_CERTIFICATE_FILE
and VBOX_CROSS_CERTIFICATE_SHA2_FILE
(without « _ARGS
») put the full path to the cross-certificate (without it the drivers will not be accepted). You can download it from the web site of the company that issued the certificate, or from Microsoft . - You can fine-tune the signing process using various additional variables and macros to redefine the certificate storage, timestamp server, or even construct a full command line for the
signtool
program. You can take a look into the file Config.kmk
below the comment «Code Signing», there you'll find which variables are defined and how they are used. - If you've installed some of the programs into paths different from mine, you need to fix those paths in the template. It's strongly recommended to keep the path style for each variable (forward/backward slashes), sometimes it's critical for successful build.
- Fox WiX you need to specify the path to its binaries. With the portable version, it is just the directory where you unpacked it; if you used the installer, the binaries will be located in the subdirectory
bin
. Please, note, that the path must not contain spaces! If it does you have to convert it into the 8.3 format (you can use dir /x
for that). Unfortunately, enclosing the path in quotes does not work with this variable. - The variable
VBOX_BUILD_PUBLISHER
specifies the branding suffix in the version number. By default it is «_OSE» (that is, the full product version is «6.0.4_OSE»). You can specify any other suffix here, or set it to empty to get rid of it altogether. But if you delete the variable completely, it will use the default «_OSE».
The rest of the variables are mostly used to declare which components are to be built. And, of course, the main declaration comes at the very top: turn the hardening off.
Building VirtualBox
Finally, we can now start building VirtualBox itself. If you normally prefer to build for different platforms in parallel you will have to do without it for now, or use two separate source tree copies, because VB has a common configuration file which is generated before the build and contains platform-dependent data. It would not be nice to the compiler to suddenly throw it from the 64-bit build environment into the 32-bit one in the middle of the build process.
If you need Windows 10 compatible driver signatures, please, refer to the information provided after the main procedure description.
- Let's start with the 64-bit version. Open the console and run the following commands:
cd /d C:\Devel\VirtualBox-src "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /Release /x64 /win7 COLOR 07 set BUILD_TARGET_ARCH=amd64 cscript configure.vbs --with-DDK=C:\WinDDK\7600.16385.1 --with-MinGW-w64=C:\Programs\mingw64 --with-MinGW32=C:\Programs\mingw32 --with-libSDL=C:\Programs\SDL\x64 --with-openssl=C:\Programs\OpenSSL\x64 --with-openssl32=C:\Programs\OpenSSL\x32 --with-libcurl=C:\Programs\curl\x64 --with-libcurl32=C:\Programs\curl\x32 --with-Qt5=C:\Programs\Qt\5.6.3-x64 --with-libvpx=C:\Programs\libvpx --with-libopus=C:\Programs\libopus --with-python=C:/Programs/Python env.bat kmk kmk C:/Devel/VirtualBox-src/out/win.x86/release/obj/Installer/VirtualBox-6.0.4_OSE-r128164-MultiArch_amd64.msi
The configure.vbs
script verifies the environment and generates configuration files ( AutoConfig.kmk
and env.bat
). The first kmk
command builds the binaries and collect them into out\win.amd64\bin\
. And the last command packs them all into the intermediate MSI package. Important notes:- You must use forward slashes in the last command. With backslashes,
kmk
would fail to find the build rules. - Even though we are building the 64-bit version, the target package is located in
out\win.x86\…
, because the final stage of the build will be performed from the 32-bit build environment. - If you've changed the branding suffix you need to change the name of the target package by replacing the «_OSE» with what you specified in the variable
VBOX_BUILD_PUBLISHER
. - The revision number in the MSI package name (128164) can be found in the file
Config.kmk
inside the VBOX_SVN_REV_FALLBACK
variable definition. Please, note, that this value may be different from revisions of the official distribution (for instance, the version 6.0.4 has release number 128413). Unfortunately, I have no idea why.
- Now we need to build the 32-bit version and pack everything together. For that, open a new console window, and run the following commands:
cd /d C:\Devel\VirtualBox-src "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /Release /x86 /win7 COLOR 07 set BUILD_TARGET_ARCH=x86 cscript configure.vbs --with-DDK=C:\WinDDK\7600.16385.1 --with-MinGW-w64=C:\Programs\mingw64 --with-MinGW32=C:\Programs\mingw32 --with-libSDL=C:\Programs\SDL\x32 --with-openssl=C:\Programs\OpenSSL\x32 --with-libcurl=C:\Programs\curl\x32 --with-Qt5=C:\Programs\Qt\5.6.3-x32 --with-libvpx=C:\Programs\libvpx --with-libopus=C:\Programs\libopus --with-python=C:/Programs/Python env.bat kmk kmk C:/Devel/VirtualBox-src/out/win.x86/release/bin/VirtualBox-6.0.4_OSE-r128164-MultiArch.exe
Same as with the 64-bit, you need to replace the «_OSE» suffix with what you have.
Notice how in the last command we are building an EXE
, and not an MSI
. This is the final installer which will cause the 32-bit package to be built automatically, from dependencies. - Even if you have a paid certificate you will find that you cannot install this distribution into Windows 10 booted with Secure Boot enabled. This OS has stricter requirements, and the drivers must be signed by none other than Microsoft themselves. The procedure is explained in details on various Internet resources and is unrelated to this article, so I'm not going to go deep into this topic. Instead I'll outline the main steps you need to take for integrating this task with the VB build procedure.
If neither of us has messed anything up, all this long chain should bring you a shiny new VirtualBox installer which differs from the Oracle one only by its icon, the About picture, and, of course, the profound lack of hardening. It's not hard to replace also the icon and the picture, but I won't go into this topic here.
For convenience I've created a
single batch file which automates the full build of VB. You can use it if you need to build the complete installer regularly.
Just a few more words about installing the resultant distribution if you are using a self-signed certificate. As it was suddenly discovered, in Windows 8/10 it's not enough to boot into test mode, installation still fails claiming that the driver signatures are invalid. You can work around this problem by adding the certificates into your CA root storage:
- Open the Properties dialog of the VB installer by right clicking it and selecting Properties , then switch to the Digital Signatures tab. You'll find two signatures there, both named «Roga and Kopyta Ltd», one is sha1, the other sha256. Select the first one, click Details .
- Another dialog appears, in that you need to click the View Certificate button.
- One more dialog, click Install Certificate .
- In the Import wizard, select the location «Local Machine», click Next . After UAC confirmation (if needed), there's the certificate store selection. Select «Place all certificates in the following store», then click Browse and choose the store named «Trusted Root Certification Authorities». Then Next , Finish . You're done, the certificate is installed.
- Close all the dialogs but the very first one, select the second signature (sha256) and repeat the steps 2 to 4 for it too.
- Close all the dialogs, run the installer. Now it should work fine.
Epilogue
When I finished writing the article I was myself surprized by its volume. At first I was planning to go into many details on reasons for choosing this or that way of solving each problem, explain what the problem is, exactly, and what alternative solutions might be applicable. But very soon it became clear that, if loaded with all these particulars, the text would be monstrously huge. I have to apologize, then, for the recipes looking like «just do this and ask no questions». I have a strong dislike for those myself, but I just couldn't find any other way. Occasionally I still tried to outline what was going on, to soften the impression.
A vast amount of details about VB build system had to remain behind the scene; for I have both felt reluctant to bloat the text, and, sometimes, was too lazy to go look for a different, more efficient approach of solving a problem. After all, my main aim, initially, was to get myself a working build of the current VirtualBox version. 4.3.12 had already been way outdated by that time, but I could not risk updating one of my most actively used tool to the hardened version which might simply stop working at any moment. Although, from time to time I do get back and, having found something new, add it to this article.
I do hope this article will find its audience. If you are interested to see and analyze the final result but don't want to set up all the pile of programs, you can get my version of the distribution from here:
version 6.0.4 . All the drivers (and other files) are signed with an untrusted self-signed certificate, so for installing this in the 64-bit Windows version you will have to reboot into the test mode. If you have any questions, suggestions, recommendations, please, feel free to write to me either here in comments, or via personal messages. May the Open Source be with you!
Amendments
Archive• Russian article published, 21.01.2016
- VirtualBox 5.0.12.
• Update of 24.05.2016
- The article is updated for VB 5.0.20, one of the main changes being SHA-1/SHA-256 dual-signing.
- Added disabling of forced signature checks if self-signed certificates are used.
- Added information about workaround for installation failure of the self-signed distribution.
- Library versions were updated.
- Disabled some unused components for speeding up the build process.
- Minor fixes and improvements.
• Update of 29.07.2016
- The article is updated for VB 5.1.2; the most important change is upgrading to Qt5. The differences from VB 5.0.x procedure are specified where applicable.
- Library versions were updated.
- The full build batch was updated to check error codes after each operation.
- Minor fixes and improvements.
• Update of 15.09.2016
- The article is updated for VB 5.1.6.
- Library versions were updated.
- Added NASM for building OpenSSL.
- Added OpenSSL into cURL; this fixes the broken function of checking for updates and downloading the Extension Pack.
- The full build batch now reads the VB version automatically.
- Various minor fixes and improvements.
• Update of 30.11.2016
- The article is updated for VB 5.1.10.
- Library versions were updated; particularly OpenSSL was upgraded to version 1.1.x.
- Fixed some installation errors:
- path to the Qt plugins now points to the installation directory;
- added forgotten OpenSSL libraries to the 32-bit components of the 64-bit VB version.
- The article no longer contains information about building older VB versions. If needed, the previous versions of it are available in the GitHub project .
• Update of 2.12.2016
- Switched to using statically linked OpenSSL.
• Update of 20.06.2017
- The article is updated for VB 5.1.22.
- cURL, OpenSSL, and gSOAP were updated; adapted the build instructions for cURL, gSOAP and VB.
• Update of 1.12.2017
- The article is updated for VB 5.2.2.
- Switched from MinGW-32 3.3.3 to 4.5.4.
- Qt, cURL, OpenSSL, gSOAP, and some build tools were updated; adapted the build instructions for cURL, gSOAP and VB.
- Switched to using local archives of DocBook XML/XSL instead of online versions.
- Using cURL program instead of wget for downloading the Guest Additions ISO image.
- Various minor fixes and improvements.
• Update of 4.12.2017
- The libxml version was fixed in the build instructions.
• Update of 4.09.2018
- The article is updated for VB 5.2.18.
- cURL, OpenSSL, gSOAP and some build tools were updated; adapted the build instructions for cURL.
• Update of 12.12.2018
- The article is updated for VB 5.2.22.
- Enabled screen recording functionality which is disabled in OSE version by default; added libraries libopus and libvpx for encoding.
- cURL, OpenSSL, and gSOAP were updated.
- The full set of VirtualBox source code changes is now published as a single patch file for easier application.
• Update of 25.01.2019
- The article is updated for VB 6.0.2.
- Improved disabling Guest Additions build.
- cURL and gSOAP were updated; DocBook XSL Stylesheets were downgraded to the version 1.69.1 (the documentation is better suited to that version).
- The full build batch was split from the article text into a downloadable file.
• Update of 8.04.2019
- The article has been translated into English for the first time. Also numerous minor changes were introduced into the Russian version.
- Added information about drivers signing for Windows 10.
- The article is updated for VB 6.0.4.
- cURL, OpenSSL, gSOAP, and some tools were updated.
- The full build batch no longer has to be placed at the specific path. Also, it now contains the basic template for automated Windows 10 drivers signing.