Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 594
valarion Avatar asked Dec 31 '25 21:12

valarion


1 Answers

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.

like image 189
Georger Araujo Avatar answered Jan 02 '26 13:01

Georger Araujo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!