[#3986] Re: Principle of least effort -- another Ruby virtue. — Andrew Hunt <andy@...>

> Principle of Least Effort.

14 messages 2000/07/14

[#4043] What are you using Ruby for? — Dave Thomas <Dave@...>

16 messages 2000/07/16

[#4139] Facilitating Ruby self-propagation with the rig-it autopolymorph application. — Conrad Schneiker <schneik@...>

Hi,

11 messages 2000/07/20

[ruby-talk:04194] Debugging extension by statically linking with ruby.exe

From: Robert Feldt <feldt@...>
Date: 2000-07-24 17:08:14 UTC
List: ruby-talk #4194
I'm trying to debug an extension by following the advice in README.EXT.
I'm not being very successfull. Anyone got a more detailed
description/example? Other ways to do it?

Here's some (;-)) of the problems I've encoutered:

* I added my ext dir under ext in ruby source dir, copied my ext there and
created a MANIFEST file. During the build my extconf.rb file is not called
so the proper gcc flags are not used. I worked around this by building my
ext in the dir by hand. How should you do it to make sure that the
extconf.rb supplied in the ext dir is used? See extconf.rb file below.

* I added the name of my ext to ext/Setup (no '#' before!). No problems
here ;-).

* When I build ruby there's a problem in the final stage:

make[1]: Entering directory `/tmp/download/ruby/ruby-1.4.5/ext/AimGp'
ar cru AimGp.a AimGp.o AimGpPredictorCpp.o IntelX86Grammar.o
make[1]: Leaving directory `/tmp/download/ruby/ruby-1.4.5/ext/AimGp'
RUBY_INSTALL_NAME: not found
make[1]: Entering directory `/tmp/download/ruby/ruby-1.4.5'
gcc -g -O2   -L. main.o ext/extinit.o ext/AimGp/AimGp.a  -lruby -l  -o
ruby.exe
/usr/lib/gcc-lib/i686-pc-cygwin/2.95.2/../../../../i686-pc-cygwin/bin/ld:
cann ot find -l--library=gcc
collect2: ld returned 1 exit status
make[1]: *** [ruby.exe] Error 1

I worked around this by skipping the "empty" -l (problem with
RUBY_INSTALL_NAME in Makefile?):
gcc -g -O2 -L. main.o ext/extinit.o ext/AimGp/AimGp.a -lruby -o ruby.exe

and I finally got the ruby.exe.

* I run "ruby -r debug mytest.rb" with some code to test the ext and try
to step into it but I can't step in there. I have compiled with -g
but I might have missed something similarly obvious since I'm not an
experienced gcc/gdb user.

Any hints greatly appreciated.

Regards,

Robert

-----------------------file extconf.rb---------------------------------
require "mkmf"

srcs = %w(
AimGp
AimGpPredictorCpp
IntelX86Grammar
)

$CFLAGS += " -I/usr/local/lib/ruby/1.4/i686-cygwin -I/usr/local/include
-g"

$objs = srcs.collect{ |src| src+".o" }

create_makefile("AimGp")
-----------------------------------------------------------------------


In This Thread

Prev Next