Project

General

Profile

Actions

Bug #1253

closed

Fix MSVC Build Issues

Added by cfis (Charlie Savage) about 15 years ago. Updated almost 13 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 1.9.2dev (2009-03-06) [i386-mswin32_90]
Backport:
[ruby-core:22725]

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:

  1. 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

  1. -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.

  1. 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

  1. 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).

  1. 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

make_win.patch (3.86 KB) make_win.patch cfis (Charlie Savage), 03/08/2009 08:20 AM
Makefile.sub.patch (2.52 KB) Makefile.sub.patch cfis (Charlie Savage), 03/10/2009 12:06 PM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0