Re: [PATCH] Fix compilation failure with Ruby 2.0.0

765 views
Skip to first unread message

Bram Moolenaar

unread,
Mar 26, 2013, 7:30:48 AM3/26/13
to eagl...@gmail.com, vim...@googlegroups.com

eagletmt wrote:

> I found that Vim cannot be compiled with --enable-rubyinterp=dynamic
> on 64bit platform if the Ruby's version is 2.0.0. I attached a patch
> to fix it. Please check it.

Thanks. I hope a few people can try it out.

Please give us your name. I do not include code from anonymous sources.


--
The primary purpose of the DATA statement is to give names to constants;
instead of referring to pi as 3.141592653589793 at every appearance, the
variable PI can be given that value with a DATA statement and used instead
of the longer form of the constant. This also simplifies modifying the
program, should the value of pi change.
-- FORTRAN manual for Xerox Computers

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Ken Takata

unread,
Mar 26, 2013, 1:08:36 PM3/26/13
to vim...@googlegroups.com, eagl...@gmail.com
Hi Bram and eagletmt,

Bram Moolenaar wrote:
> eagletmt wrote:
>
> > I found that Vim cannot be compiled with --enable-rubyinterp=dynamic
> > on 64bit platform if the Ruby's version is 2.0.0. I attached a patch
> > to fix it. Please check it.
>
> Thanks. I hope a few people can try it out.

I checked the patch on Windows with the following compilers:

* MSVC10 (32 bit) + Ruby 2.0.0
* MinGW (64 bit) + Ruby 2.0.0

Both worked fine.

Thanks,
Ken Takata

Kohei Suzuki

unread,
Mar 27, 2013, 9:45:57 AM3/27/13
to vim...@googlegroups.com, eagl...@gmail.com

Sorry, my name is Kohei Suzuki.

I have tested my patch on 32bit/64bit Linux with Ruby 1.9.3 and 2.0.0.

Bram Moolenaar

unread,
Mar 27, 2013, 6:20:44 PM3/27/13
to Kohei Suzuki, vim...@googlegroups.com

Kohei Suzuki wrote:

> On Tuesday, March 26, 2013 8:30:48 PM UTC+9, Bram Moolenaar wrote:
> > eagletmt wrote:
> >
> >
> >
> > > I found that Vim cannot be compiled with --enable-rubyinterp=dynamic
> >
> > > on 64bit platform if the Ruby's version is 2.0.0. I attached a patch
> >
> > > to fix it. Please check it.
> >
> >
> > Thanks. I hope a few people can try it out.
> >
> > Please give us your name. I do not include code from anonymous sources.
>
> Sorry, my name is Kohei Suzuki.
>
> I have tested my patch on 32bit/64bit Linux with Ruby 1.9.3 and 2.0.0.

Thanks!

--
From "know your smileys":
<|-) Chinese
<|-( Chinese and doesn't like these kind of jokes

skeept

unread,
May 21, 2013, 3:46:54 PM5/21/13
to vim...@googlegroups.com, eagl...@gmail.com
>
>
>
> Thanks. I hope a few people can try it out.
>
>

Was this patch applied already?

I tried compiling a 64 bit windows but if failed complaining that some include file could not be found.

If possible could this patch be included for the next release?
A small example on how to use rubydo (similar to the example on how to use perldo) would be useful for people like me, that don't know much about ruby but would like to learn.

Also for the next release, if possible would it be possible to distribute a 64 bit for windows as well a 32 bit?

Thanks!

Bram Moolenaar

unread,
May 21, 2013, 4:01:05 PM5/21/13
to skeept, vim...@googlegroups.com, eagl...@gmail.com

Skeept wrote:

> > Thanks. I hope a few people can try it out.
>
> Was this patch applied already?
>
> I tried compiling a 64 bit windows but if failed complaining that some
> include file could not be found.
>
> If possible could this patch be included for the next release?

AFAIK this was included in patch 7.3.889.

> A small example on how to use rubydo (similar to the example on how to
> use perldo) would be useful for people like me, that don't know much
> about ruby but would like to learn.
>
> Also for the next release, if possible would it be possible to
> distribute a 64 bit for windows as well a 32 bit?

It's not all that useful. It uses more memory, is probably a bit
slower. I haven't heard real practical advantages. But perhaps that
changed with Windows 8?

--
Clothes make the man. Naked people have little or no influence on society.
-- Mark Twain (Samuel Clemens) (1835-1910)

Ben Fritz

unread,
May 21, 2013, 5:32:28 PM5/21/13
to vim...@googlegroups.com, skeept, eagl...@gmail.com
On Tuesday, May 21, 2013 3:01:05 PM UTC-5, Bram Moolenaar wrote:
> Skeept wrote:
>
>
>
> > > Thanks. I hope a few people can try it out.
>
> >
>
> > Was this patch applied already?
>
> >
>
> > I tried compiling a 64 bit windows but if failed complaining that some
>
> > include file could not be found.
>
> >
>
> > If possible could this patch be included for the next release?
>
>
>
> AFAIK this was included in patch 7.3.889.
>
>
>
> > A small example on how to use rubydo (similar to the example on how to
>
> > use perldo) would be useful for people like me, that don't know much
>
> > about ruby but would like to learn.
>
> >
>
> > Also for the next release, if possible would it be possible to
>
> > distribute a 64 bit for windows as well a 32 bit?
>
>
>
> It's not all that useful. It uses more memory, is probably a bit
>
> slower. I haven't heard real practical advantages. But perhaps that
>
> changed with Windows 8?
>

From http://vim.wikia.com/wiki/Where_to_download_Vim, reasons one might want a 64-bit version:

1. Editing files >4GB in size.
2. 64-bit WinPE does not have a WOW64 subsystem, hence you cannot run a 32-bit executable.
3. Windows Server 2008 R2 (i.e. Win7 Server) also does not have the WOW64 subsystem, by default, although it is an optional component you can install.
4. Potential for performance gains, particularly in heavy memory operations like memcpy and memcmp which can be optimized for the 64-bit word size.
5. Getting 32-bit Vim into a 64-bit "Edit with Vim" context menu entry is tricky.

Also, related to WOW64, accessing native commands which only have a 64-bit version (like chcp) will fail without a workaround.

skeept

unread,
May 21, 2013, 5:40:01 PM5/21/13
to vim...@googlegroups.com, skeept, eagl...@gmail.com
>
> > Was this patch applied already?
>
> >
>
> > I tried compiling a 64 bit windows but if failed complaining that some
>
> > include file could not be found.
>
> >
>
> > If possible could this patch be included for the next release?
>
>
>
> AFAIK this was included in patch 7.3.889.
>

Well, I have downloaded the 64 bit 2.0-p195 rubyinstaller from http://rubyinstaller.org/downloads/
and configured ruby with
RUBY="C:\htemp\Ruby200-x64" DYNAMIC_RUBY=yes RUBY_VER=20 RUBY_VER_LONG=2.0.0 ^

when compiling I get the error:
c:\htemp\ruby200-x64\include\ruby-2.0.0\ruby/ruby.h(24) : fatal error C1083: Cannot open include file: 'ruby/c
onfig.h': No such file or directory
NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\x86_amd64\cl.EXE"' : r
eturn code '0x2'
Stop.

if I don't include the configuration for ruby then I can compile fine (Included patches 1-944).

Is there a different installer I should be using or different configuration options?


>
>
> > A small example on how to use rubydo (similar to the example on how to
>
> > use perldo) would be useful for people like me, that don't know much
>
> > about ruby but would like to learn.
>
> >
>
> > Also for the next release, if possible would it be possible to
>
> > distribute a 64 bit for windows as well a 32 bit?
>
>
>
> It's not all that useful. It uses more memory, is probably a bit
>
> slower. I haven't heard real practical advantages. But perhaps that
>
> changed with Windows 8?
>

I am not sure how much bigger the memory usage will be, but I would not think it would be that big.
64 bit windows users will probably already use 64 bit python and perl so if there is a 64 bit vim they won't have to install additional 32 bit versions.

Jorge

xxx

unread,
May 22, 2013, 6:50:25 PM5/22/13
to vim...@googlegroups.com, skeept, eagl...@gmail.com
On Wednesday, May 22, 2013 5:05:23 AM UTC-5, Andrei Olsen wrote:
> kl. 23:40:01 UTC+2 tirsdag 21. mai 2013 skrev skeept følgende:
>
> > Well, I have downloaded the 64 bit 2.0-p195 rubyinstaller from http://rubyinstaller.org/downloads/
>
> > and configured ruby with
>
> > RUBY="C:\htemp\Ruby200-x64" DYNAMIC_RUBY=yes RUBY_VER=20 RUBY_VER_LONG=2.0.0 ^
>
> >
>
> > when compiling I get the error:
>
> > c:\htemp\ruby200-x64\include\ruby-2.0.0\ruby/ruby.h(24) : fatal error C1083: Cannot open include file: 'ruby/c
>
> > onfig.h': No such file or directory
>
> > NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\x86_amd64\cl.EXE"' : r
>
> > eturn code '0x2'
>
> > Stop.
>
> >
>
> > if I don't include the configuration for ruby then I can compile fine (Included patches 1-944).
>
> >
>
> > Is there a different installer I should be using or different configuration options?
>
>
>
>
>
> I'm not so sure you can use rubyinstaller.org version to compile with Visual Studio. You need to either use MinGW compiler (probably the easiest) or recompile Ruby yourself with MS compiler.
>
>
>
> # To build with MinGW:
>
>
>
> 1. Get MSYS and unpack to c:\msys :
>
> http://sourceforge.net/projects/mingwbuilds/files/external-binary-packages/
>
>
>
> 2. Get MinGW and unpack to c:\mingw64 :
>
> http://sourceforge.net/projects/mingwbuilds/files/host-windows/releases/4.8.0/64-bit/threads-win32/sjlj/
>
>
>
> 3. cd to c:\msys\etc and edit fstab (see fstab.sample). Basically, you need to add this line:
>
>
>
> c:/mingw64 /mingw
>
>
>
> 4. Start MSYS (c:\msys\msys.bat) and cd to where you have Vim source (use forward slashes). Let's assume you have the source in c:\projects\vim and rubyinstaller.org Ruby is installed to c:\Ruby200:
>
>
>
> cd /c/projects/vim/src
>
> make -f Make_ming.mak RUBY="c:/Ruby200" DYNAMIC_RUBY=yes RUBY_VER=20 RUBY_VER
>
> _LONG=2.0.0 ARCH=x86-64
>
>
>
>
>
> # To build with MS compiler:
>
>
>
> 1. Get Ruby source code:
>
> http://www.ruby-lang.org/en/downloads/
>
>
>
> 2. Unpack to let's say c:\projects\ruby
>
>
>
> 3. Open Visual Studio / Windows SDK command prompt and cd to c:\projects\ruby or where your Ruby source code is and run this (see win32\README.win32 for more info):
>
>
>
> win32\configure.bat --prefix=/Ruby200-VC --target=x64-mswin64
>
> nmake
>
> nmake test
>
> nmake install
>
>
>
> 4. Now you should have VC++ compiled Ruby in c:\Ruby200-VC and can cd to Vim's src and build Vim with:
>
>
>
> nmake -f Make_mvc.mak RUBY="c:\Ruby200-VC" DYNAMIC_RUBY=yes RUBY_VER=20 RUBY_VER_LONG=2.0.0 RUBY_PLATFORM=x64-mswin64_100 RUBY_INSTALL_NAME=x64-msvcr100-ruby200
>
>
>
> Add c:\Ruby200-VC\bin to your PATH and you're good to go.


Thanks!

For me compiling ruby with visual studio was the way to go since I have tried to build with mingw and python and for some reason it did not link correctly (the 32 bit version works fine).


Jorge

Andrei Olsen

unread,
May 22, 2013, 7:55:19 PM5/22/13
to vim...@googlegroups.com, skeept, eagl...@gmail.com
> For me compiling ruby with visual studio was the way to go since I have tried to build with mingw and python and for some reason it did not link correctly (the 32 bit version works fine).

Oh, I forgot that I had a slightly modified make file. It will work if you add

-DMS_WIN64

to DEFINES on line 329 (Make_ming.mak)

Bram Moolenaar

unread,
May 23, 2013, 4:43:23 PM5/23/13
to Ben Fritz, vim...@googlegroups.com, skeept, eagl...@gmail.com

Ben Fritz wrote:

> On Tuesday, May 21, 2013 3:01:05 PM UTC-5, Bram Moolenaar wrote:
> > Skeept wrote:
> > > Also for the next release, if possible would it be possible to
> > > distribute a 64 bit for windows as well a 32 bit?
> >
> > It's not all that useful. It uses more memory, is probably a bit
> > slower. I haven't heard real practical advantages. But perhaps that
> > changed with Windows 8?
>
> >From http://vim.wikia.com/wiki/Where_to_download_Vim, reasons one might want a 64-bit version:
>
> 1. Editing files >4GB in size.

Isn't that already possible? It's going to be slow anyway.

> 2. 64-bit WinPE does not have a WOW64 subsystem, hence you cannot run
> a 32-bit executable.

What is WinPE?

> 3. Windows Server 2008 R2 (i.e. Win7 Server) also does not have the
> WOW64 subsystem, by default, although it is an optional component you
> can install.

Not a very common system.

> 4. Potential for performance gains, particularly in heavy memory
> operations like memcpy and memcmp which can be optimized for the
> 64-bit word size.

But moving 64 bits things arounds is slower, net gain or loss needs to
be measured.

> 5. Getting 32-bit Vim into a 64-bit "Edit with Vim" context menu entry
> is tricky.
>
> Also, related to WOW64, accessing native commands which only have a
> 64-bit version (like chcp) will fail without a workaround.

I wonder how many downloads the 64 bit version currently has.

--
Any resemblance between the above views and those of my employer, my terminal,
or the view out my window are purely coincidental. Any resemblance between
the above and my own views is non-deterministic. The question of the
existence of views in the absence of anyone to hold them is left as an
exercise for the reader. The question of the existence of the reader is left
as an exercise for the second god coefficient. (A discussion of
non-orthogonal, non-integral polytheism is beyond the scope of this article.)
(Ralph Jennings)

Andrei Olsen

unread,
May 23, 2013, 6:06:13 PM5/23/13
to vim...@googlegroups.com, Ben Fritz, skeept, eagl...@gmail.com
> > 2. 64-bit WinPE does not have a WOW64 subsystem, hence you cannot run
> > a 32-bit executable.
>
> What is WinPE?

Windows Preinstallation Environment

http://en.wikipedia.org/wiki/Windows_Preinstallation_Environment
http://technet.microsoft.com/en-us/library/hh825110.aspx

Basically, a live CD.

Reply all
Reply to author
Forward
0 new messages