Problem loading extensions in OSX 10.2.2

I’m a Mac newbie, so I’m struggling a bit here, but there’s a definite
problem loading shared extensions under Mac OSX 10.2.2.

If I run the following

ruby -rsocket -e1

it blows up doing the rb_define_class in Init_socket(). The problem is
that sym_tbl (in parse.y) is apparently 0x0000000. However, tracing
the value in sym_tbl just before the call to Init_socket shows it to
be perfectly valid.

It seems that code in the dynamically loaded object (socket.bundle in
this case) is picking up a different set up global statics, so that
calls from within the shared object are failing.

I know next to nothing about Darwin, but I read that the handling of
shared objects changed between 10.0 and 10.2, with 10.2 supporting two
levels of namespace. I’m wondering if this has anything to do with the
change.

As corroboration, if I link socket.c in to the interpreter statically,
the problem goes away (although I do get warnings about duplicate
symbols when it runs).

I’m happy to do experiments for folks, and I’m continuing some
background research, but if anyone actually knows the Mac it would
probably go a lot quicker if they could have a look at this :slight_smile:

Cheers

Dave

Hi,

···

At Thu, 12 Dec 2002 09:31:39 +0900, Dave Thomas wrote:

I’m a Mac newbie, so I’m struggling a bit here, but there’s a definite
problem loading shared extensions under Mac OSX 10.2.2.

How did you configure ruby, and what CFLAGS?


Nobu Nakada

Which version of Ruby have the problem? In Ruby 1.6.7 installed
with Mac OSX 10.2.2 at least, the problem couldn’t be got.

 $ ruby -rsocket -e1
 $ ruby --version
 ruby 1.6.7 (2002-03-01) [powerpc-darwin6.0]
 $ ruby -r rbconfig -e 'p Config::CONFIG["configure_args"]'
 "--prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info"

I have not tried other version which isn’t installed on my mac yet.

regards,

···

At Thu, 12 Dec 2002 09:31:39 +0900, Dave Thomas wrote:

I’m a Mac newbie, so I’m struggling a bit here, but there’s a definite
problem loading shared extensions under Mac OSX 10.2.2.

If I run the following

ruby -rsocket -e1

it blows up doing the rb_define_class in Init_socket(). The problem is
that sym_tbl (in parse.y) is apparently 0x0000000. However, tracing
the value in sym_tbl just before the call to Init_socket shows it to
be perfectly valid.


FUJIMOTO Hisakuni

If your questions can be generalized, there are some smart folks at
macosx-admin@omnigroup.com

···

On Thursday, 12 December 2002 at 9:31:39 +0900, Dave Thomas wrote:

I’m a Mac newbie, so I’m struggling a bit here, but there’s a definite
problem loading shared extensions under Mac OSX 10.2.2.

I know next to nothing about Darwin, but I read that the handling of
shared objects changed between 10.0 and 10.2, with 10.2 supporting two
levels of namespace. I’m wondering if this has anything to do with the
change.

As corroboration, if I link socket.c in to the interpreter statically,
the problem goes away (although I do get warnings about duplicate
symbols when it runs).

I’m happy to do experiments for folks, and I’m continuing some
background research, but if anyone actually knows the Mac it would
probably go a lot quicker if they could have a look at this :slight_smile:


Jim Freeze

Never commit yourself! Let someone else commit you.

I just did

autoconf
./configure
make
make install

with the 1.7.3 CVS source

···

On Wed, 2002-12-11 at 20:45, nobu.nokada@softhome.net wrote:

Hi,

At Thu, 12 Dec 2002 09:31:39 +0900, > Dave Thomas wrote:

I’m a Mac newbie, so I’m struggling a bit here, but there’s a definite
problem loading shared extensions under Mac OSX 10.2.2.

How did you configure ruby, and what CFLAGS?

Agreed, my 1…7 worked too, but… there were problems with the
networking code. For example, by trivial HTTP timeserver application
worked fine if I telneted in to it, if I invoked it from another Ruby
script, but it locked up when invoked from Explorer. I suspected an IPV6
bug, which is why I embarked on the attempt to upgrade to 1.7.

Cheers

Dave

···

On Wed, 2002-12-11 at 20:47, FUJIMOTO Hisakuni wrote:

At Thu, 12 Dec 2002 09:31:39 +0900, > Dave Thomas wrote:

I’m a Mac newbie, so I’m struggling a bit here, but there’s a definite
problem loading shared extensions under Mac OSX 10.2.2.

If I run the following

ruby -rsocket -e1

it blows up doing the rb_define_class in Init_socket(). The problem is
that sym_tbl (in parse.y) is apparently 0x0000000. However, tracing
the value in sym_tbl just before the call to Init_socket shows it to
be perfectly valid.

Which version of Ruby have the problem? In Ruby 1.6.7 installed
with Mac OSX 10.2.2 at least, the problem couldn’t be got.

Oh man, I’ve been working there for a month - I forgot all about
them! They are definitely some smart folks. Hey, I should bring some of
my questions to them …

Incidentally, I can try duplicating the problem myself. All I know is that
Ruby 1.6.7 and CVS both made it through ./configure && make && make test
with no complaints. I found something about passing ‘–enable-shared’ to
./configure, but didn’t apply it myself.

Still can’t get Ruby to notice the fact that I have Tcl/Tk on the machine,
but that’s a different problem :slight_smile:

-Brian W

Brian Wisti
brian@coolnamehere.com
http://coolnamehere.com/

···

At 12:01 PM 12/12/2002 +0900, you wrote:

If your questions can be generalized, there are some smart folks at
macosx-admin@omnigroup.com


Jim Freeze

Never commit yourself! Let someone else commit you.

Hi,

I just did

autoconf
./configure
make
make install

with the 1.7.3 CVS source

Without --enable-shared? Do you have ruby shared library, and
what’s defined as LIBS in ext/socket/Makefile?

If LIBS has $(LIBRUBYARG_STATIC), try this patch. At first
remove makefiles and shared objects under ext/, and recompile
them.

Index: lib/mkmf.rb

···

At Thu, 12 Dec 2002 13:36:48 +0900, Dave Thomas wrote:

RCS file: /cvs/ruby/src/ruby/lib/mkmf.rb,v
retrieving revision 1.118
diff -u -2 -p -r1.118 mkmf.rb
— lib/mkmf.rb 28 Nov 2002 03:12:23 -0000 1.118
+++ lib/mkmf.rb 12 Dec 2002 06:23:30 -0000
@@ -768,4 +768,5 @@ end

def init_mkmf(config = CONFIG)

  • $enable_shared = config[‘ENABLE_SHARED’] == ‘yes’
    $defs =
    $CFLAGS = with_config(“cflags”, arg_config(“CFLAGS”, config[“CFLAGS”])).dup
    @@ -777,5 +778,5 @@ def init_mkmf(config = CONFIG)
    $OBJEXT = config[“OBJEXT”].dup
    $LIBS = “#{config[‘LIBS’]} #{config[‘DLDLIBS’]}”
  • $LIBRUBYARG = config[‘LIBRUBYARG’]
  • $LIBRUBYARG = $enable_shared ? config[‘LIBRUBYARG’] : “”
    $LIBRUBYARG_STATIC = config[‘LIBRUBYARG_STATIC’]
    $LIBRUBYARG_SHARED = config[‘LIBRUBYARG_SHARED’]
    @@ -784,5 +785,5 @@ def init_mkmf(config = CONFIG)
    $objs = nil
    $libs = “”
  • if config[‘ENABLE_SHARED’] == ‘yes’ or config[“LIBRUBY”] != config[“LIBRUBY_A”]
  • if $enable_shared or config[“LIBRUBY”] != config[“LIBRUBY_A”]
    $LIBPATH = [“$(topdir)”]
    $LIBPATH.unshift(“$(libdir)”) unless $extmk or defined? CROSS_COMPILING


Nobu Nakada

Incidentally, I can try duplicating the problem myself. All I know is that
Ruby 1.6.7 and CVS both made it through ./configure && make && make test
with no complaints. I found something about passing ‘–enable-shared’ to
./configure, but didn’t apply it myself.

Yes, that was what I was trying to remember. I needed --enable-shared.

Still can’t get Ruby to notice the fact that I have Tcl/Tk on the machine,
but that’s a different problem :slight_smile:

Me too, but on Solaris.

···

On Thursday, 12 December 2002 at 14:45:04 +0900, Brian Wisti wrote:

At 12:01 PM 12/12/2002 +0900, you wrote:


Jim Freeze

"What do you give a man who has everything?" the pretty

teenager asked her mother.
“Encouragement, dear,” she replied.

When you run extconf.rb you can give the options

   --with-tcl-dir, --with-tcl-include, --with-tcl-lib
   --with-tk-dir, --with-tk-include, --with-tk-lib
   --with-X11-dir, --with-X11-include, --with-X11-lib

to specify specific directories

Guy Decoux

···

On Thursday, 12 December 2002 at 14:45:04 +0900, Brian Wisti wrote:

At 12:01 PM 12/12/2002 +0900, you wrote:

Still can't get Ruby to notice the fact that I have Tcl/Tk on the machine,
but that's a different problem :slight_smile:

Me too, but on Solaris.

Yes - thank you! --enable-shared fixed it.

I wonder if this should be the default under Darwin (as it doesn’t work
out of the box without it)?

Cheers

Dave

···

On Thu, 2002-12-12 at 00:31, nobu.nokada@softhome.net wrote:

Without --enable-shared? Do you have ruby shared library, and
what’s defined as LIBS in ext/socket/Makefile?

When you run extconf.rb you can give the options

                 ^^^^^^^^^^
                 configure

sorry,

   --with-tcl-dir, --with-tcl-include, --with-tcl-lib
   --with-tk-dir, --with-tk-include, --with-tk-lib
   --with-X11-dir, --with-X11-include, --with-X11-lib

to specify specific directories

Guy Decoux