From: Charlie Savage Date: 2009-03-09T11:08:06+09:00 Subject: [ruby-core:22768] [Bug #1253] Fix MSVC Build Issues Issue #1253 has been updated by Charlie Savage. Hi Usaka, Thanks for looking at this. Some more comments inline. > 1. However, mkmf.rb is seen not to use DLDFLAGS for conftest like the bug. And it shouldn't, since its creating executable files, right? DLDFLAGS adds -dll. It still seems to me the simplest solution is to pass in LDFLAGS. Is there a technical issue for not doing that? > 2. -link inconsistently handled. I think what the patch proposes is the correct solution. Remove -link from LDFLAGS. That means users don't have to worry about adding it in if they override LDFLAGS. It also makes the Makefile more consistent and works correctly with conftest (if LDFLAGS is passed in like #1). > 4. optflags > Rejected. Nobu said the reason. The current setting is -O2b2xty-. The problem with that is -O2 and -Ox are mutually exclusive. From MSDN (http://msdn.microsoft.com/en-us/library/8f8h5cxt.aspx): -O2 is /Og /Oi /Ot /Oy /Ob2 /Gs /GF /Gy And (http://msdn.microsoft.com/en-us/library/59a3b321.aspx): -Ox is /Og /Oi /Ot /Oy /Ob2 /Os And last, from MSDN: "In general, /O2 should be preferred over /Ox and /O1 over /Oxs." So why not just /O2? > 5. warn flags > We know that the warnings are for new programs written for Windows > only. Ruby is not such programs. Why do you think that? Warnings are useful for any program, either with VC2008 and GCC. For example, if you read the mailing lists the postgresql project (I think almost as old as Ruby) spend a lot of time reducing compiler warnings. Anyway, I think the -W3 level is appropriate for two reasons. First, Visual Studio 2008 sets warnings to -W3 for both production builds and debug builds. Second, according to MSN (http://msdn.microsoft.com/en-us/library/thxezb7y.aspx): "Level 3 displays all level 2 warnings and all other warnings recommended for production purposes." So -W3 is what Microsoft recommends. When it is on, it reveals a number of warnings when building Ruby (see #1254). Some look serious, for example: win32.c(539) : warning C4013: '_RTC_SetErrorFunc' undefined; assuming extern returning int I'm guessing that is not what is intended. Thanks for looking at this, and let me know how I can help (happy to make new patches). ---------------------------------------- http://redmine.ruby-lang.org/issues/show/1253 ---------------------------------------- http://redmine.ruby-lang.org