Questions tagged [extconf.rb]
27 questions
5
votes
2 answers
When developing a rubygem with C extensions, how do you test locally with Rspec?
I'm writing a gem, that includes a C extension. Usually when I write a gem, I follow a process of TDD, where I'll write a failing spec and then work on the code until it passes, etc etc...
With my C extension in "ext/mygem/mygem.c" and a valid…

d11wtq
- 34,788
- 19
- 120
- 195
5
votes
5 answers
How do I make Ruby Gems installations on Windows use MinGW for making and compiling?
Trying to update some gems on a Windows machine and I continually get this error output for gems that do not have pre-compiled binaries:
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
…

Yardboy
- 2,777
- 1
- 23
- 29
4
votes
1 answer
Error installing Ruby on Rails in Mavericks
I've tried multiple solutions offered on similar question posted here but nothing seems to work. I can't install Rails. Error message is below. Also, Wwen I try to install Xcode by using xcode-select --install, it give me an installation o network…

Diversify1281
- 43
- 1
- 3
3
votes
1 answer
Require boost::dynamic_bitset<> in extconf.rb
I am in the process of releasing my Ruby C/C++ extension and try to make sure that all libraries required are listed in extconf.rb. I have not been able to figure out how to require the boost library and especially the dynamic_bitset<> class.
What I…

halfdan
- 33,545
- 8
- 78
- 87
3
votes
1 answer
Link a D library to Ruby
I would like to call D code from Ruby. I have tried to compile the D code with dmd and use extconf.rb to make a shared object file which I could use in ruby, but my linking fails somehow, the D std library is apparently missing:
hello.rb:1:in…

Niels Tolstrup
- 457
- 4
- 12
3
votes
1 answer
Packaging Compiled Binary /w a Ruby Gem
I am creating a small daemon, written in Ruby, which relies in part on a small binary utility compiled from C code. I want to package this as a gem and include this dependency along with it.
Essentially, this daemon will need to run commands such…

mikegreiling
- 1,160
- 12
- 21
3
votes
2 answers
How to Statically Link External Libraries when Compiling a Ruby C Extension
I am building a Ruby C Extension on Windows which requires some external C libraries, specifically libcurl and its dependancies. I have the curllib dll's and .a files. However when I build with extconf.rb it always links the libraries dynamically…

Robin
- 686
- 1
- 9
- 18
2
votes
0 answers
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…

Greg
- 8,230
- 5
- 38
- 53
2
votes
3 answers
ruby native extension: undefined symbol
I'm attempting to create a ruby native extension, but when I run rake which uses ext/example_project/extconf.rb to build my project and run my tests under test/, I get the following error when the tests are…

JesseBuesking
- 6,496
- 4
- 44
- 89
2
votes
2 answers
How would I instruct extconf.rb to use additional g++ optimization flags, and which are advisable?
I'm using Rice to write a C++ extension for a Ruby gem. The extension is in the form of a shared object (.so) file.
This requires 'mkmf-rice' instead of 'mkmf', but the two (AFAIK) are pretty similar.
By default, the compiler uses the flags -g -O2.…

Translunar
- 3,739
- 33
- 55
2
votes
1 answer
extconf.rb how to define the sources files to use
I have a little projet of a ruby extension which was organized like this :
./
Rakefile
ext/
mymodule/
extconf.rb
mymodule.rb
mymodule.cpp
source1.h
source1.cpp
source2.h
source2.cpp
Everything…

cedlemo
- 3,205
- 3
- 32
- 50
2
votes
1 answer
extconf.rb: How do I generate makefile targets dependent upon header file changes?
In my extconf.rb, I have
$srcs = %w{foo.cpp bar.cpp}
$objs = %w{foo bar}
Each of these is dependent upon multiple header files. If I touch foo.cpp or touch bar.cpp, and then do rake compile, it recompiles the appropriate object file.
But touching…

Translunar
- 3,739
- 33
- 55
2
votes
2 answers
What is the correct usage of have_func when the test function needs arguments?
I have an extconf.rb with the following lines:
have_header("cblas.h") # checking for cblas.h... yes
have_func("cblas_dgemm", ["cblas.h"]) # checking for cblas_dgemm() in cblas.h... no
create_header("nmatrix_config.h") #…

Translunar
- 3,739
- 33
- 55
1
vote
1 answer
Using mkmf with Ruby ext Linking a Static Library with -L and -I and -l
Given a simple gcc command that follows as:
gcc quickrb.c -o main -L /usr/local/lib/quickjs -I /usr/local/lib/quickjs -l quickjs
I'm attempting to wrap this inside of a ruby gem extension extconf.rb using mkmf. Currently I've got:
require…

Kevin Sylvestre
- 37,288
- 33
- 152
- 232
1
vote
1 answer
Simple Ruby C extension cannot find ruby.h
I wrote an incredibly simple C extension for Ruby. Unfortunately, it can't find ruby.h.
Here is the extconf.rb:
require "mkmf"
$srcs = %w{hypergeometric.c}
$objs = %w{hypergeometric}
create_makefile("hypergeometric")
And here is the only source…

Translunar
- 3,739
- 33
- 55