From: Mauricio Fernandez Date: 2007-10-20T06:53:41+09:00 Subject: Re: rocaml 0.6.0: fast, easy Ruby extensions in Objective Caml On Fri, Oct 19, 2007 at 06:59:29AM +0900, Daniel Berger wrote: > On Oct 18, 3:36 pm, Mauricio Fernandez wrote: > > Congrats, it seems you got it to work :) [...] > > BTW, is the /opt/csw/gcc4/lib (de facto) "standard" in any way? > > I'd like to have as much as possible work out of the box (trying to detect > > common cases) and offer a convenient way to specify the things that cannot be > > inferred. > > No, I'm afraid not. The "/opt/csw" prefix is the standard blastwave > package directory (as in, Solaris packages installed from > blastwave.org). I think you'll have to setup a "--with-gcc-dir" option > or something. Yes, that seems the most reasonable way. [...] > BTW, I guess MS Windows is out of the question then, unless I want to > install Cygwin, correct? I used to think so, but I've been googling a bit and it turns out that what I thought would be the major problem (non-PIC code relocation in a shared object) just can't happen: "On Win32, the standard executable format is non-PIC"(!!) [1]. So it seems it is indeed possible to get rocaml to work on Win32. Quoting from OCaml's README.win32: There are no less than four ports of Objective Caml for MS Windows available: - a native Win32 port, built with the Microsoft development tools; - a native Win32 port, built with the Cygwin/MinGW development tools; - a port consisting of the Unix sources compiled under the Cygwin Unix-like environment for Windows; - a native Win64 port (64-bit Windows), built with the Microsoft development tools. Building Ruby extensions on Windows has always been a PITA, since you have to use the same compiler that was used to build Ruby itself. Fortunately, the binary used by the One Click Installer is compatible with extensions built with MinGW, so the MinGW ocaml build should work, as should the Cygwin one along with Cygwin's ruby. And it might even be possible to get it to work with MS's tools assuming Ruby itself can be compiled cleanly. Of course, I'll have to add some options to make it possible to specify where ocaml is installed, since the auto-detection I'm doing will obviously fail: [rocaml_extconf.rb] ... ocaml_native_lib_path = %w[ /usr/lib/ocaml/**/libasmrun.a /usr/local/lib/ocaml/**/libasmrun.a ].map{|glob| Dir[glob]}.flatten.sort.map{|x| File.dirname(x)}.last ... Some further LDFLAGS and/or CFLAGS magic might be needed, as was the case in Solaris, and there might be some un*ix-isms in rocaml_extconf.rb here and there, but it seems it can be made to work. I don't have access to a Windows box so it all depends on people willing to explore new ways, though ;) [1] https://www.gelato.unsw.edu.au/archives/comp-arch/2006-December/005669.html -- Mauricio Fernandez - http://eigenclass.org - singular Ruby