Compiling C extensions in dep_selector Ruby gem with Rake on FreeBSD
I am trying to install Ruby gem: dep_gecode
. It compiles some C extensions, but the compilation fails because the cpp compiler isn't run with properly set include folders.
When I run rake install
it automatically creates a Makefile from extconf.rb
to compile the extensions. When I edit the Makefile and manually add flag -I/usr/local/include
the compilation of the extensions succeeds. But when I re-run rake install
the Makefile gets overwritten and compilation fails again. Obviously I need to fix extconf.rb
but I don't quite know how.
Now a bit more details. The source for dep_gecode
gem is here:
https://github.com/opscode/dep-selector
The extconf.rb
file that needs to be changed is here:
https://github.com/opscode/dep-selector/blob/master/ext/dep_gecode/extconf.rb
What I want to change in the generated Makefile is this line:
CPPFLAGS = -I/usr/include -I/usr/include -I/usr/local/include
instead of this one, which is being generated at this moment:
CPPFLAGS = -I开发者_JS百科/usr/include -I/usr/include
As you see, the include path /usr/local/include
is missing. This is a standard include path on FreeBSD systems, which suggests that the problem may be with Rake, not with this particular extconf.rb
file.
Any help greatly appreciated.
Edit: I've just found a workaround. It is enough to add this line to extconf.rb
to have that folder properly appearing in the generated Makefile
:
$CPPFLAGS << "-I/usr/local/include"
Not sure if this would be the right way of dealing with this problem though...
精彩评论