Project

General

Profile

Actions

Backport #3824

closed

rbconfig.rb generated by cross-compilation do provide correct path for link process

Added by luislavena (Luis Lavena) over 13 years ago. Updated almost 13 years ago.


Description

=begin
Hello,

I'm trying to cross-compile Ruby 1_8_7 branch using i686-w64-mingw32 (mingw-w64 project). I've managed successfully to cross-compile and install using patches provided in #2531, #3666 and #3822.

However, I've now encountered a problem. mkmf is confused about the location of msvcrt-ruby18 shared library to link to:


 $ ruby -I/Users/luis/Portile/i686-w64-mingw32/apps/ruby/1.8.7-head/lib/ruby/1.8:/Users/luis/Portile/i686-w64-mingw32/apps/ruby/1.8.7-head/lib/ruby/1.8/i386-mingw32 -rfake ../../../../ext/my_ext/extconf.rb
 

fake.rb is a simplified version of the one generated by Makefile.

Find attached both the generated Makefile and the fake.rb used by me.

The extension is a simple one, which just puts something to stdout.
=end


Files

Makefile (3.8 KB) Makefile luislavena (Luis Lavena), 09/13/2010 07:10 AM
fake.rb (699 Bytes) fake.rb luislavena (Luis Lavena), 09/13/2010 07:10 AM
Actions #1

Updated by luislavena (Luis Lavena) over 13 years ago

=begin
Forgot to include the output error from make:

$ make
 i686-w64-mingw32-gcc -I. -I/Users/luis/Portile/i686-w64-mingw32/apps/ruby/1.8.7-head/lib/ruby/1.8/i386-mingw32 -I/Users/luis/Portile/i686-w64-mingw32/apps/ruby/1.8.7-head/lib/ruby/1.8/i386-mingw32 -I../../../../ext/my_ext   -g -O2    -c ../../../../ext/my_ext/my_ext.c
 i686-w64-mingw32-gcc -shared -s -o my_ext.so my_ext.o -L. -L.  -Wl,--enable-auto-image-base,--enable-auto-import,--export-all   -lmsvcrt-ruby18  -lshell32 -lws2_32  
 /Users/luis/mingw/w32/bin/../lib/gcc/i686-w64-mingw32/4.5.1/../../../../i686-w64-mingw32/bin/ld: cannot find -lmsvcrt-ruby18
 collect2: ld returned 1 exit status
 make: *** [my_ext.so] Error 1
 

=end

Actions #2

Updated by luislavena (Luis Lavena) over 13 years ago

  • Category set to lib
  • Assignee set to nobu (Nobuyoshi Nakada)

=begin
Hello,

I believe I had pinpoint the root of these issues to the definition of CROSS_COMPILING by my fake.rb (used outside ruby build process).

Inspecting to mkmf.rb, around line 1713:

$DEFLIBPATH = $extmk ? ["$(topdir)"] : CROSS_COMPILING ? [] : ["$(libdir)"]

DEFLIBPATH is empty if CROSS_COMPILING is detected.

I went ahead and removed that specific check:

$DEFLIBPATH = $extmk ? ["$(topdir)"] : ["$(libdir)"]

And both ruby bundled extensions compiled successfully and this allow me keep CROSS_COMPILING detection in my fake.rb file.

The following patch correct the issue in ruby_1_8_7 branch, but I'm not aware of any other complication in relation to this.

Thank you.

diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index 416292d..733cf86 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -1710,7 +1710,7 @@ def init_mkmf(config = CONFIG)
$LIBRUBYARG = ""
$LIBRUBYARG_STATIC = config['LIBRUBYARG_STATIC']
$LIBRUBYARG_SHARED = config['LIBRUBYARG_SHARED']

  • $DEFLIBPATH = $extmk ? ["$(topdir)"] : CROSS_COMPILING ? [] : ["$(libdir)"]
  • $DEFLIBPATH = $extmk ? ["$(topdir)"] : ["$(libdir)"]
    $DEFLIBPATH.unshift(".")
    $LIBPATH = []
    $INSTALLFILES = []

=end

Actions #3

Updated by nobu (Nobuyoshi Nakada) over 13 years ago

  • Assignee changed from nobu (Nobuyoshi Nakada) to shyouhei (Shyouhei Urabe)

=begin
It seems r23240, right?
=end

Actions #4

Updated by luislavena (Luis Lavena) over 13 years ago

=begin
Correct, r23240 is the commit that should be backported into ruby_1_8_7.

Thank you.
=end

Actions #5

Updated by shyouhei (Shyouhei Urabe) over 13 years ago

=begin
I see, I'll make sure.
=end

Actions #6

Updated by shyouhei (Shyouhei Urabe) about 13 years ago

  • Status changed from Open to Closed
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0