From: Patrik Sundberg Date: 2002-01-11T07:57:42+09:00 Subject: Re: When trying to pack Ruby scripts in one .exe file under Windows. On Fri, Jan 11, 2002 at 07:43:13AM +0900, Carine Abrantes wrote: > Hi, > > I am trying to pack into a single .exe file (i use Ruby 1.6.5 cygwin distrib > under Windows2000) one Ruby application made up of several scripts that > connect through some 'require'. > I have parsed ruby-talk site in order to see what already existed to achieve > this : > > - RubyWrap: Seems a good solution in my case but, I got problems when it > comes to linking (with gcc) the first executable (memunwrap.c + the > generated c file). The linker tells me that there is "illegal symbol index > #{a_number} > > in relocs" with 'a_number' is a varying number. The problem comes from > these lines in the rbwrap.rb script : > > # Inject wrapped data into object file > wdo = "" > File.open(tfilename + ".o", "r") {|f| wdo = f.read} > wdo[wdo.index(matchstr), wrap_str.length] = wrap_str > File.open(tfilename + ".o", "w") {|f| f.write wdo} > > > in method : exe_creator_uw_compile_wtdall(filewrap). When i comment these > lines an executable that seems to correspond to my main script filename is > created > but it does nothing, i don't even know if it is a valid one and if it > includes my packed scripts. > > - Ruby2exe: very simple to use but does not seem to support 'require' > handling. As my application is made of 4 .rb files that includes libraries > too > (telnet, ftp, cgi) it is very annoying since these are not packed in the exe > file. > One solution would be to manually inline all these dependancies in one > single script file but I though it would be wise to ask you if it was worth > it. > > So what would be the best and simplest solution to obtain a single > executable (the size does not matter that much) with a bunch of ruby > scripts. It would > be great if it would embed the ruby interpreter too. > > One other thing, after spending some time reading at ruby-talks regarding > this executable packaging problem i found that the speed benefit was cited > as being almost the only advantage and motivation to this type of > manipulation. > I just want to add that this type of manipulation is also (and mostly) > required in a industrial environment. It IS necessary for Ruby to have that > kind of > support so that it could be used by any commercial company. No company would > tell its customers to install Ruby in order to make its software work, > and no company company would like to add one Ruby file interpreter+dlls in > a simple software installation. Simplicity of use in the customer side is > one of the main goals. I have looked into this a bit. Me and Robert Feldt discussed this on the list some days before christmas (see the archives). As noted there this kind of thing would probably come along nicley when a mechanism such as RubyGems is in place. -- ---------------------------------------------------------------------------. Patrik Sundberg Address: Rydsv�gen 100C, 584 31 Link�ping, Sweden | Email: ps@raditex.se || ps@radiac.mine.nu | Phone: +46 13 178567 || +46 707 602240 | .---> Applied Physics and Electrical Engineering student | |-----> Master of Science in Business Administration and Economics student | |-------> UNIX/Programming consultant | `--------------------------------------------------------------------------'