[Mono-list] New: cross-compiling with mkbundle

David Curylo curylod at asme.org
Tue Aug 9 21:42:08 UTC 2016


Thanks for this, better cross-compiling support is huge given I don’t need to have a ton of CI agents handling it.  However, something seems to break for me when using the mkbundle that ships with 4.4.2.

mkbundle --deps --static -o myApp MyApp.exe *.dll

fails with an exception looking for an old version of a .dll, in my case Npgsql:

Unhandled Exception:
System.IO.FileNotFoundException: Could not load file or assembly 'Npgsql, Version=, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7' or one of its dependencies
File name: 'Npgsql, Version=, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7'
  at System.AppDomain.Load (System.String assemblyString, System.Security.Policy.Evidence assemblySecurity, Boolean refonly) <0x19f78c0 + 0x000b0> in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.AppDomain:Load (string,System.Security.Policy.Evidence,bool)
  at System.Reflection.Assembly.ReflectionOnlyLoad (System.String assemblyString) <0x1a72eb0 + 0x00038> in <filename unknown>:0 
  at IKVM.Reflection.Universe.DefaultResolver (System.String refname, Boolean throwOnError) <0x6e7890 + 0x00057> in <filename unknown>:0 
  at IKVM.Reflection.Universe.Load (System.String refname, IKVM.Reflection.Module requestingModule, Boolean throwOnError) <0x6e6f68 + 0x0006f> in <filename unknown>:0 
  at IKVM.Reflection.Universe.Load (System.String refname) <0x6e6f30 + 0x00027> in <filename unknown>:0 
  at MakeBundle.QueueAssembly (System.Collections.Generic.List`1 files, System.String codebase) <0x7b44b0 + 0x001ab> in <filename unknown>:0 

No problems bundling with mkbundle from 4.2.3 - it runs there in CI all the time.  Did something in this new version change how assemblies are located?


> On Aug 9, 2016, at 5:35 PM, Miguel de Icaza via Mono-list <mono-list at lists.dot.net> wrote:
> From: Miguel de Icaza <miguel at microsoft.com <mailto:miguel at microsoft.com>>
> Subject: New: cross-compiling with mkbundle
> Date: August 9, 2016 at 2:02:11 PM EDT
> To: "mono-list at lists.dot.net <mailto:mono-list at lists.dot.net>" <mono-list at lists.dot.net <mailto:mono-list at lists.dot.net>>
> Hello folks,
> The new mkbundle tool in Mono no longer requires an installed compiler, and you can use it to cross compile.
> Would love to get some feedback from you guys.
> First, get a list of all cross-platform targets available, like this:
> mkbundle –list-targets
> Then, find out which version of Mono you have on your system:
> mono –version
> Use this to pick the right version and fetch it, for example, to cross compile to Linux/64 from a Mac do:
> mkbundle –fetch-target 4.4.2-linux-libc2.13-amd64
> Repeat for as many cross-platform targets as wanted.
> Now take your executable that you want to bundle and bundle it up for this platform:
> mkbundle –cross 4.4.2-linux-libc2.13-amd64 demo.exe demo-native
> Now, you can copy that “demo-native” executable to your Linux machine and run it.
> I have done very minimal testing on this, and some features are missing, things that I want to add:
> ·         Ship native libraries
> ·         Add support for shipping the LLVM runtime as an option
> ·         Add support to target different Mono versions, not just the same you have installed
> Miguel.
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.dot.net <mailto:Mono-list at lists.dot.net>
> http://lists.dot.net/mailman/listinfo/mono-list <http://lists.dot.net/mailman/listinfo/mono-list>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dot.net/pipermail/mono-list/attachments/20160809/ea434f59/attachment.html>

More information about the Mono-list mailing list