Wednesday, February 24, 2010

Installing Eventmachine in Ruby1.9.1 on win32

out of the box the eventmachine installation breaks with:

libcrypto.a(rand_win.o):rand_win.c:(.text+0xa0c): undefined reference to `_CreateDCA@16
....... and more link errors like this.......

The missing functions are part of the library gdi32.lib.

This is due an ordering error of the libraries in the Makefile created by extconfig.rb
#106:
LIBS = $(LIBRUBYARG_SHARED) -lgdi32 -lrpcrt4 -lkernel32 -lssl -lcrypto -lgdi32 -lshell32 -lws2_32

libgdi32.a is needed after libcrypto.a !!!

so adding a reference to libgdi32.a in my site config file in i386-mingw/rbconfig.rb

#131: CONFIG["LIBS"] = "-lgdi32 -lshell32 -lws2_32 "

sorts it all out and I can build the thing!