Bug #1253
closedFix MSVC Build Issues
Description
=begin
The attached patch fixes a couple of linking bugs with MSVC 2008 against head, plus does a bit of makefile cleanup. I'm happy to split the patch into multiple parts if that would make it easier to apply. The patch includes:
- LDFLAGS not passed to extconf.rb
For example, in Makefile set LDFLAGS = -libpath:c:/msvc/lib
This path is not passed to exconf.rb, meaning that you can't set the path to third-party extension libraries (zlib/gdbm/readline/iconv/etc).
The problem is Makefile.sub:
+s,@LDFLAGS@,,;t t
This should be
+s,@LDFLAGS@,$(LDFLAGS),;t t
- -link inconsistently handled.
In VC, -link is a keyword that separates compiler options from linker options. Makefile.sub is consistent on how it is handled.
In some cases:
-link ${LDFLAGS}
In other cases
LDFLAGS = -link ....
My view is that -link should not be included in LDFLAGS, and thus the patch goes with the first pattern.
- setup.mak out of date
The example compiler/link options specified in setup.mak no longer match what Makefile.sub actually does. The patch fixes this by syncing setup.mak back with Makefile.sub
- optflags incorrect
OPTFLAGS is set to -O2b2xty- which from the MSDN documentation isn't legal. It should simply be O2 (see http://msdn.microsoft.com/en-us/library/k1ack8f1.aspx).
- warn flags
For some reason, Makefile.sub turns off all compiler warnings. That seems a bit counter-productive. The patch turns them back on:
!if !defined(WARNFLAGS)
WARNFLAGS = -w3 -wd4996
!endif
-wd4996 turns of deprecation warnings, to avoid all the silly Microsoft warning about non-iso standard replacements for strlen etc.
Let me know if I should split this patch into multiple parts.
=end
Files