I need a pointer on how to build jruby.exe from source using MinGW on Windows 7 please. The README says make should work if MinGW is installed. I installed MinGW succesfully today using mingw-get-setup.exe and can compile sample programs fine; g++ (GCC) is 4.8.1. However, the following two build techniques were not successful: Option 1: Using a MinGW msys.bat environment "/" lives in C:\MinGW, and so if I copy ~\jruby-1.7.10 into my $HOME and run make from ~\jruby-launcher-1.0.19-java, the compilation fails with an error on an include in winbase.h "error: previous declaration 'BOOL DllMain(HINSTANCE, DWORD, LPVOID)' here... on DllMain. Option 2: If I put C:\MINGW\BIN in my $PATH and run it from a Windows cmd prompt in the ~\jruby-1.7.10\lib\ruby\gems\shared\gems\jruby-launcher-1.0.19-java directory there is no make recognized of course, but if I do a "g++ jruby.cpp -o jruby.exe" then the compiler can't find jni.h (which is in my C:\Program Files (x86)\Java\jdk1.7.0_51\include directory. Any pointers on how to accomplish this compilation from source are appreciated! Thanks, rcs
on 2014-02-19 01:38
on 2014-02-20 18:16
I believe I was the last person to build this for our native installer and I remember having to try many many things before I got it to work. I will try and see what I specifically have installed on my windows box. Getting the proper compiler chain setup was nasty is all I remember. This afternoon I am looking at some Windows bugs so I will try and build native launcher to make sure something else has not changed. -Tom PS - Someone should rewrite our native launcher...it is pretty horrible and I don't say that lightly.
on 2014-02-20 20:38
Thomas E Enebo wrote in post #1137373: > I believe I was the last person to build this for our native > installer and I remember having to try many many things before > I got it to work. I will try and see what I specifically have > installed on my windows box. Getting the proper compiler chain > setup was nasty is all I remember. This afternoon I am looking > at some Windows bugs so I will try and build native launcher to > make sure something else has not changed. > > -Tom > > PS - Someone should rewrite our native launcher...it is pretty > horrible and I don't say that lightly. Thank you very much for your help! I just so happened to rebuild jruby.exe successfully on Windows 7 within the hour as follows. I know this process is a hack from a development environment standpoint, but these steps produced a proper compiler chain that results in a working Windows executable: (1) Install MinGW using mingw-get-setup.exe from http://sourceforge.net/projects/mingw/ (2) Copy the whole jruby-1.7.10 tree into the $HOME of an MinGW msys.bat shell environment (3) cd to ~jruby-1.7.10\lib\ruby\gems\shared\gems\jruby-launcher-1.0.19-java (4) edit the Makefile to comment out the following lines near the top: #ifeq (true,$(shell test -x $(BINDIR)/jruby && echo true)) #RAKE=$(BINDIR)/jruby -S rake #else #RAKE=rake #endif (5) Execute "make jruby.exe" from the msys.bat shell, which yields the compiler string: g++ jrubyexe.cpp nbexecloader.h utilsfuncs.cpp utilsfuncswin.cpp jruby.res -s -o jruby.exe -static ...as well as a working .exe file. Therefore the proper build chain was documented in a sensible place and it is entirely my bad for not finding this sooner (apologies). When you can spare a moment I am also interested in pointers to help me make better contributions in the future: (a) properly setting up a JRuby Windows build environment (like yours) (b) any useful readings or advice that would facilitate my understanding of the jruby code base (c) what JVMs are being used to test JRuby at the moment? Again, thank you for your support and all of your great work! Regards, rcs
on 2014-02-20 21:38
The Makefile in ~jruby-1.7.10\lib\ruby\gems\shared\gems\jruby-launcher-1.0.19-java is definitely being used when I build jruby.exe from MinGW because I had to comment out the first #ifeq in the Makefile that tries to run 'test' in order to make it work (see prior message in thread), BUT the build lines in the Makefile use the source file "jrubyexe.cpp" instead of "jruby.cpp". How is that possible?! I'm sure the EXE is being rebuilt because I delete it and tweak the .RES file to prove it. Snippet of Makefile: VVV jruby.exe: jrubyexe.cpp nbexecloader.h utilsfuncs.cpp utilsfuncswin.cpp jruby.res g++ $(CXXFLAGS) $^ -s -o $@ $(LDLIBSOPTIONS) -static Thanks again, rcs
on 2014-02-20 22:51
On Thu, Feb 20, 2014 at 1:38 PM, Richard S. <firstname.lastname@example.org> wrote: > > > http://sourceforge.net/projects/mingw/ > > (2) Copy the whole jruby-1.7.10 tree into the $HOME of an MinGW > msys.bat shell environment > I never had to do this so I am wondering what I did to make it find the needed files in there... > #endif > I think this might have worked for me since I had an env which did have a valid jruby install to build the newer launcher. You might have also did somehting like: RAKE=path/jruby.bat -S rake make jruby.exe Or something along those lines. > > When you can spare a moment I am also interested in pointers to help > me make better contributions in the future: > > (a) properly setting up a JRuby Windows build environment (like yours) > I just clone to windows and generally I only need to do mvn to compile it. > (b) any useful readings or advice that would facilitate my understanding > of the jruby code base > There are a few talks/presos on the net (jruby hacking guide as a search phrase) but we have plans to make a more focused getting started guide soon. (c) what JVMs are being used to test JRuby at the moment? > https://travis-ci.org/jruby/jruby Notice currently we do not have any windows builds. I ran some tests today and most of the errors are poor tests not accounting for Windows differences but not all. So a windows user developing JRuby would be welcome...