New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruby22 build error: win32ole.o comlpiling fails In function 'ole_variant2val' #254

Closed
artaod opened this Issue Jan 12, 2015 · 6 comments

Comments

Projects
None yet
4 participants
@artaod

artaod commented Jan 12, 2015

Cannot build Ruby 2.2 on WIndows, getting "make[2]: *** [win32ole.o] Error 1" when compiling.

Using Windows 8.1 x64, ruby 2.1.5p273 [i386-mingw32] and DevKit-mingw64-32-4.7.2-20130224-1151

E:\install\Ruby\RubyInstaller>rake ruby22                                                                                                                                                                                                       
mkdir -p sandbox/ruby_2_2                                                                                                                                                                                                                       
"E:/install/Ruby/RubyInstaller/sandbox/extract_utils/basic-bsdtar.exe" -xf "E:/install/Ruby/RubyInstaller/downloads/ruby-2.2.0.tar.bz2" > NUL 2>&1                                                                                              
cd E:/install/Ruby/RubyInstaller                                                                                                                                                                                                                
cp -r resources/icons/ruby-doc.ico resources/icons/ruby.ico resources/icons/rubyw.ico sandbox/ruby22_build                                                                                                                                      
cd -                                                                                                                                                                                                                                            
Temporarily enhancing PATH to include DevKit...                                                                                                                                                                                                 
Activating libffi version 3.0.11                                                                                                                                                                                                                
Activating GDBM version 1.8.3                                                                                                                                                                                                                   
Activating OpenSSL version 1.0.0o                                                                                                                                                                                                               
Activating LibYAML version 0.1.6                                                                                                                                                                                                                
Activating Zlib version 1.2.8                                                                                                                                                                                                                   
Activating Tcl version 8.5.12                                                                                                                                                                                                                   
Activating Tk version 8.5.12                                                                                                                                                                                                                    
cd sandbox/ruby22_build                                                                                                                                                                                                                         
make  all                                                                                                                                                                                                                                       
        CC = gcc                                                                                                                                                                                                                                
        LD = ld                                                                                                                                                                                                                                 
        LDSHARED = gcc -shared -s                                                                                                                                                                                                               
        CFLAGS = -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-stateme
nt -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat  -march=i486                                                                                                                                           
        XCFLAGS = -D_FORTIFY_SOURCE=2 -fno-strict-overflow -DRUBY_EXPORT                                                                                                                                                                        
        CPPFLAGS = -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D__MINGW_USE_VC2005_COMPAT   -I. -I.ext/include/i386-mingw32 -I../ruby_2_2/include -I../ruby_2_2                                                                                    
        DLDFLAGS = -Wl,--enable-auto-image-base,--enable-auto-import -Wl,--out-implib=libmsvcrt-ruby220.dll.a msvcrt-ruby220.def -Wl,--stack,0x00200000,--enable-auto-import  -march=i486                                                       
        SOLIBS = msvcrt-ruby220.res.o -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi                                                                                                                                                        
Using built-in specs.                                                                                                                                                                                                                           
COLLECT_GCC=E:\install\Ruby\RubyInstaller\sandbox\devkit\mingw\bin\gcc.exe                                                                                                                                                                      
COLLECT_LTO_WRAPPER=e:/install/ruby/rubyinstaller/sandbox/devkit/mingw/bin/../libexec/gcc/mingw32/4.5.2/lto-wrapper.exe                                                                                                                         
Target: mingw32                                                                                                                                                                                                                                 
Configured with: ../../src/gcc-4.5.2/configure --build=mingw32 --enable-languages=c,c++,ada,fortran,objc,obj-c++ --enable-threads=win32 --enable-libgomp --enable-lto --enable-fully-dynamic-string --enable-libstdcxx-debug --enable-version-sp
ecific-runtime-libs --with-gnu-ld --disable-nls --disable-win32-registry --disable-symvers --disable-werror --prefix=/mingw32tdm --with-local-prefix=/mingw32tdm --enable-cxx-flags='-fno-function-sections -fno-data-sections' --with-pkgversio
n=tdm-1 --enable-sjlj-exceptions --with-bugurl=http://tdm-gcc.tdragon.net/bugs                                                                                                                                                                  
Thread model: win32                                                                                                                                                                                                                             
gcc version 4.5.2 (tdm-1)                                                                                                                                                   
...
(cut too many make[2] success messages)
...
installing default libraries
make[2]: Leaving directory `/e/install/Ruby/RubyInstaller/sandbox/ruby22_build/ext/win32'
make[2]: Entering directory `/e/install/Ruby/RubyInstaller/sandbox/ruby22_build/ext/win32ole'
compiling ../../../ruby_2_2/ext/win32ole/win32ole.c
../../../ruby_2_2/ext/win32ole/win32ole.c: In function 'ole_variant2val':
../../../ruby_2_2/ext/win32ole/win32ole.c:1452:17: warning: implicit declaration of function 'V_RECORDINFO'
../../../ruby_2_2/ext/win32ole/win32ole.c:1452:17: error: lvalue required as unary '&' operand
../../../ruby_2_2/ext/win32ole/win32ole.c:1460:21: warning: implicit declaration of function 'V_RECORD'
../../../ruby_2_2/ext/win32ole/win32ole.c:1460:21: error: lvalue required as unary '&' operand
../../../ruby_2_2/ext/win32ole/win32ole.c:1658:28: warning: initialization makes pointer from integer without a cast
../../../ruby_2_2/ext/win32ole/win32ole.c:1659:22: warning: initialization makes pointer from integer without a cast
../../../ruby_2_2/ext/win32ole/win32ole.c: In function 'ole_invoke':
../../../ruby_2_2/ext/win32ole/win32ole.c:2761:17: warning: passing argument 2 of 'olerecord_set_ivar' makes pointer from integer without a cast
../../../ruby_2_2/ext/win32ole/win32ole_record.h:6:6: note: expected 'struct IRecordInfo *' but argument is of type 'int'
../../../ruby_2_2/ext/win32ole/win32ole.c:2761:17: warning: passing argument 3 of 'olerecord_set_ivar' makes pointer from integer without a cast
../../../ruby_2_2/ext/win32ole/win32ole_record.h:6:6: note: expected 'void *' but argument is of type 'int'
make[2]: *** [win32ole.o] Error 1
make[2]: Leaving directory `/e/install/Ruby/RubyInstaller/sandbox/ruby22_build/ext/win32ole'
make[1]: *** [ext/win32ole/all] Error 2
make[1]: Leaving directory `/e/install/Ruby/RubyInstaller/sandbox/ruby22_build'
make: *** [build-ext] Error 2
rake aborted!
Command failed with status (2): [make  all...]
E:/install/Ruby/RubyInstaller/recipes/interpreter/ruby22.rake:121:in `block (4 levels) in <top (required)>'
E:/install/Ruby/RubyInstaller/recipes/interpreter/ruby22.rake:119:in `block (3 levels) in <top (required)>'
Tasks: TOP => ruby22 => interpreter:ruby22:compile
(See full trace by running task with --trace)

Thank you for your assistance.

@artaod artaod changed the title from Ruby22 build error: win32ole.o comlpiling fails In function 'ole_variant2val' to Ruby22 build error: win32ole.o comlpiling fails In function 'ole_variant2val' [build] Jan 12, 2015

@artaod artaod changed the title from Ruby22 build error: win32ole.o comlpiling fails In function 'ole_variant2val' [build] to Ruby22 build error: win32ole.o comlpiling fails In function 'ole_variant2val' Jan 12, 2015

@Azolo

This comment has been minimized.

Show comment
Hide comment
@Azolo

Azolo Jan 20, 2015

Member

This is an issue with Ruby that, from my understanding, was fixed but wasn't back ported to Ruby 2.2 in time for release.

The next patch release, Ruby 2.2.X, will have this fixed, but the current release is uncompilable.

Member

Azolo commented Jan 20, 2015

This is an issue with Ruby that, from my understanding, was fixed but wasn't back ported to Ruby 2.2 in time for release.

The next patch release, Ruby 2.2.X, will have this fixed, but the current release is uncompilable.

@bosko

This comment has been minimized.

Show comment
Hide comment
@bosko

bosko Mar 24, 2015

Contributor

@Azolo I just tried rake ruby22 and rake ruby22 LOCAL=c:/Projects/ruby-mirror where ruby-mirror has checkout version of latest trunk and both fail with exactly the same error? How did you make to build Ruby 2.2.1 for release with these sources?

Contributor

bosko commented Mar 24, 2015

@Azolo I just tried rake ruby22 and rake ruby22 LOCAL=c:/Projects/ruby-mirror where ruby-mirror has checkout version of latest trunk and both fail with exactly the same error? How did you make to build Ruby 2.2.1 for release with these sources?

@Azolo

This comment has been minimized.

Show comment
Hide comment
@Azolo

Azolo Mar 24, 2015

Member

I just tested it and the default tdm DevKit does in fact fail.

If you use the dkver=mingw64-32-4.7.2 flag then things actually work.

That being said I don't really understand the difference between the tdm and rbenvb distributions. Maybe if @luislavena, @jonforums, or @shirosaki get some free time they can let me know what the difference is. It does seem like something important.

Member

Azolo commented Mar 24, 2015

I just tested it and the default tdm DevKit does in fact fail.

If you use the dkver=mingw64-32-4.7.2 flag then things actually work.

That being said I don't really understand the difference between the tdm and rbenvb distributions. Maybe if @luislavena, @jonforums, or @shirosaki get some free time they can let me know what the difference is. It does seem like something important.

@jonforums

This comment has been minimized.

Show comment
Hide comment
@jonforums

jonforums Mar 25, 2015

Member

@bosko it has been awhile. I hope all is well.

I spend almost no time with ruby these days, but you may be interested in my jf/dk-edge-new-rubies branch based upon @shirosaki original MSYS2 work. I've no time to support the branch and it's a bit rough. The MSYS2 and updated DevKit commits should be cherrypicked to master. Hopefully someone will jump in and help @Azolo with maintenance work 😸

Punchline: the branch uses MSYS2 for the nix environment to allow parallel builds, grafts in most of @luislavena build script updates, and allows one to build with mingw-w64 gcc 4.9.2.

Here's how I build 2.2.2p88 using openssl 1.0.2a and libffi 3.2.1:

git checkout jf/dk-edge-new-rubies

# Override to use newer libs and toolchain. A subtle bug still exists that prevents `rake ruby22`
# from working with local builds. Use `rake ruby21` and see last step if want to build an archive
# Ensure the `ruby_2_2` branch is checked out in the location specified to `local` 
rake ruby21 make_opt=-j8 local=C:\Users\Jon\Documents\RubyDev\ruby-git openssl=1.0.2a libffi=3.2.1 rbreadline=0.5.2 dkver=mingw64-32-4.9.2

rake devkit:sh dkver=mingw64-32-4.9.2

# no tests fail for win32ole errors
make test-all
...
Finished tests in 733.997964s, 21.2289 tests/s, 3463.7576 assertions/s.
15582 tests, 2542391 assertions, 5 failures, 0 errors, 148 skips

make test
...
gcc version 4.9.2 (i686-win32-sjlj-rev1, Built by MinGW-W64 project)
sample/test.rb:gc OK 4 27K 1210 62
test succeeded
PASS all 1009 tests

2015-03-25 15:06:44 -0400
Driver is ruby 2.2.2p88 (2015-03-25 revision 50085) [i386-mingw32]
Target is ruby 2.2.2p88 (2015-03-25 revision 50085) [i386-mingw32]

# build a 7z archive named with full version info instead of mri's pseudo-semver scheme
rake ruby22:package:archive full_version=1

C:\>uru ls
    1719        : jruby 1.7.19 (1.9.3p551) 2015-01-29 20786bd on Java HotSpot(TM) ...
    200p643-x32 : ruby 2.0.0p643 (2015-02-25 revision 49745) [i386-mingw32]
    215p319-x32 : ruby 2.1.5p319 (2015-03-18 revision 49997) [i386-mingw32]
 => 222p88-x32  : ruby 2.2.2p88 (2015-03-25 revision 50085) [i386-mingw32]

C:\>ruby -rwin32ole -ve "puts WIN32OLE::VERSION"
ruby 2.2.2p88 (2015-03-25 revision 50085) [i386-mingw32]
1.8.3

C:\>ruby -ropenssl -ve "puts OpenSSL::OPENSSL_VERSION"
ruby 2.2.2p88 (2015-03-25 revision 50085) [i386-mingw32]
OpenSSL 1.0.2a 19 Mar 2015
Member

jonforums commented Mar 25, 2015

@bosko it has been awhile. I hope all is well.

I spend almost no time with ruby these days, but you may be interested in my jf/dk-edge-new-rubies branch based upon @shirosaki original MSYS2 work. I've no time to support the branch and it's a bit rough. The MSYS2 and updated DevKit commits should be cherrypicked to master. Hopefully someone will jump in and help @Azolo with maintenance work 😸

Punchline: the branch uses MSYS2 for the nix environment to allow parallel builds, grafts in most of @luislavena build script updates, and allows one to build with mingw-w64 gcc 4.9.2.

Here's how I build 2.2.2p88 using openssl 1.0.2a and libffi 3.2.1:

git checkout jf/dk-edge-new-rubies

# Override to use newer libs and toolchain. A subtle bug still exists that prevents `rake ruby22`
# from working with local builds. Use `rake ruby21` and see last step if want to build an archive
# Ensure the `ruby_2_2` branch is checked out in the location specified to `local` 
rake ruby21 make_opt=-j8 local=C:\Users\Jon\Documents\RubyDev\ruby-git openssl=1.0.2a libffi=3.2.1 rbreadline=0.5.2 dkver=mingw64-32-4.9.2

rake devkit:sh dkver=mingw64-32-4.9.2

# no tests fail for win32ole errors
make test-all
...
Finished tests in 733.997964s, 21.2289 tests/s, 3463.7576 assertions/s.
15582 tests, 2542391 assertions, 5 failures, 0 errors, 148 skips

make test
...
gcc version 4.9.2 (i686-win32-sjlj-rev1, Built by MinGW-W64 project)
sample/test.rb:gc OK 4 27K 1210 62
test succeeded
PASS all 1009 tests

2015-03-25 15:06:44 -0400
Driver is ruby 2.2.2p88 (2015-03-25 revision 50085) [i386-mingw32]
Target is ruby 2.2.2p88 (2015-03-25 revision 50085) [i386-mingw32]

# build a 7z archive named with full version info instead of mri's pseudo-semver scheme
rake ruby22:package:archive full_version=1

C:\>uru ls
    1719        : jruby 1.7.19 (1.9.3p551) 2015-01-29 20786bd on Java HotSpot(TM) ...
    200p643-x32 : ruby 2.0.0p643 (2015-02-25 revision 49745) [i386-mingw32]
    215p319-x32 : ruby 2.1.5p319 (2015-03-18 revision 49997) [i386-mingw32]
 => 222p88-x32  : ruby 2.2.2p88 (2015-03-25 revision 50085) [i386-mingw32]

C:\>ruby -rwin32ole -ve "puts WIN32OLE::VERSION"
ruby 2.2.2p88 (2015-03-25 revision 50085) [i386-mingw32]
1.8.3

C:\>ruby -ropenssl -ve "puts OpenSSL::OPENSSL_VERSION"
ruby 2.2.2p88 (2015-03-25 revision 50085) [i386-mingw32]
OpenSSL 1.0.2a 19 Mar 2015
@bosko

This comment has been minimized.

Show comment
Hide comment
@bosko

bosko Mar 25, 2015

Contributor

@jonforums yes indeed. I also spend almost no time with Ruby on Windows but I am now updating my rubyonwindowsguides.github.io book to newest Ruby versions and I wanted to build them.

will take a look at your branch and will spend some time on it. Thank you for detailed instructions.

Contributor

bosko commented Mar 25, 2015

@jonforums yes indeed. I also spend almost no time with Ruby on Windows but I am now updating my rubyonwindowsguides.github.io book to newest Ruby versions and I wanted to build them.

will take a look at your branch and will spend some time on it. Thank you for detailed instructions.

@jonforums

This comment has been minimized.

Show comment
Hide comment
@jonforums

jonforums Mar 26, 2015

Member

To use the nonstandard openssl=1.0.2a rake envars for newer libs, you need to use our "override" feature and drop the appropriate lib archives into the downloads dir. My openssl and libffi override files look like the following. It's likely too tweaky for your book, but does allow one to build bleading edge mri on windows versions.

# file: override/openssl.rb
if ENV['OPENSSL']
  ssl_version = ENV['OPENSSL']
  puts "---> Using OpenSSL #{ssl_version}"

  RubyInstaller::KNAPSACK_PACKAGES['openssl'].version = ssl_version
  RubyInstaller::KNAPSACK_PACKAGES['openssl'].files = [ "openssl-#{ssl_version}-x86-windows-bin.7z" ]
end

# file: override/libffi.rb
if ENV['LIBFFI']
  ffi_version = ENV['LIBFFI']
  puts "---> Using libffi #{ffi_version}"

  RubyInstaller::KNAPSACK_PACKAGES['ffi'].version = ffi_version
  RubyInstaller::KNAPSACK_PACKAGES['ffi'].files = [ "libffi-#{ffi_version}-x86-windows-bin.7z" ]
end

I build updated libs using my tweaky powershell recipes at https://github.com/jonforums/buildlets but perhaps the knapsack recipes have been updated for the latest lib versions.

Member

jonforums commented Mar 26, 2015

To use the nonstandard openssl=1.0.2a rake envars for newer libs, you need to use our "override" feature and drop the appropriate lib archives into the downloads dir. My openssl and libffi override files look like the following. It's likely too tweaky for your book, but does allow one to build bleading edge mri on windows versions.

# file: override/openssl.rb
if ENV['OPENSSL']
  ssl_version = ENV['OPENSSL']
  puts "---> Using OpenSSL #{ssl_version}"

  RubyInstaller::KNAPSACK_PACKAGES['openssl'].version = ssl_version
  RubyInstaller::KNAPSACK_PACKAGES['openssl'].files = [ "openssl-#{ssl_version}-x86-windows-bin.7z" ]
end

# file: override/libffi.rb
if ENV['LIBFFI']
  ffi_version = ENV['LIBFFI']
  puts "---> Using libffi #{ffi_version}"

  RubyInstaller::KNAPSACK_PACKAGES['ffi'].version = ffi_version
  RubyInstaller::KNAPSACK_PACKAGES['ffi'].files = [ "libffi-#{ffi_version}-x86-windows-bin.7z" ]
end

I build updated libs using my tweaky powershell recipes at https://github.com/jonforums/buildlets but perhaps the knapsack recipes have been updated for the latest lib versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment