[ruby-opengl-devel] [Mkrf-users] Support for building on Windows

Ronald Pijnacker pijnacker at dse.nl
Thu Apr 5 13:40:17 EDT 2007

> On Thursday 05 April 2007 12:12, Ronald Pijnacker wrote:
> >I've attached the patch for making ruby-opengl build on windows.
> >This includes the patch Jan sent out last week that provides the extra
> >typedefs.
> Thanks. I've added your patch to the svn, seems working fine. Can you also 
> provide detailed building instruction (and environment, eg. which compiler 
> and version you used) for the bindings on windows ? We'll add them to the 
> doc/build_install.txt

Compiler tool-chain used: Microsoft Visual Studio 6.0. This should be 
the same version of Visual Studio as used during building ruby. If you
do not use the same version, you'll get the error "MSC version mismatch"
when including config.h via ruby.h.

Mixing versions of visual studio is in general not to be recommended, since
the corresponding c-runtimes are not compatible.

It should be possible to build with only the compiler and linker by installing
the SDK, but I have no experience with that.

INCLUDE and LIB should be set correctly. This is easily done by invoking
VCVARS32.bat from the VS instal directory. On most installations there is a
start-menu entry "Visual Studio Command Line" for this.

The INCLUDE variable should include the directory which has GL/glut.h.
The LIB variable should include the directory which has glut32.lib
(c:\ruby\bin when using the one-click-installer).

Hopefully this is enough info, if not let me know what else you need.

> > 2. The Init_opengl symbol can be dropped, I think, since the name of the
> >    extension was changed into 'gl'.
> >
> >    Just removing the Init_gl and Init_opengl from this file does not seem
> >    to give any problems (which I expected).
> Yes, those are leftovers from the previous versions.
> > 3. How bad would it be to include rbogl.c in both gl and glu Rakefiles?
> >    Although it would have to be built twice, it saves on Rakefile (in
> >    common/) which currently is not auto-generated.
> Although it is technically possible, i would rather see the build system 
> adjusted so it won't be needed.

The problem here is that mkrf only seems to generate rakefiles for dlls.
The common/ directory only generates one object file.
> > 4. How does libruby.so.x.y.z get sucked in on the other architectures?
> >    I seem to need to add this.
> >
> I think the symbols from libruby are resolved by dynamic linker when ruby 
> loads the plugins (gl.so,glu.so ..), so libruby.so isn't needed at 
> compile-time (only header files as ruby.h). I don't know how this translates 
> to windows shared-lib building process though.
Now you mention it, I remember this from unix. Windows is different in that
sense. When linking a dll all external symbols need to be resolved.



More information about the ruby-opengl-devel mailing list