Bug #8455

Linking one Ruby extension to another Ruby extension with mkmf

Added by Steve Dierker almost 2 years ago. Updated almost 2 years ago.

ruby -v:ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-linux] Backport:1.9.3: UNKNOWN, 2.0.0: UNKNOWN


The problem lies within 'mkmf' of ruby.
If we have a gem which contains a native extension consisting of two libraries called 'libfail' and 'good' in C/C++ and both of these libraries have Ruby extensions it is not possible to compile and link them against each other without patching 'mkmf.rb'.
A sample git-repository is here: https://github.com/FlavourSys/ruby-native-extension-bug

If we call 'rake compile' it terminates with an error, because 'find_library' of 'mkmf' is not able to link against 'libfail'. The problem is that the 'ruby-static' libraries are added as g++ option before 'libfail' is.

A simple monkey patch is provided in the git repository. The solution is to just change the order of arguments for the compiler.

mkmf.log (4.9 KB) Steve Dierker, 05/28/2013 01:40 AM


#1 Updated by Nobuyoshi Nakada almost 2 years ago

  • Status changed from Open to Rejected

It's a known limitation.
Reference between dynamically loaded libraries is not portable.

Also available in: Atom PDF