valarion
valarion

Reputation: 45

Trying to build ruby on visual studio with zlib

I'm trying to build ruby on visual studio with zlib and I'm having problems with it.

I have prepared everything to build it but I don't know how to specify where the zlib library and headers are.

I have the source code in $(ProjectDir)/.. I am buildin in $(ProjectDir)/$(Platform)/$(Configuration) I build with command line, and I have it like this

mkdir $(Platform)\$(Configuration)
cd $(Platform)\$(Configuration)\
..\..\..\win32\configure.bat --target=i386-mswin32 --prefix=$(ProjectDir)$(Platform)\$(Configuration)\bin

If I go to ext/zlib, I can execute

extconf.rb --with-zlib-lib=$(ProjectDir)..\..\zlib-1.2.8\zlib-1.2.8\$(Platform)\$(Configuration)\lib --with-zlib-include=$(ProjectDir)..\..\zlib-1.2.8

and creates the makefile correcly, but I don't know how to pass zlib lib and include paths to the configuration script.

I have tried with

..\..\..\win32\configure.bat --target=i386-mswin32 --prefix=$(ProjectDir)$(Platform)\$(Configuration)\bin --with-zlib-lib=$(ProjectDir)..\..\zlib-1.2.8\zlib-1.2.8\$(Platform)\$(Configuration)\lib --with-zlib-include=$(ProjectDir)..\..\zlib-1.2.8

but that doesn't works

I suppose it has something to do with the '--with-ext="a,b,..."' option or with the "--path" that is specified in the help command, but I don't know how to specify it and the documentation is really bad.

I would be very gratefull if you could help me.

Upvotes: 3

Views: 581

Answers (1)

Georger Araujo
Georger Araujo

Reputation: 56

The instructions below are for Ruby 2.2.5 – if you want to build some other version or use different folder paths, change accordingly. I used these to successfully build Ruby 2.2.5 and 2.3.1 from source with zlib using VS2013 Community Update 5 on Windows 8.1 Pro x64.

  • Create folders:

    C:\ruby-2.2.5\build
    C:\ruby-2.2.5\src
    
  • Untar ruby-2.2.5.tar.gz and put the sources in C:\ruby-2.2.5\src

  • Unzip the zlib distribution archive (zlib128-dll.zip) into C:\zlib128-dll

  • Run Developer Command Prompt for VS2013, then run:

    SET INCLUDE=%INCLUDE%;C:\zlib128-dll\include
    SET LIB=%LIB%;C:\zlib128-dll\lib
    SET PATH=%PATH%;C:\zlib128-dll
    
    cd C:\ruby-2.2.5\build
    ..\src\win32\configure.bat
    nmake
    nmake DESTDIR=C:/ruby-2.2.5 install
    
  • Done. You should now have a fully working, zlib-enabled, Ruby build in C:\ruby-2.2.5\usr.

Upvotes: 4

Related Questions