[Mono-list] mkbundle on windows

Travis Staloch twostepted at yahoo.com
Fri Sep 22 00:52:42 EDT 2006


Hey All,

Just wanted to share this conversation I had where Robert helped me get mkbundle to work on windows with cygwin.  I've since tried to bundle my app on linux with no success yet.  I'll try to write back once I've figured out how to get it to the bundle native dependencies GLib and GTK correctly.  If anyone has any pointers, please let me know.  I just installed a fresh version of Mono on my linux machine, hoping it would help.

In short, I had to do the following to get mkbundle to work on windows:
1. Run it from a path without any spaces in it (ie c:\Program Files\Mono... didn't work).
2. I had to use a different version of mkbundle from the one provided with 1.1.17.1.  
3.I had to deliver mono\1.0\machine.config along with my app, copying it from my mono installation to mono\1.0 under my app's directory.  

Here's our conversation below.  

--Travis
 
Robert Jordan <robertj at gmx.net> wrote: Hi,

If you bundle you app on a Linux 2.4 system, the binary should work
an all systems.

The problem on Linux are the native dependencies (GLib, GTK) that
you have to deliver. I can't help you with that, because I never did
it myself.

You may try to put them in the private "lib" dir of your application
and change LD_LIBRARY_PATH from inside of a launcher script
to point to this lib dir.

Robert


Travis Staloch wrote:
> Robert,
> 
> Thanks so much.  It looks like thats worked now on windows.  Very
> cool.  Thanks alot.  I'll let you know how things work out with it.
> 
> 
> BTW, Am I going to have to do the same on a linux machine for a linux
> bundle?  If so, will that version be linux independent?
> 
> Thanks,
> 
> --Travis
> 
> Robert Jordan  wrote: Hi Travis,
> 
>> Robert,
>> 
>> Just wondering if you think this might be easier on linux?  I have
>> an FC5 box with mono installed too.  Are you having success on your
>>  machine?  If so, what type of a machine are you running?
> 
> It's not easier on Linux. Since mkbundle generates executables for
> the OS it gets invoked from, it doesn't make sense in your case.
> 
> I've found the problem. The machine config must be deployed rather
> than embedded, because some classes are actually trying to read this
> file.
> 
> Try this:
> 
> mono mkbundle.exe -z --deps --config-dir . MyInstaller.exe
> 
> ("--config-dir ." specifies that Mono's config directory is the
> current folder)
> 
> Then create the directory and subdirectory "mono\1.0" and copy the
> machine.config into this directory.
> 
> You end up having to deploy this:
> 
> mono\1.0\machine.config MyInstaller.exe
> 
> Robert
> 
> 
>> Thanks,
>> 
>> --Travis
>> 
>> Robert Jordan  wrote: Hi Travis,
>> 
>>> Thanks again for your help.  Please let me know if I'm bothering 
>>> you too much or there is a better person to answer my questions. 
>>> After
>> Mkbundle is not very often used, so every feedback is welcome.
>> 
>>> installing 1.1.17 to c:\mono, mkbundle was able to run to 
>>> completion and generate an a.out file (yeah!). I've renamed the 
>>> file to a.exe and when run it shows an error message where my app
>>>  had previously not shown an error. The messsage is below.
>>> 
>>> This problem is likely related to the fact that my app is adding
>>> a debug listener file at
>>> System.IO.Directory.GetCurrentDirectory(). Is there some reason
>>> why mkbundle would have a problem with this?
>> Try
>> 
>> mono mkbundle.exe --deps --config
>> c:/Mono/etc/mono/1.0/machine.config MyInstaller.exe
>> 
>> This will bundle the current machine.config as well.
>> 
>> I'll try it myself tonight.
>> 
>> Robert
>> 
>> 
>> --------------------------------- Yahoo! Messenger with Voice. Make
>>  PC-to-Phone Calls to the US (and 30+ countries) for 2¢/min or
>> less.
> 
> 
> 
>  --------------------------------- Do you Yahoo!? Get on board.
> You're invited to try the new Yahoo! Mail.



Hi Travis,

This is indeed a path issue. Try to reinstall the current Mono 1.1.17.1
into c:\Mono\. Installing the new version has another benefit: mkbundle
(the one I sent you, mkbundle as of 1.1.17.1 has the same issues, so
don't use it) supports the "-z" option (compressing). Your app
will shrink at about 2MB.

Robert


Travis Staloch wrote:
> Robert,
> 
> Again, thanks SO much as I was able to get much further with the 
> process.  However, I still have a problem which doesn't allow 
> mkbundle to complete.  During compilation I get a bunch of compiler 
> warnings and errors from gcc.  I just installed cygwin recently and 
> am using gcc version 3.4.4.
> 
> Do you think that the problem is caused by the space in the path to 
> the mono install directory (Program Files)?
> 
> BTW, I'm planning to post the results of this thread on the mono-list
>  after I get it resolved.
> 
> --Travis
> 
> Here's the command and the first few compiler warnings and errors in
>  case you want to have a look:
> 
> $ gcc -mno-cygwin -g -o a.out -Wall temp.c `pkg-config --cflags 
> --libs mono`  temp.o
> 
> gcc: Files/Mono-1.1.16/include: No such file or directory gcc: 
> Files/Mono-1.1.16/include/glib-2.0: No such file or directory gcc: 
> Files/Mono-1.1.16/lib/glib-2.0/include: No such file or directory 
> gcc: Files/Mono-1.1.16/lib: No such file or directory temp.c:2:36: 
> mono/metadata/assembly.h: No such file or directory temp.c:5: error:
>  parse error before "assembly_bundle_MyInstaller_exe"
> 
> 
> 
> Robert Jordan <robertj at gmx.net> wrote: Hi Travis,
> 
> I've just repeated the bundling with the exe I sent to you (the same)
>  and it works. Please copy mkbundle.exe into the folder with the app
>  you want to bundle and call it like this:
> 
> mono mkbundle.exe --deps MyInstaller.exe
> 
> Robert
> 
> Travis Staloch wrote:
>> Thanks alot Robert!
>> 
>> So I'm understanding that the assembly properties (set in 
>> AssemblyInfo.cs or otherwise) must have read 
>> "IWshRuntimeLibrary.dll" when the assembly file name was actually 
>> Interop.IWshRuntimeLibrary.dll.
>> 
>> After overwriting mkbundle.exe (in C:\Program 
>> Files\Mono-1.1.16\lib\mono\1.0) with the one you provided, I still 
>> get the same message.
>> 
>> --Travis
>> 
>> C:\>mkbundle --deps 
>> c:/Stats/open/installer/MyInstaller/bin/Release/MyInstaller.exe OS 
>> is: Windows Sources: 1 Auto-dependencies: True
>> 
>> Unhandled Exception: System.IO.FileNotFoundException: 
>> InstallerCommon,Version=1.0.2444.27396, Culture=neutral : 
>> InstallerCommon, Version=1.0.2444.27396, Culture=neutral at 
>> <0x00000> at (wrapper managed-to-native) 
>> System.AppDomain:LoadAssembly 
>> (string,System.Security.Policy.Evidence,bool) at 
>> System.AppDomain.Load (System.Reflection.AssemblyName assemblyRef, 
>> System.Security.Policy.Evidence assemblySecurity) [0x00000] at 
>> (wrapper remoting-invoke-with-check) System.AppDomain:Load 
>> (System.Reflection.AssemblyName,System.Security.Policy.Evidence) at
>>  System.AppDomain.Load (System.Reflection.AssemblyName assemblyRef)
>>  [0x00000] at (wrapper remoting-invoke-with-check) 
>> System.AppDomain:Load (System.Reflection.AssemblyName) at 
>> System.Reflection.Assembly.Load (System.Reflection.AssemblyName 
>> assemblyRef) [0x00000] at MakeBundle.QueueAssembly 
>> (System.Collections.ArrayList files, System.Reflection.Assembly a) 
>> [0x00000] at MakeBundle.Main (System.String[] args) [0x00000]
>> 
>> 
>> 
>> 
>> 
>> 
>> Robert Jordan  wrote: Hi Travis,
>> 
>> Here is an updated mkbundle.exe. It should work now. The problem 
>> was Interop.IWshRuntimeLibrary.dll, which was renamed from 
>> IWshRuntimeLibrary.dll. Since renaming an assembly doesn't change 
>> its identity, mkbundle.exe was still trying to load the original 
>> name.
>> 
>> Robert
>> 
>> Travis Staloch wrote:
>>> Robert,
>>> 
>>> Here's the app release directory.  Running it shouldn't do much 
>>> except complain that its missing  a license.
>>> 
>>> Thanks for any advice.
>>> 
>>> --Travis
>>> 
>>> 
>>> Message: 3 Date: Sun, 10 Sep 2006 12:20:56 +0200 From: Robert 
>>> Jordan Subject: Re: [Mono-list] mkbundle on windows To: 
>>> Mono-list at lists.ximian.com Message-ID: Content-Type: text/plain; 
>>> charset=ISO-8859-1; format=flowed
>>> 
>>> Hi,
>>> 
>>> I can reproduce it only for the trivial case: delete an assembly
>>>  which is referenced by the app.
>>> 
>>> If you email me a zip/tar.gz with the assemblies, I'll have a 
>>> look at the problem.
>>> 
>>> Robert
>>> 
>>> 
>>> Travis Staloch wrote:
>>>> Robert,
>>>> 
>>>> I'm still stuck with this.  Sorry if you couldn't get my 
>>>> message last
>>> time, I had one message where your email was the subject and one 
>>> where my attached words didn't make it through.
>>>> Does anyone have any ideas why mkbundle on windows would be 
>>>> acting
>>> this way with mono 1.17?
>>>> Thanks,
>>>> 
>>>> --Travis
>>>> 
>>>> Travis Staloch wrote:
>>>>> I'm trying to use mkbundle on windows with Mono-1.1.16 and 
>>>>> not
>>>>> 
>>> having
>>>>> any luck.  I'm running mkbundle as shown below.  All of the 
>>>>> dlls referenced by MyApp.exe are in the same directory as 
>>>>> MyApp.exe. Thats also the directory where I'm running the 
>>>>> mkbundle command
>>> from.
>>>>>> mkbundle --deps MyApp.exe
>>>>> OS is: Windows Sources: 1 Auto-dependencies: True
>>>>> 
>>>>> Unhandled Exception: System.IO.FileNotFoundException: 
>>>>> MyAppCommon, Version=1.0.2441.695, Culture=neutral : 
>>>>> MyAppCommon, Version=1.0.2441.695, Culture=neutral
>>>> What happens if you call "mono MyApp.exe" from inside of this 
>>>> directory?
>>>> 
>>>> Robert
>>> 




 		
---------------------------------
Get your email and more, right on the  new Yahoo.com 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20060921/0e0993a5/attachment-0001.html 


More information about the Mono-list mailing list