oneclick / rubyinstaller2

MSYS2 based RubyInstaller for Windows
https://rubyinstaller.org
BSD 3-Clause "New" or "Revised" License
645 stars 248 forks source link

rake-compiler does not work with rubyinstaller #292

Closed thyresias closed 2 years ago

thyresias commented 2 years ago

What problems are you experiencing?

I am not sure this is the right place to report this, but since I might be doing something wrong, I try here first as the site advertises it: https://rubyinstaller.org/add-ons/rake-compiler.html

If this is not the right place, I will report it rake-compiler.

Summary: I have a C extension that compiles fine with

> ruby extconf.rb
> ridk exec make

But when I try to compile it with rake-compiler, I get errors:

> rake compile
(...)
rake aborted!
Couldn't find a suitable `make` tool. Use `MAKE` env to set an alternative.

If I try to set MAKE:

> set MAKE=ridk make
> rake compile
(...)
Invalid option "make"
(...)
rake aborted!
Errno::ENOENT: No such file or directory @ rb_sysopen - tmp/x64-mingw-ucrt/issue/3.1.2/issue.so

Steps to reproduce

Unzip this file: rc-issue.zip

Compare:

> cd rc-issue\ext\issue
> ruby extconf.rb
creating Makefile
> ridk exec make
generating issue-x64-mingw-ucrt.def
compiling issue.c
linking shared-object issue.so

With:

> cd rc-issue
> gem install rake-compiler
> rake compile
mkdir -p tmp/x64-mingw-ucrt/issue/3.1.2
cd tmp/x64-mingw-ucrt/issue/3.1.2
c:/ruby-3.1.2-x64/bin/ruby.exe -I. -r.rake-compiler-siteconf.rb ../../../../ext/issue/extconf.rb
creating Makefile
cd -
cd tmp/x64-mingw-ucrt/issue/3.1.2
rake aborted!
Couldn't find a suitable `make` tool. Use `MAKE` env to set an alternative.

Tasks: TOP => compile => compile:x64-mingw-ucrt => compile:issue:x64-mingw-ucrt => copy:issue:x64-mingw-ucrt:3.1.2 => tmp/x64-mingw-ucrt/issue/3.1.2/issue.so
(See full trace by running task with --trace)
> set MAKE=ridk make
> rake compile
cd tmp/x64-mingw-ucrt/issue/3.1.2
ridk make
c:/ruby-3.1.2-x64/lib/ruby/site_ruby/3.1.0/ruby_installer/runtime/ridk.rb:104: warning: assigned but unused variable - tasks
Invalid option "make"
cd -
mkdir -p tmp/x64-mingw-ucrt/stage/lib
ridk make install target_prefix=
c:/ruby-3.1.2-x64/lib/ruby/site_ruby/3.1.0/ruby_installer/runtime/ridk.rb:104: warning: assigned but unused variable - tasks
Invalid option "make"
cp tmp/x64-mingw-ucrt/issue/3.1.2/issue.so tmp/x64-mingw-ucrt/stage/lib/issue.so
rake aborted!
Errno::ENOENT: No such file or directory @ rb_sysopen - tmp/x64-mingw-ucrt/issue/3.1.2/issue.so

Tasks: TOP => compile => compile:x64-mingw-ucrt => compile:issue:x64-mingw-ucrt => copy:issue:x64-mingw-ucrt:3.1.2
(See full trace by running task with --trace)

What's the output from ridk version?


ruby: path: c:/ruby-3.1.2-x64 version: 3.1.2 platform: x64-mingw-ucrt cc: gcc.exe (Rev10, Built by MSYS2 project) 11.2.0 ruby_installer: package_version: 3.1.2-1 git_commit: 17502f9 msys2: path: c:\msys64 cc: gcc (Rev2, Built by MSYS2 project) 12.1.0 sh: GNU bash, version 5.1.16(1)-release (x86_64-pc-msys os: Microsoft Windows [Version 10.0.19044.1766]

larskanis commented 2 years ago

Can you try to enable MSYS2 tools by executing ridk enable on the console prior to running rake compile? Rake-compiler doesn't do this automatically. Only gem install and bundler enable the MSYS2 tools on its own.

thyresias commented 2 years ago

Thank you Lars, it works. I could have found it myself, sorry.

mohits-qi commented 2 years ago

Hi @thyresias - would you close the issue please? :)