From: "David S." Date: 2001-01-14T02:47:39+09:00 Subject: [ruby-talk:9249] Problem with C extensions I've installed Ruby 1.6.2 on an OpenBSD 2.8 system, and I'm having a problem with C-based extensions from the Ruby application archive, in particular the zlib, Berkeley DB, and Postgesql ones. I can compile and install them, but when I try to use them (require 'zlib') in irb or a program, the interpreter will crash and dump core. That doesn't happen with pure Ruby extensions, like drb. After some investigation, I found part of the answer. Below is part of the Makefile produced by "ruby extconf.rb --with-pgsql- ..." SHELL = /bin/sh #### Start of system configuration section. #### srcdir = . topdir = /usr/local/lib/ruby/1.6/i386-openbsd2.8 hdrdir = /usr/local/lib/ruby/1.6/i386-openbsd2.8 VPATH = $(srcdir) CC = gcc CFLAGS = -fPIC -g -O2 -fPIC -I/usr/local/pgsql/include CPPFLAGS = -I$(hdrdir) -I/usr/local/include -DHAVE_SYS_UN_H -DHAVE_SOCKET -DHAVE _GETHOSTNAME CXXFLAGS = $(CFLAGS) DLDFLAGS = -L$(topdir) -L/usr/local/lib -L/usr/local/pgsql/lib ^^^^^^^^^^^ Why is this here? Why should C extensions need shared libraries from the ruby library directory? If I build this extension with -L/usr/local/lib/ruby/1.6/i386-openbsd2.8 in DLDFLAGS, the interpreter will dump core when I try to use it. If I remove that field from DLDFLAGS and build it, everything works fine. This mailing list's archive shows someone complained of a similar problem with Ruby and an earlier version of OpenBSD, without any resolution as far as I could tell. There aren't any other similar reports concerning other operating systems in the archive, so I guess it's just an OpenBSD thing. Whether the Ruby developers want to fix this problem. or even feel that it is a problem, ... David S. dgjs@acm.org