Skip to content
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

Make rb-gsl V2.1 work on Windows? #36

Open
i2000s opened this issue May 24, 2016 · 12 comments
Open

Make rb-gsl V2.1 work on Windows? #36

i2000s opened this issue May 24, 2016 · 12 comments
Labels

Comments

@i2000s
Copy link

i2000s commented May 24, 2016

I tried to install rb-gsl on Windows 10, but it always fails. I have gsl compiled from source using MinGW and gcc 4.7. When I run gem install gsl, I always get

D:\Base\Programming>gem install gsl Temporarily enhancing PATH to include DevKit... Building native extensions. This could take a while... ERROR: Error installing gsl: ERROR: Failed to build gem native extension. current directory: C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/gsl-2.1.0.1/ext/gsl_native C:/tools/ruby23/bin/ruby.exe -r ./siteconf20160524-12832-1dzrmsa.rb extconf.rb sh: gsl-config: No such file or directory *** ERROR: missing required library to compile this module: undefined methodchomp' for nil:NilClass *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=C:/tools/ruby23/bin/$(RUBY_BASE_NAME) --with-gsl-version extconf failed, exit code 1 Gem files will remain installed in C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/gsl-2.1.0.1 for inspection. Results logged to C:/tools/ruby23/lib/ruby/gems/2.3.0/extensions/x64-mingw32/2.3.0/gsl-2.1.0.1/gem_make.out `

In the error file, it seems lgsl and lgslcblash are missing. Not sure if gsl is supposed to run in Windows or not. I am using Ruby 2.3 for this build, BTW.

@v0dro
Copy link
Member

v0dro commented May 24, 2016

I can't find the exact line where the extconf is failing. Could you check and let me know? And yes it's supposed to run on Windows.

@v0dro
Copy link
Member

v0dro commented May 24, 2016

Are you sure you've installed gsl in the paths where it can be found during the gem compilation?

@i2000s
Copy link
Author

i2000s commented May 24, 2016

What I did to ensure the correct path was added to the search variable is the following. This may be the major concern, and I appreciate if you can help me confirm all operations are correct.

  1. Compile GSL using both MinGW downloaded directly from the MinGW project website. Then compile it again using the MinGW (MSYS.bat) installed on RubyDevKit. All processed without any error. Should they add the path to the $PATH directly?

  2. Add the gsl-2.1 folder where the source code of gsl was stored and compiled from step 1 to the computer environment variable, Path. Should I add another path? Where the compilation of the GSL ended up for the installation?

  3. Tried use gem install gsl and gem install rb-gsl in the GSL source directory and a directory where a Jekyll website was stored. I also tried downloading the rb-gsl-2.1.0.1.gem file and do the install using the command lines in MinGW and cmd prompt on Windows 10. Nothing worked. Note that I followed this instruction to install Ruby using Chocolatey.

I don't know how to identify which line gave the error. The error message is the only information I got from this installation process. The installation works on my Ubuntu 16.04.

Thanks.

@v0dro v0dro added the bug label May 25, 2016
@v0dro
Copy link
Member

v0dro commented May 25, 2016

@minad know any windows users who can help out here? I'm not very familiar with MINGW and don't have access to a Windows machine.

@minad
Copy link
Contributor

minad commented May 25, 2016

Also not a windows user :)

Am 25. Mai 2016 19:59:56 MESZ, schrieb Sameer Deshmukh [email protected]:

@minad know any windows users who can help out here? I'm not very
familiar with MINGW and don't have access to a Windows machine.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#36 (comment)

@mr-dxdy
Copy link

mr-dxdy commented Jun 27, 2017

@i2000s, it works on windows 7. I think that windows 10 supports too.

  1. Download gsl-2.2.1 from http://ftp.gnu.org/gnu/gsl/
  2. Install patch from https://github.com/alpinelinux/aports/blob/master/main/gsl/dont-disable-deprecated.patch
  3. Run MSYS.bat from C:\RailsInstaller\DevKit
  4. Go to gsl-2.2.1
  5. ./configure
  6. make
  7. make install
  8. Add lines to C:\RailsInstaller\Ruby2.1.0\setup_environment.bat :
SET PATH=%RUBY_DIR%\devkit\local\include\gsl;%PATH%
SET PATH=%RUBY_DIR%\devkit\local\lib;%PATH%
SET PATH=%RUBY_DIR%\devkit\local\bin;%PATH%
  1. Run setup_environment.bat:
  2. gem install gsl

@i2000s
Copy link
Author

i2000s commented Jun 30, 2017

Hi @mr-dxdy ,

Thank you for the followup. It has been a long time ago last time I tried the installation, my computer may have been changing a lot during the past half a year. I followed your steps, and the trick of the patch seems to help this installation process up to step 7, although my computer is extremely slow on MinGW and the ./configure, make and make install process took two days to finish.

I couldn't go to set up the PATH following your instruction, as I don't have the setup_environment.bat file on my computer. So, I skipped it. Instead, I add the DevKit paths to the Windows PATH manually. When I run the last step, I got

$ gem install gsl
ERROR:  Error installing gsl:
        ERROR: Failed to build gem native extension.

    current directory: C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/gsl-2.1.0.3/ext/gsl_native
C:/tools/ruby23/bin/ruby.exe -r ./siteconf20170630-1552-1dqh2a1.rb extconf.rb
checking gsl version... 2.2.1
checking gsl cflags... -I/usr/local/include
checking gsl libs... -L/usr/local/lib -lgsl -lgslcblas -lm
checking for round()... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=C:/tools/ruby23/bin/$(RUBY_BASE_NAME)
        --with-gsl-version
        --with-gsl-cflags
        --with-gsl-libs
        --enable-atlas
        --disable-atlas
C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
        from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:541:in `try_link0'
        from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:556:in `try_link'
        from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:765:in `try_func'
        from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:1051:in `block in have_func'
        from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:942:in `block in checking_for'
        from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:350:in `block (2 levels) in postpone'
        from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:320:in `open'
        from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:350:in `block in postpone'
        from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:320:in `open'
        from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:346:in `postpone'
        from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:941:in `checking_for'
        from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:1050:in `have_func'
        from extconf.rb:131:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  C:/tools/ruby23/lib/ruby/gems/2.3.0/extensions/x64-mingw32/2.3.0/gsl-2.1.0.3/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/gsl-2.1.0.3 for inspection.
Results logged to C:/tools/ruby23/lib/ruby/gems/2.3.0/extensions/x64-mingw32/2.3.0/gsl-2.1.0.3/gem_make.out
Building native extensions.  This could take a while...

Don't worry if you don't know what's the problem. I have been using BashOnUbuntuOnWindows nowadays on Windows 10. It works there.

Thanks!

@mr-dxdy
Copy link

mr-dxdy commented Jun 30, 2017

two days to finish of compiling? It is very long. GNU make supports parallel execution:

make -j N, where N - number of threads

I use setup_environment.bat from project Railsinstall.

After command "Make install" you should find installed files:

C:\tools\ruby23\devkit\local\include\gsl\*.h

C:\tools\ruby23\devkit\local\lib\gsl\libgsl.a
C:\tools\ruby23\devkit\local\lib\gsl\libgsl.la
C:\tools\ruby23\devkit\local\lib\gsl\libgsl.dll.la
C:\tools\ruby23\devkit\local\lib\gsl\libgslcblas.a
.........
C:\tools\ruby23\devkit\local\lib\gsl\libgslcblas.dll.a

C:\tools\ruby23\devkit\local\bin\libgsl.dll
C:\tools\ruby23\devkit\local\bin\gsl-config
C:\tools\ruby23\devkit\local\bin\libgslcblas-0.dll

Add paths of installed files to PATH of Windows:

SET PATH=C:\tools\ruby23\devkit\local\include\gsl;%PATH%
SET PATH=C:\tools\ruby23\devkit\local\lib;%PATH%
SET PATH=C:\tools\ruby23\devkit\local\bin;%PATH%

@i2000s
Copy link
Author

i2000s commented Jun 30, 2017

@mr-dxdy Yeah, my computer has been weird since I reinstalled Ruby 2.3.3 and MinGW-64 a couple of days ago. I haven't seen any line of display in the compiling process taking less than 3 mins, not to mention my computer has 64GB memory and 8 threads.

Back to the issue, my RubyDevKit was not installed under the C:\tools\ruby23 folder, instead, it is under D:\Base\Programming\RubyDevKit. So, what I just did is put the following into a devkitvars.bat file:

SET PATH=%RI_DEVKIT%local\include\gsl;%PATH%
SET PATH=%RI_DEVKIT%local\lib;%PATH%
SET PATH=%RI_DEVKIT%local\bin;%PATH%

Ran it, and then in a MinGW terminal, I run

gem install gsl

I have been waiting it for more than 30mins, nothing happened there. I will report back if anything spills out by tomorrow. This thing has randomized my sleeping pattern :(

@i2000s
Copy link
Author

i2000s commented Jun 30, 2017

Wops... I got something bad again:

$ gem install gsl
ERROR:  Error installing gsl:
        ERROR: Failed to build gem native extension.

    current directory: C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/gsl-2.1.0.3/ext/gsl_native
C:/tools/ruby23/bin/ruby.exe -r ./siteconf20170630-19796-z1p1rm.rb extconf.rb
checking gsl version... 2.2.1
checking gsl cflags... -I/usr/local/include
checking gsl libs... -L/usr/local/lib -lgsl -lgslcblas -lm
checking for round()... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=C:/tools/ruby23/bin/$(RUBY_BASE_NAME)
        --with-gsl-version
        --with-gsl-cflags
        --with-gsl-libs
        --enable-atlas
        --disable-atlas
C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
        from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:541:in `try_link0'
        from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:556:in `try_link'
        from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:765:in `try_func'
        from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:1051:in `block in have_func'
        from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:942:in `block in checking_for'
        from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:350:in `block (2 levels) in postpone'
        from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:320:in `open'
        from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:350:in `block in postpone'
        from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:320:in `open'
        from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:346:in `postpone'
        from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:941:in `checking_for'
        from C:/tools/ruby23/lib/ruby/2.3.0/mkmf.rb:1050:in `have_func'
        from extconf.rb:131:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  C:/tools/ruby23/lib/ruby/gems/2.3.0/extensions/x64-mingw32/2.3.0/gsl-2.1.0.3/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/gsl-2.1.0.3 for inspection.
Results logged to C:/tools/ruby23/lib/ruby/gems/2.3.0/extensions/x64-mingw32/2.3.0/gsl-2.1.0.3/gem_make.out
Building native extensions.  This could take a while...

It seems to have been interfering with the gsl-2.1.0 I installed last year. The mkmf.log file has the following content:

"x86_64-w64-mingw32-gcc -o conftest.exe -IC:/tools/ruby23/include/ruby-2.3.0/x64-mingw32 -IC:/tools/ruby23/include/ruby-2.3.0/ruby/backward -IC:/tools/ruby23/include/ruby-2.3.0 -I. -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64   -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-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -Wall -Iinclude -I/usr/local/include conftest.c  -L. -LC:/tools/ruby23/lib -L.     -L/usr/local/lib -lgsl -lgslcblas -lm  -lx64-msvcrt-ruby230  -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi  "
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <winsock2.h>
4: #include <windows.h>
5: int main(int argc, char **argv)
6: {
7:   return 0;
8: }
/* end */

If you don't think it's easy to fix, then forget about it. I am tired with Windows... Now, I have to go back home and have some sleep... Thank you!

@nickbclifford
Copy link

Here's what happened to me when trying to install it with Ruby 2.4 and RubyInstaller2. I was able to successfully compile GSL with ridk enabled, but installing the actual gem didn't work.

PS C:\Users\Nick\Downloads\gsl-2.4> gem install gsl
Building native extensions.  This could take a while...
ERROR:  Error installing gsl:
        ERROR: Failed to build gem native extension.

    current directory: C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/gsl-2.1.0.3/ext/gsl_native
C:/Ruby24-x64/bin/ruby.exe -r ./siteconf20171115-17424-1bz475b.rb extconf.rb
checking gsl version... 2.4
checking gsl cflags... -I/mingw64/include
checking gsl libs... -L/mingw64/lib -lgsl -lgslcblas -lm
checking for round()... yes
checking for alf/alf.h... no
checking for qrngextra/qrngextra.h... no
checking for rngextra/rngextra.h... no
checking for tensor/tensor.h... no
checking for gsl/gsl_multimin_fsdf.h... no
checking for gsl/gsl_cqp.h... no
checking for jacobi.h... no
checking for ndlinear/gsl_multifit_ndlinear.h... no
checking for ool/ool_version.h... no
checking for gsl_eigen_francis() in -lgsl... yes
checking for gsl_eigen_francis()... yes
checking for gsl_poly_solve_quartic() in -lgsl... no
checking for graph... no
checking for tamu_anova/tamu_anova.h... no
checking for gsl_multifit_fdfsolver.J in gsl/gsl_multifit_nlin.h... no
checking for gsl_sf_mathieu_a_e() in gsl/gsl_sf_mathieu.h... yes
checking for gsl_sf_mathieu_b_e() in gsl/gsl_sf_mathieu.h... yes
checking for gsl_sf_mathieu_ce_e() in gsl/gsl_sf_mathieu.h... yes
checking for gsl_sf_mathieu_se_e() in gsl/gsl_sf_mathieu.h... yes
checking for gsl_sf_mathieu_Mc_e() in gsl/gsl_sf_mathieu.h... yes
checking for gsl_sf_mathieu_Ms_e() in gsl/gsl_sf_mathieu.h... yes
creating gsl_config.h
creating Makefile

current directory: C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/gsl-2.1.0.3/ext/gsl_native
make "DESTDIR=" clean

current directory: C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/gsl-2.1.0.3/ext/gsl_native
make "DESTDIR="
generating gsl_native-x64-mingw32.def
compiling alf.c
compiling array.c
compiling array_complex.c
# ... lots of files ...
compiling vector_double.c
compiling vector_int.c
compiling wavelet.c
linking shared-object gsl_native.so
sf_legendre.o:sf_legendre.c:(.text+0x201): undefined reference to `gsl_sf_legendre_array_size'
sf_legendre.o:sf_legendre.c:(.text+0x228): undefined reference to `gsl_sf_legendre_sphPlm_array'
sf_legendre.o:sf_legendre.c:(.text+0x371): undefined reference to `gsl_sf_legendre_array_size'
sf_legendre.o:sf_legendre.c:(.text+0x398): undefined reference to `gsl_sf_legendre_Plm_array'
sf_legendre.o:sf_legendre.c:(.text+0x6cc): undefined reference to `gsl_sf_legendre_array_size'
collect2.exe: error: ld returned 1 exit status
make: *** [Makefile:259: gsl_native.so] Error 1

make failed, exit code 2

Gem files will remain installed in C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/gsl-2.1.0.3 for inspection.
Results logged to C:/Ruby24-x64/lib/ruby/gems/2.4.0/extensions/x64-mingw32/2.4.0/gsl-2.1.0.3/gem_make.out

gem_make.out shows nothing helpful.

@mr-dxdy
Copy link

mr-dxdy commented Nov 16, 2017

@nickbclifford

sf_legendre.o:sf_legendre.c:(.text+0x201): undefined reference to `gsl_sf_legendre_array_size'
sf_legendre.o:sf_legendre.c:(.text+0x228): undefined reference to `gsl_sf_legendre_sphPlm_array'
sf_legendre.o:sf_legendre.c:(.text+0x371): undefined reference to `gsl_sf_legendre_array_size'
sf_legendre.o:sf_legendre.c:(.text+0x398): undefined reference to `gsl_sf_legendre_Plm_array'
sf_legendre.o:sf_legendre.c:(.text+0x6cc): undefined reference to `gsl_sf_legendre_array_size'

The functions are deprecated https://www.rdocumentation.org/packages/gsl/versions/2.1-1/topics/gsl-deprecated. Use path https://github.com/alpinelinux/aports/blob/master/main/gsl/dont-disable-deprecated.patch .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants