Hi,
The error turned out to be deceptively simple. extconf.rb fails to find
iconv() in -liconv, though it is there.
Any idea why extconf.rb thinks iconv() isn’t in -liconv, and why on earth does
it both ignore the fact that it can’t find iconv(), and then disables the
linker’s warning that it couldn’t find iconv()?
It first fails to find iconv in libiconv.a:
[ensemble] ~/p/ruby/download/iconv-0.5 $ ruby extconf.rb
Try `ruby extconf.rb --iconv-dir=/usr/local’.
checking for iconv.h… yes
checking for iconv() in -liconv… no
checking for rb_obj_freeze()… yes
checking for rb_block_given_p()… yes
checking for rb_str_buf_new()… no
creating Makefile
Note that it found /usr/local/include/iconv.h, but failed to find iconv(), and
yet still created the Makefile. Why?
Some platforms don’t need any additional libraries to use
iconv(), because they have it in libc.
Rather, I’m curious why extconf.rb finds iconv.h in
/usr/local/include.
···
At Sun, 13 Apr 2003 12:24:53 +0900, Sam Roberts wrote:
–
Nobu Nakada
Quoteing nobu.nokada@softhome.net, on Sun, Apr 13, 2003 at 02:15:54PM +0900:
Note that it found /usr/local/include/iconv.h, but failed to find iconv(), and
yet still created the Makefile. Why?
Some platforms don’t need any additional libraries to use
iconv(), because they have it in libc.
Sure, but isn’t that what extconf.rb is checking, whether you need
-liconv?
Rather, I’m curious why extconf.rb finds iconv.h in
/usr/local/include.
/usr/local is in the default include and lib paths on OS X, it seems.
Anynow, I went back to having my iconv installed in /sw (kind of the
/opt of the OS X world). It allows iconv.h to be found, but the
extconf.rb still isn’t figuring out that it needs -liconv, but it works
when I specify -liconv in the USER_LIBS.
Cheers,
Sam
[ensemble] ~/p/ruby/download/iconv-0.5 $ ruby extconf.rb --with-iconv-dir=/sw
checking for iconv.h… yes
checking for iconv() in -liconv… no
checking for rb_obj_freeze()… yes
checking for rb_block_given_p()… yes
checking for rb_str_buf_new()… no
creating Makefile
[ensemble] ~/p/ruby/download/iconv-0.5 $ touch iconv.c; make LOCAL_LIBS=; ruby -I. -r iconv -e Iconv.iconv
gcc -fno-common -g -Os -pipe -no-cpp-precomp -pipe -pipe -no-precomp
-I. -I/usr/lib/ruby/1.6/powerpc-darwin6.0 -I. -I/usr/include
-DHAVE_ICONV_H -DHAVE_RB_OBJ_FREEZE -DHAVE_RB_BLOCK_GIVEN_P
-I/sw/include -c -o iconv.o iconv.c
gcc: unrecognized option -no-precomp' cc1: warning: changing search order for system directory "/usr/include" cc1: warning: as it has already been specified as a non-system directory cc -dynamic -bundle -undefined suppress -flat_namespace -L/sw/lib -L/usr/lib/ruby/1.6/powerpc-darwin6.0 -L/usr/lib -o iconv.bundle iconv.o dyld: ruby Undefined symbols: _libiconv _libiconv_close _libiconv_open Trace/BPT trap [ensemble] ~/p/ruby/download/iconv-0.5 $ touch iconv.c; make LOCAL_LIBS=-liconv; ruby -I. -r iconv -e Iconv.iconv gcc -fno-common -g -Os -pipe -no-cpp-precomp -pipe -pipe -no-precomp -I. -I/usr/lib/ruby/1.6/powerpc-darwin6.0 -I. -I/usr/include -DHAVE_ICONV_H -DHAVE_RB_OBJ_FREEZE -DHAVE_RB_BLOCK_GIVEN_P -I/sw/include -c -o iconv.o iconv.c gcc: unrecognized option
-no-precomp’
cc1: warning: changing search order for system directory “/usr/include”
cc1: warning: as it has already been specified as a non-system
directory
cc -dynamic -bundle -undefined suppress -flat_namespace -L/sw/lib
-L/usr/lib/ruby/1.6/powerpc-darwin6.0 -L/usr/lib -o iconv.bundle
iconv.o -liconv
-e:1:in `iconv’: wrong # of arguments (0 for 2) (ArgumentError)
from -e:1
[ensemble] ~/p/ruby/download/iconv-0.5 $