From: "Christian Höltje" Date: 2010-03-24T23:08:23+09:00 Subject: [ruby-core:28927] [Bug #3006] Compiling ext/etc problems (windows) Bug #3006: Compiling ext/etc problems (windows) http://redmine.ruby-lang.org/issues/show/3006 Author: Christian H��ltje Status: Open, Priority: Normal Category: build ruby -v: 1.9.1-p376 This is while compiling ruby for windows (i386 & x86_64) using Visual Studio 8 (2005). I get the following error in x86_64: LIBCMT.lib(getenv.obj) : error LNK2005: getenv already defined in msvcr80-ruby19 1.lib(msvcr80-ruby191.dll) I fixed this by adding -nodfeaultlib:libcmt to DLDFLAGS in extconf.rb I then get: LINK : error LNK2001: unresolved external symbol __DllMainCRTStartup@12 I fixed that by adding /noentry. Which I assume is the correct behavior. In i386, I only get the LNK2001 error. So I just patched ext/etc/extconf.rb to add this line after the 'require 'mkmf'' at the top: $DLDFLAGS = "#{$DLDFLAGS} -nodefaultlib:libcmt /noentry" With the resulting binary, I can run the following ruby without problems: require 'etc' puts "*" * 40 puts "Login: #{Etc.getlogin}" puts "Group: #{Etc.group}" puts "*" * 40 ...so I assume that it works. ---------------------------------------- http://redmine.ruby-lang.org