ffi / ffi-compiler

Apache License 2.0
32 stars 10 forks source link

Cannot build 2 extensions #5

Closed frahugo closed 11 years ago

frahugo commented 11 years ago

I need to build to separate libraries. In the gemspec, I can provide an array of extensions, as per the documentation:

  spec.extensions    = [
    'ext/mygem/lib1/Rakefile',
    'ext/mygem/lib2/Rakefile'
  ]

Lib1 gets compiled, but nothing is ran for lib2. If I swap them, lib2 gets compiled but not lib1.

Would that be a bug in rubygems? Or does the rake task has to return or do something special?

frahugo commented 11 years ago

Oh by the way, I tried with extconf.rb for both libraries and it builds them both.

ghost commented 11 years ago

Take ffi-compiler out of the equation - e.g. just have the Rakefile for each of those projects create a file, and see if that works.

frahugo commented 11 years ago

Well, I can confirm that it has nothing to do with ffi-compiler. This is the content of my two Rake files:

desc "do something"
task :default do
  `echo "ET phone home" > anyonethere.txt`
end

And only the first one runs and creates a TXT file.

Question: is there any advantage in using a Rakefile instead of a standard extconf.rb with mkmf?

ghost commented 11 years ago

The advantages of using a Rakefile vs extconf.rb are minor: extconf.rb must generate a Makefile - that means you have to deal with the vagaries of a multitude of make implementations - with a Rakefile, you only need to deal with Rake.

Anyway, it looks like the problem you've hit is with rubygems - you can report it to them, but in the mean time, you will have to work around it by having an intermediate Rakefile that then calls rake on each of your other Rakefiles.