Bug #5517
closedUnable to build trunk/ruby_1_9_3 with Windows SDK for Windows 7
Description
While attempting to build with Windows SDK for Windows 7 (7.1), 7.1.7600.0.30514 I get the following error:
C:\Users\Jon\Documents\RubyDev\ruby-git\build>..\win32\configure.bat --prefix=c:\projects\ruby193-mswin
--target=i686-mswin32 --disable-install-doc --disable-win95
~setup~.mak(4) : fatal error U1034: syntax error : separator missing
Stop.
BUILD ENVIRONMENT¶
C:\Users\Jon\Documents\RubyDev\ruby-git\build>ruby --version
ruby 1.8.7 (2011-06-30 patchlevel 352) [i386-mingw32]
C:\Users\Jon\Documents\RubyDev\ruby-git\build>bison --version
bison (GNU Bison) 2.4.2
C:\Users\Jon\Documents\RubyDev\ruby-git\build>sed --version
GNU sed version 4.2.1
C:\Users\Jon\Documents\RubyDev\ruby-git\build>nmake /?
Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
C:\Users\Jon\Documents\RubyDev\ruby-git\build>cl /?
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
C:\Users\Jon\Documents\RubyDev\ruby-git\build>lib /?
Microsoft (R) Library Manager Version 10.00.30319.01
C:\Users\Jon\Documents\RubyDev\ruby-git\build>dumpbin /?
Microsoft (R) COFF/PE Dumper Version 10.00.30319.01
file: ~setup~.mak¶
ifndef CONFIGURE_ARGS
configure_args = --prefix=c:\projects\ruby193-mswin --target=i686-mswin32 --disable-install-doc --disable-win95
endif
conf = ..\win32\configure.bat
$(conf): nul
@del ~setup~.mak
@-$(MAKE) -l$(MAKEFLAGS) -f $(@D)/setup.mak
"prefix=c:\projects\ruby193-mswin"
"i686-mswin32"
"RDOCTARGET=nodoc"
"ENABLE_WIN95=no"
WIN32DIR=$(@D:=/)
@if exist Makefile.old del Makefile.old
@if exist Makefile ren Makefile Makefile.old
@ren Makefile.new Makefile
Updated by jonforums (Jon Forums) about 13 years ago
Category should have been set to "build" but redmine doesn't allow me to switch it now. Relevant to both 2.0.0 and 1.9.3.
Updated by luislavena (Luis Lavena) about 13 years ago
- Assignee set to usa (Usaku NAKAMURA)
Updated by phasis68 (Heesob Park) about 13 years ago
From the log, I noticed the line #188 of configure.bat
echo>>confargs.c !ifndef CONFIGURE_ARGS
output "ifndef CONFIGURE_ARGS" without "!" for some reason.
I guess this issue is related with the V option of CMD.EXE.
According to the help message:
/V:ON Enable delayed environment variable expansion using ! as the
delimiter. For example, /V:ON would allow !var! to expand the
variable var at execution time. The var syntax expands variables
at input time, which is quite a different thing when inside of a FOR
loop.
Here is a test case
C:\Tmp>type a.bat
@echo off
echo !ifndef CONFIGURE_ARGS
C:\Tmp>cmd /v:on
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Tmp>a.bat
ifndef CONFIGURE_ARGS
C:\Tmp>cmd /v:off
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Tmp>a.bat
!ifndef CONFIGURE_ARGS
In order to workaround this issue, you can use "setlocal DISABLEDELAYEDEXPANSION" in front of batch file.
C:\Tmp>type a.bat
@echo off
@setlocal DISABLEDELAYEDEXPANSION
echo !ifndef CONFIGURE_ARGS
C:\Tmp>cmd /v:on
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Tmp>a.bat
!ifndef CONFIGURE_ARGS
C:\Tmp>cmd /v:off
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Tmp>a.bat
!ifndef CONFIGURE_ARGS
Updated by jonforums (Jon Forums) about 13 years ago
Very nice. I checked the shortcut I use to launch a shell and found the "Target:" had
C:\Windows\System32\cmd.exe /E:ON /V:ON /T:0E /K "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /x86 /release /win7
After changing to /V:OFF I get the following and am off and running again.
C:\Users\Jon\Documents\RubyDev\ruby-git\build>..\win32\configure.bat --prefix=c:\projects\ruby193-mswin --target=i686-mswin32 --disable-install-doc --disable-win95
Creating Makefile.new
PROCESSOR_LEVEL =
type `nmake' to make ruby.
Normally this is where I'd suck it up and eat a little plate of steaming crow for not configuring my system correctly by saying something like "Sorry for the noise, please close".
But seems to be one of those tweaky issues we should make disappear. Is there a way to make configure.bat
immune to /V:ON or /V:OFF in this case, perhaps by adding your @setlocal DISABLEDELAYEDEXPANSION
workaround? Would it then cause problems for those using the IDE to build?
If the workaround isn't solid, I'd like to see this issue documented in win32/README.win32
Updated by usa (Usaku NAKAMURA) about 13 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r33630.
Jon, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
- win32/configure.bat: disable delayed expansion of enironment variable.
[Bug #5517] [ruby-core:40531]
Updated by usa (Usaku NAKAMURA) about 13 years ago
Thank you reporting, Jon.
And, thank you debugging, Heesob.
Updated by jonforums (Jon Forums) about 13 years ago
Thank you both as this was fantastically easy. Onto learning how to covert optflags
and debugflags
options into cl
options.
nmake
...
nmake test
...
PASS all 943 tests
...
KNOWNBUGS.rb .
PASS all 1 tests
nmake install
...
C:\projects\ruby193-mswin>bin\ruby.exe -ve "puts 'Hello Ruby from Windows SDK!'"
ruby 2.0.0dev (2011-11-04 trunk 33630) [i386-mswin32_100]
Hello Ruby from Windows SDK!