Questions tagged [mkmf]
21 questions
8
votes
2 answers
mkmf ignores files in sub-folders when it compiles the C extension
I'd like to organize the C source code like this:
+ /
|
|___ + ext
| |
| |___ + native_extension
| |
| |___ + lib
| | |
| | |___ (Source files are kept in here - may contain sub-folders)
| |
| …

Matheus Moreira
- 17,106
- 3
- 68
- 107
6
votes
5 answers
Error installing gem failed to build gem native extensions -- cannot load such file -- mkmf
RoR is nice, but sometimes makes me want to bang my head against the wall (and it's probably my fault anyway). I'm simply trying to install the Thin web-client gem, and when I run sudo gem install thin, I get the following error (it requires the…

MandM
- 3,293
- 4
- 34
- 56
3
votes
1 answer
How to link to external c library with ruby's mkmf?
I have the following files in this directory:
~/test/lib/liblost.dylib
~/test/include/lost.h
I am trying to let my rubygem determine if the above library exists by doing the following in irb:
ruby-1.9.2-p290 :008 > dir_config('','~/test')
=>…

Coderama
- 11,050
- 12
- 44
- 58
2
votes
1 answer
Multiple errors while trying install ruby on rails through an ubuntu WSL terminal
Im currently using a fresh install of ubuntu 18.04.2 LTS through windows subsystem for linux. I installed ruby using
sudo apt-get install ruby2.5-dev
and I'm trying to install rails by using
gem install rails -v 5.2.3
which gives me a…

HeyItsGwen
- 55
- 1
- 7
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
2 answers
Where is the mkmf.log file located on os x mavericks using rbenv
I am running OS X Mavericks and using rbenv for managing my ruby versions. For ruby version 1.9.3-p448 for instance, where would the file mkmf.log be located?

wuliwong
- 4,238
- 9
- 41
- 69
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
2
votes
1 answer
Missing libstdc++ during gem install id3lib-ruby
I'm trying to install id3lib-ruby, but I'm getting this error:
Building native extensions. This could take a while...
ERROR: Error installing id3lib-ruby:
ERROR: Failed to build gem native extension.
…

Robert Fischer
- 1,436
- 12
- 26
1
vote
0 answers
Specify C and C++ compiler paths when building Ruby gem
gem allows specifying build arguments, however I can't find a build argument to override the CC and CXX constants in the Makefile generated by mkmf (the defaults appear to come from RbConfig::CONFIG).
How can I specify which compiler to use when…

squirl
- 1,636
- 1
- 16
- 30
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
0 answers
MakeMakefile cannot find headers
I'm writing a C extension for my Ruby Gem. But the behaviour of #find_header is so weird.
# extconf.rb
require 'mkmf'
find_header 'pocketsphinx.h', '/usr/local/include/pocketsphinx'
find_header 'cmd_ln.h',…

Sieg
- 67
- 1
- 9
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
0
votes
1 answer
How to access a shared library file with mkmf in Ruby?
I am trying to work with libcsv here. The header file csv.h is in /usr/include directory, and the shared library file libcsv.so in /usr/lib64 (Fedora 35).
For now, I was able to make the gem file work using the shell command:
gcc -c -fPIC rcsv.c -o…

Ashvith Shetty
- 90
- 2
- 11
0
votes
0 answers
How to modify Makefile parameters with mkmf
I am trying to compile c code using rake compiler in a windows 10 environment. I am having a problem with the paths that the Makefile is generating because they have "/C/ instead of "C:". Mingw that was installed as part of the dev-kit, cannot…

mareiou
- 404
- 2
- 11