YAML on solaris: problem with libiconv

I’m trying to use yamlrb-0.49.2, with ruby 1.7.3 (2002-12-20) on solaris
7. Even the most basic uses fail:

$ ruby -r yaml -e ‘1.to_yaml’
/usr/path/lib/ruby/site_ruby/1.7/sparc-solaris2.7/iconv.so: warning:
defining Iconv.allocate is deprecated; use rb_define_alloc_func()
ld.so.1: ruby: fatal: relocation error: file
/usr/path/lib/ruby/site_ruby/1.7/sparc-solaris2.7/iconv.so: symbol
libiconv_open: referenced symbol not found
Killed

This is after installing a fresh copy of libiconv (1.8), and the
reinstalling ruby. I’ve checked my LD_LIBRARY_PATH, and it does include
dirs containing:

libiconv.so libiconv.so.2.1.0
libiconv.la libiconv.so.2 libiconv_plug.so

What am I missing?

Hi,

/usr/path/lib/ruby/site_ruby/1.7/sparc-solaris2.7/iconv.so: warning:
defining Iconv.allocate is deprecated; use rb_define_alloc_func()

Update ruby to get rid of this warning.

ld.so.1: ruby: fatal: relocation error: file
/usr/path/lib/ruby/site_ruby/1.7/sparc-solaris2.7/iconv.so: symbol
libiconv_open: referenced symbol not found
Killed

What does “ldd /usr/path/lib/ruby/site_ruby/1.7/sparc-solaris2.7/iconv.so”
produce?

···

At Mon, 10 Mar 2003 15:15:39 +0900, Joel VanderWerf wrote:


Nobu Nakada

Hi,

I’m trying to use yamlrb-0.49.2, with ruby 1.7.3 (2002-12-20) on
solaris 7. Even the most basic uses fail:

$ ruby -r yaml -e ‘1.to_yaml’
/usr/path/lib/ruby/site_ruby/1.7/sparc-solaris2.7/iconv.so: warning:
defining Iconv.allocate is deprecated; use rb_define_alloc_func()

Well, ext/iconv/iconv.c was modified at 2002-12-20, but your SO
doen’t seem up-to-date.

revision 1.5
date: 2002/12/20 11:23:40; author: nobu; state: Exp; lines: +3 -3

  • ext/curses/curses.c, ext/digest/digest.c, ext/dl/handle.c,
    ext/dl/ptr.c, ext/dl/sym.c, ext/gdbm/gdbm.c, ext/iconv/iconv.c,
    ext/stringio/stringio.c, ext/strscan/strscan.c,
    ext/tcltklib/tcltklib.c, ext/win32ole/win32ole.c:
    use rb_define_alloc_func().

This is after installing a fresh copy of libiconv (1.8), and the
reinstalling ruby. I’ve checked my LD_LIBRARY_PATH, and it does
include dirs containing:

Check if the iconv.so is really updated and linked with new
libiconv.so.

···

At Mon, 10 Mar 2003 15:15:39 +0900, Joel VanderWerf wrote:


Nobu Nakada

libdl.so.1 => /usr/lib/libdl.so.1
libcrypt_i.so.1 => /usr/lib/libcrypt_i.so.1
libm.so.1 => /usr/lib/libm.so.1
libc.so.1 => /usr/lib/libc.so.1
libgen.so.1 => /usr/lib/libgen.so.1
/usr/platform/SUNW,Ultra-Enterprise/lib/libc_psr.so.1

···

nobu.nokada@softhome.net wrote:

ld.so.1: ruby: fatal: relocation error: file
/usr/path/lib/ruby/site_ruby/1.7/sparc-solaris2.7/iconv.so: symbol
libiconv_open: referenced symbol not found
Killed

What does “ldd /usr/path/lib/ruby/site_ruby/1.7/sparc-solaris2.7/iconv.so”
produce?

I tried building iconv.so (ver 1.5 from RAA) from scratch, but that
didn’t help. It’s probably not relevant but there was a warning:

iconv.c: In function iconv_try': iconv.c:187: warning: passing arg 2 of libiconv’ from incompatible
pointer type

I tried ldd ./iconv.so in the source dir:

     libdl.so.1 =>    /usr/lib/libdl.so.1
     libcrypt_i.so.1 =>       /usr/lib/libcrypt_i.so.1
     libm.so.1 =>     /usr/lib/libm.so.1
     libc.so.1 =>     /usr/lib/libc.so.1
     libgen.so.1 =>   /usr/lib/libgen.so.1
     /usr/platform/SUNW,Ultra-Enterprise/lib/libc_psr.so.1

I’m a little surprised not to see libiconv here…

···

nobu.nokada@softhome.net wrote:

This is after installing a fresh copy of libiconv (1.8), and the
reinstalling ruby. I’ve checked my LD_LIBRARY_PATH, and it does
include dirs containing:

Check if the iconv.so is really updated and linked with new
libiconv.so.

Hi,

This is after installing a fresh copy of libiconv (1.8), and the
reinstalling ruby. I’ve checked my LD_LIBRARY_PATH, and it does
include dirs containing:
Check if the iconv.so is really updated and linked with new
libiconv.so.

I tried building iconv.so (ver 1.5 from RAA) from scratch, but that
didn’t help. It’s probably not relevant but there was a warning:

iconv.c: In function iconv_try': iconv.c:187: warning: passing arg 2 of libiconv’ from incompatible
pointer type

Don’t mind about this warning, just because of const qualifier
for 2nd parameter of iconv() varies per platforms.

I tried ldd ./iconv.so in the source dir:

     libdl.so.1 =>    /usr/lib/libdl.so.1
     libcrypt_i.so.1 =>       /usr/lib/libcrypt_i.so.1
     libm.so.1 =>     /usr/lib/libm.so.1
     libc.so.1 =>     /usr/lib/libc.so.1
     libgen.so.1 =>   /usr/lib/libgen.so.1
     /usr/platform/SUNW,Ultra-Enterprise/lib/libc_psr.so.1

I’m a little surprised not to see libiconv here…

Me too. What commands to compile/link, and the content of
mkmf.log?

···

At Tue, 11 Mar 2003 03:40:22 +0900, Joel VanderWerf wrote:


Nobu Nakada

Hi,

I tried ldd ./iconv.so in the source dir:

    libdl.so.1 =>    /usr/lib/libdl.so.1
    libcrypt_i.so.1 =>       /usr/lib/libcrypt_i.so.1
    libm.so.1 =>     /usr/lib/libm.so.1
    libc.so.1 =>     /usr/lib/libc.so.1
    libgen.so.1 =>   /usr/lib/libgen.so.1
    /usr/platform/SUNW,Ultra-Enterprise/lib/libc_psr.so.1

I’m a little surprised not to see libiconv here…

Me too. What commands to compile/link, and the content of
mkmf.log?

Just ./extconf.rb; make

Now that I look at it (duh!), the output of extconf.rb seems to be
trying to tell me there is a problem:

···

nobu.nokada@softhome.net wrote:

At Tue, 11 Mar 2003 03:40:22 +0900, > Joel VanderWerf wrote:

==============
checking for iconv.h… yes
checking for iconv() in -liconv… no
checking for rb_obj_freeze()… no
checking for rb_block_given_p()… no
checking for rb_str_buf_new()… no
creating Makefile

The output of make is:

===============
gcc -fPIC -I/usr/path/include -I.
-I/usr/path/lib/ruby/1.7/sparc-solaris2.7
-I/usr/path/lib/ruby/1.7/sparc-solaris2.7 -I. -DHAVE_ICONV_H
-I/usr/path/include -DHAVE_OBJECT_ALLOCATE -c iconv.c
iconv.c: In function iconv_try': iconv.c:187: warning: passing arg 2 of libiconv’ from incompatible
pointer typegcc -Wl,-G -shared -Wl,-E -o iconv.so iconv.o -ldl
-lcrypt -lm -lc

This is the part of mkmf.log that seems to be related to iconv:

================
have_header: checking for iconv.h…
gcc -E -I/usr/path/lib/ruby/1.7/sparc-solaris2.7
-I/usr/path/lib/ruby/1.7/sparc-solaris2.7 -I/usr/path/include
-I/usr/path/include -o conftest.i conftest.c
checked program was:
/* begin /
#include <iconv.h>
/
end */

have_library: checking for iconv() in -liconv…
gcc -o conftest -I/usr/path/lib/ruby/1.7/sparc-solaris2.7
-I/usr/path/lib/ruby/1.7/sparc-solaris2.7 -I/usr/path/include
-I/usr/path/include conftest.c -Wl,-E -lruby-static -liconv -ldl -lcrypt
-lm -lc
/usr/local/sparc-sun-solaris2.6/bin/ld: cannot find -lruby-static
collect2: ld returned 1 exit status
checked program was:
/* begin */

int main() { return 0; }
int t() { iconv(); return 0; }
/* end */

gcc -o conftest -I/usr/path/lib/ruby/1.7/sparc-solaris2.7
-I/usr/path/lib/ruby/1.7/sparc-solaris2.7 -I/usr/path/include
-I/usr/path/include conftest.c -Wl,-E -lruby-static -liconv -ldl -lcrypt
-lm -lc
conftest.c: In function t': conftest.c:4: iconv’ undeclared (first use in this function)
conftest.c:4: (Each undeclared identifier is reported only once
conftest.c:4: for each function it appears in.)
checked program was:
/* begin */

int main() { return 0; }
int t() { void ((volatile p)()); p = (void (()()))iconv; return 0; }
/* end */

Hi,

···

At Tue, 11 Mar 2003 05:33:00 +0900, Joel VanderWerf wrote:

Now that I look at it (duh!), the output of extconf.rb seems to be
trying to tell me there is a problem:

==============
checking for iconv.h… yes
checking for iconv() in -liconv… no
checking for rb_obj_freeze()… no
checking for rb_block_given_p()… no
checking for rb_str_buf_new()… no
creating Makefile

lib/mkmf.rb had some problems in past. Try update.


Nobu Nakada