Hello everyone,
I want bundle monogame’s content into embedded bundled executable
Requirements:
- Cygwin and Cygwin64 ( Need parallel cygwins ) because you would like to compile mono source into x86 and x64 bit versions
- Visual Studio 2017 complete net development and Windows SDK and ClangC2 and Toolchain
- UPX / Easy UPX Gui if you want make bundled exe smaller.
- sometimes BoxedApp Packer or via MemoryModule C++/h for packing unmanaged dlls into exe
-
Use Cygwin and mono spurce from Github since November 1. 2017
-
Please use x86 version of mono runtime
3 Export important paths to $PATH
-
Check terminal of cygwin mono --version
-
It works fine and I copy all important dlls and lib, include directory to output directory of MonoGame
-
make sure
mkbundle --deps --static "your game.exe" --keeptemp -o bundledgame.exe -v
and wait until mkbundle throws error - Don’t worry! You need compile manuelly
Wait why we need compile manuel because clang was path x64 bit and it went wrong. That is why we need compile manuelly:
- ( Need to download gedit for Windows and Mac OS X) If you are using Ubuntu and you can skip my step → open temp.s and wait loading but it is sometimes freezing because temp.s has largest byte numbers of embedded dlls and exes
And replace “assemblyXXXXXXXXXXXXX” to “_assemblyXXXXXXXXXXXXX”
just you open Replacement dialog and fill up
Search to: “assembly” and Replace to “_assembly” and press “Replace” and wait you see like this
globl _assembly_data_MonoGameHL_exe
.section .rdata,“dr”
.align 32
_assembly_data_MonoGameHL_exe:
…
And save it
-
Open Visual Studio 2017 Prompt ( Developer Command Prompt )
and type path to your mono game output than type
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\ClangC2\14.10.25903\bin\HostX86\clang.exe" -c -x assembler -o temp.s.obj temp.s
and wait for next line. -
go back to terminal of cygwin and copy whole texte like this
WINSDK = (default)
WindowsSdkDir = (default)
WindowsSdkVersion = (default)
MONOPREFIX = (default)
VCSUBSYSTEM = windows (default)
LIBMONO = (default)
LIB = (default)
VSLIB = (default)
VCINSTALLDIR = (default)
MONOPREFIX = (default)
“C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\bin\HostX64\x64\cl.exe” /MD /I “C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\include” /I “C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt” /I “C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um” /I “C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\shared” /I “C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\winrt” /I “include\mono-2.0” /I “.” “temp.c” “temp.s.obj” /link /SUBSYSTEM:windows /ENTRY:mainCRTStartup /NODEFAULTLIB libmono-static-sgen.lib kernel32.lib version.lib ws2_32.lib mswsock.lib psapi.lib shell32.lib oleaut32.lib ole32.lib winmm.lib user32.lib advapi32.lib ucrt.lib vcruntime.lib msvcrt.lib oldnames.lib /LIBPATH:“C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\lib\x64” /LIBPATH:“C:\Program Files (x86)\Windows Kits\10\lib\10.0.16299.0\ucrt\x64” /LIBPATH:“C:\Program Files (x86)\Windows Kits\10\lib\10.0.16299.0\um\x64” /LIBPATH:“lib” /LIBPATH:“.” /OUT:“bundledgame.exe”
With this:
cl /MD /I “C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\include” /I “C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt” /I “C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um” /I “C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\shared” /I “C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\winrt” /I “include\mono-2.0” /I “.” “temp.c” “temp.s.obj” /link /SUBSYSTEM:console /ENTRY:mainCRTStartup libmono-static-sgen.lib kernel32.lib version.lib ws2_32.lib mswsock.lib psapi.lib shell32.lib oleaut32.lib ole32.lib winmm.lib user32.lib advapi32.lib ucrt.lib vcruntime.lib msvcrt.lib oldnames.lib /LIBPATH:“C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\lib\x86” /LIBPATH:“C:\Program Files (x86)\Windows Kits\10\lib\10.0.16299.0\ucrt\x86” /LIBPATH:“C:\Program Files (x86)\Windows Kits\10\lib\10.0.16299.0\um\x86” /LIBPATH:“lib” /LIBPATH:“.” /OUT:“bundledgame.exe”
and press until it will generate to executable
// Resolved because we use better with DesktopGL
Nice with 64 and 86 Bits
For 64 Bit and you need Mono x64 Bit than it can bundle to bundledgame_x64.exe and copy x64 directory to rootdirectory.
Thanks for understanding I hope you have not problem with Mono Runtime x86 if you use -z of mkbundle than you need under Ubuntu or Mac with --cross win32 ( copied from mono_x86 directory to virtual ~/.mono/target/win32 Just I am using VMWare Player 14.x It can work for copy and past host to virtual )
Thanks!