[BUILD] ruby-1.8.2p2 failing to build gdbm, iconv

I am building ruby-1.8.2p2 under FreeBSD-5.2.1, but I am unable to get the
gdbm and iconv modules built. I have gdbm-1.8.3 and libiconv-1.9.1 installed
from ports. This is what I'm doing:

  export LDFLAGS="-L/usr/local/lib"
  export CPPFLAGS="-I/usr/local/include"
  ./configure
  make

However, the modules iconv and gdbm are skipped over. ext/gdbm/mkmf.log and
ext/iconv/mkmf.log are attached.

As far as I can see:

- gdbm is skipped because -L/usr/local/lib is missing from the command line
  it passes to gcc when testing for its existence (although
  -I/usr/local/linclude *is* passed in).

- iconv is skipped for a similar reason, although it first tries to call
  iconv() with the wrong set of arguments.

rbconfig.rb contains these two lines:

  CONFIG["LDFLAGS"] = "-L/usr/local/lib -rdynamic"
  CONFIG["configure_args"] = " 'CPPFLAGS=-I/usr/local/include' 'LDFLAGS=-L/usr/local/lib'"

so I think my LDFLAGS setting was picked up OK.

Is this a bug in mkmf? Or is there something else I need to do to make these
modules compile?

Thanks...

Brian Candler.

mkmf.log (968 Bytes)

mkmf.log (1.73 KB)

But strangely, after I've built and installed ruby if I then do "ruby
extconf.rb" and "make" in those directories, then it builds them!

$ ./configure LDFLAGS="-L/usr/local/lib" CPPFLAGS="-I/usr/local/include"
...
$ make
...
$ cd ext/gdbm
$ grep "checking for" mkmf.log
have_library: checking for gdbm_open() in -lgdbm... -------------------- no
$ ruby extconf.rb
checking for gdbm_open() in -lgdbm... yes
checking for gdbm.h... yes
creating Makefile
$ make
...
$ ls -l gdbm.so
-rwxr-xr-x 1 brian brian 22649 Oct 21 18:03 gdbm.so
$ cd ../iconv
$ grep "checking for" mkmf.log
have_func: checking for iconv()... -------------------- no
have_library: checking for iconv() in -liconv... -------------------- no
$ ruby extconf.rb
checking for iconv()... no
checking for iconv() in -liconv... yes
checking for const of iconv() 2nd argument... yes
creating Makefile
$ ls -l iconv.so
-rwxr-xr-x 1 brian brian 16915 Oct 21 18:04 iconv.so

Hmm, so why doesn't that work when building Ruby in the first place?

Regards,

Brian.

···

On Thu, Oct 21, 2004 at 05:48:31PM +0100, Brian Candler wrote:

I am building ruby-1.8.2p2 under FreeBSD-5.2.1, but I am unable to get the
gdbm and iconv modules built. I have gdbm-1.8.3 and libiconv-1.9.1 installed
from ports. This is what I'm doing:

  export LDFLAGS="-L/usr/local/lib"
  export CPPFLAGS="-I/usr/local/include"
  ./configure
  make

However, the modules iconv and gdbm are skipped over. ext/gdbm/mkmf.log and
ext/iconv/mkmf.log are attached.