[Mono-list] New: cross-compiling with mkbundle
Miguel de Icaza
miguel at microsoft.com
Wed Aug 10 03:06:43 UTC 2016
That command line is using the old mkbundle system, not the new one.
That said, the error is likely the same, can you try using MONO_PATH to direct the loader?
From: Dave Curylo <dacurylo at gmail.com> on behalf of David Curylo <curylod at asme.org>
Date: Tuesday, August 9, 2016 at 5:42 PM
To: Miguel de Icaza <miguel at microsoft.com>
Cc: "mono-list at lists.dot.net" <mono-list at lists.dot.net>
Subject: Re: [Mono-list] New: cross-compiling with mkbundle
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:
System.IO.FileNotFoundException: Could not load file or assembly 'Npgsql, Version=184.108.40.206, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7' or one of its dependencies
File name: 'Npgsql, Version=220.127.116.11, 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<mailto: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>>
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:
Then, find out which version of Mono you have on your system:
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
Mono-list maillist - Mono-list at lists.dot.net<mailto:Mono-list at lists.dot.net>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Mono-list