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

"rake cross compile" doesn't choose correct g++ executable #12

Open
lylejohnson opened this issue Oct 27, 2009 · 10 comments
Open

"rake cross compile" doesn't choose correct g++ executable #12

lylejohnson opened this issue Oct 27, 2009 · 10 comments

Comments

@lylejohnson
Copy link

I'm working with the latest rake-compiler (post-0.6.0) from GitHub and it seems that while the "rake cross compile" task does correct set the C compiler (to "i586-mingw32msvc-cc" on my machine) it doesn't get the C++ compiler right (it chooses plain old "g++" instead of "i586-mingw32msvc-g++"). I'm looking into this and will provide a patch if I figure it out; just wanted to get it recorded somewhere.

@luislavena
Copy link
Contributor

Thank you Lyle

This is actually not a rake-compiler issue, but the lack of rbconfig to setup CXX.

rake-compiler uses rbconfig in combination with mkmf. rbconfig was generated by miniruby during the build process, and lacks that information.

The only place rake-compiler defines the compiler itself is here:

http://github.com/luislavena/rake-compiler/blob/master/lib/rake/extensioncompiler.rb

And the only purpose is to help determine the platform and the executable for manual execution.

But this is not used by mkmf or the cross compile process at all.

I advice you setup an environment variable or a extconf parameter that let you assign the CXX properly.

I advice against using ExtensionCompiler to define that in extconf (since the gem will not be available in that particular version of the cross-compiled ruby).

@lylejohnson
Copy link
Author

OK, I understand. Trying now with:

rake cross compile CXX=/usr/bin/i586-mingw32msvc-g++

and that seems to be working a little better (so far!)

@luislavena
Copy link
Contributor

Good news.

Feel free to create a patch then that extend ExtensionCompiler to define the g ++ executable for the mingw host.

@gloriajw
Copy link

This did not resolve my issue, on Fedora 13. I get this error:
[root@li137-46 tenderlove-nokogiri-0e2a3d9]# rake-compiler
/usr/lib/ruby/gems/1.8/gems/rake-compiler-0.7.0/lib/rake/extensioncompiler.rb:28:in mingw_host': No MinGW tools or unknown setup platform? (RuntimeError) from /usr/lib/ruby/gems/1.8/gems/rake-compiler-0.7.0/bin/../tasks/bin/cross-ruby.rake:40 from /usr/lib/ruby/gems/1.8/gems/rake-compiler-0.7.0/bin/rake-compiler:21:inload'
from /usr/lib/ruby/gems/1.8/gems/rake-compiler-0.7.0/bin/rake-compiler:21

@luislavena
Copy link
Contributor

Did you tried setting CXX before invoking rake compiler?

Do you have cross compiling toolset installed in that machine?

@gloriajw
Copy link

passing it as a flag did not work, but setting the env variable did. Thanks for your help.

@tmm1
Copy link

tmm1 commented Nov 25, 2010

I ran into this as well, and used the following in EM:

task :cross_cxx do
  require 'rake/extensioncompiler'
  ENV['CXX'] = "#{Rake::ExtensionCompiler.mingw_host}-g++"
end

if Rake::Task.task_defined?(:cross)
  task :cross => :cross_cxx
end

@luislavena
Copy link
Contributor

I'm keeping this open as documentation thread.

Do you guys think this should be covered/set by rake-compiler in the cross task?

@tmm1
Copy link

tmm1 commented Nov 25, 2010

Yes, I would prefer if this was default behavior inside rake-compiler..

I don't think there's any downside of adding an ENV['CXX'] ||= so there is a default value set?

@luislavena
Copy link
Contributor

@tmm1

Yeah, that can work, but that will make ExtensionTask depend on ExtensionCompiler

Since I'm planning a huge internal change of rake-compiler, will table this until then.

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

No branches or pull requests

4 participants