Project

General

Profile

Bug #3299

revision.h rule in common.mk is broken for MSVC

Added by romuloceccon (Rômulo Ceccon) almost 9 years ago. Updated almost 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
ruby -v:
ruby 1.8.8dev [i386-mswin32_90]
[ruby-core:30249]

Description

=begin
Commit 27107 http://redmine.ruby-lang.org/repositories/revision/ruby-18?rev=27107 broke revision.h rule when trying to compile with MSVC:

'{' is not recognized as an internal or external command,
operable program or batch file.
NMAKE : warning U4004: too many rules for target './revision.h'
cl -nologo -MD -O2b2xty- -DRUBY_EXPORT -I. -I. -I./missing -D_CRT_SE
CURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -c -Tcversion.c
version.c

That doesn't stop compilation, but revision.h is left blank and no revision information is embedded in the executable.

Attached is a patch which fixes the problem with multiple rules and moves the sed expressions to a file so that the command runs correctly on both Windows and Posix systems (currently the sed statement will not work on Windows due to improperly escaped characters).
=end


Files

ruby_27107_fix.diff (1.99 KB) ruby_27107_fix.diff Fix for broken revision.h rule in common.mk romuloceccon (Rômulo Ceccon), 05/15/2010 05:36 AM

History

#1

Updated by nobu (Nobuyoshi Nakada) almost 9 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
This issue was solved with changeset r27798.
Romulo, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

#2

Updated by romuloceccon (Rômulo Ceccon) almost 9 years ago

=begin
Sorry Nobuyoshi, but now (after commit r27799) ruby doesn't compile anymore:

       cl -nologo -MD   -O2b2xty-  -DRUBY_EXPORT -I. -I. -I./missing  -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE    -c -Tcversion.c

version.c
version.c(45) : error C2229: struct '' has an illegal zero-sized array
NMAKE : fatal error U1077: '"C:\Arquivos de programas\Microsoft Visual Studio 9.0\VC\BIN\cl.EXE"' : return code '0x2'
Stop.

Somehow the new rules are generating an empty revision.h. Also, the sed statement still has improperly escaped characters and fails on Windows (this was tested separately, not through the Makefile). I don't think it's possible to have the sed expressions escaped correctly for both Windows and Posix systems (due to different semantics of characteres ' and " in both platforms). That's why I proposed moving the expressions to a separate file.
=end

#3

Updated by nobu (Nobuyoshi Nakada) almost 9 years ago

=begin
Hi,

At Mon, 17 May 2010 00:00:46 +0900,
Romulo Ceccon wrote in [ruby-core:30268]:

Sorry Nobuyoshi, but now (after commit r27799) ruby doesn't compile anymore:

Fixed.

Somehow the new rules are generating an empty
revision.h. Also, the sed statement still has improperly
escaped characters and fails on Windows (this was tested
separately, not through the Makefile).

It works fine with cygwin sed for me, what version of sed do
you use?

That's why I proposed moving the expressions to a separate
file.

Note that : is a label, not a matching address.

--
Nobu Nakada

=end

#4

Updated by romuloceccon (Rômulo Ceccon) almost 9 years ago

=begin

It works fine with cygwin sed for me, what version of sed do
you use?

I use the version from http://gnuwin32.sourceforge.net (Sed-4.2). But the likely problem is that you're testing under a Cygwin shell, while I'm testing from the native Windows shell (cmd.exe). So the sed command line works for you, but not for me. For example, the first expression ('/URL:/{') is understood by the Cygwin shell as a quoted string, and sed receives /URL:/{ (without quotes) as the argument. Cmd.exe does not interpret ' as a special character, so it passes '/URL:/{' (with quotes) as the argument to sed. Sed.exe then fails with:

sed: -e expression #1, character 1: unknown command: ''' [translated from Portuguese]

Replacing ' by " would be enough if the third expression didn't have a " inside. I couldn't come up with an inline string which would work in both Windows and Posix systems. (Well, actually I did come up with one, but it worked only when executed from the shell, and not through the Makefile. At that point I thought that adding an additional layer of character escaping (to satisfy make/nmake rules) would make the expressions unreadable.) So I moved them to a separate file.

=end

#5

Updated by romuloceccon (Rômulo Ceccon) almost 9 years ago

=begin
Now (r27854) the makefile looks correct on Windows and Linux. Thank you, Nobu.

However, invoking "autoconf & ./configure & make" (or "win32\configure & nmake" on Windows) produces an empty revision.h. I guess this is as designed? How am I supposed to generate revision.h so that a "ruby -v" will return something like "ruby 1.8.8dev (2010-05-16 ruby_1_8 27854) [...]"?

=end

Also available in: Atom PDF