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

B

Brian Candler

--nFreZHaLTZJo0R7j
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

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.

--nFreZHaLTZJo0R7j
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="mkmf.log"

have_library: checking for gdbm_open() in -lgdbm... -------------------- no

"gcc -o conftest -I/v/build/ruby-1.8.2 -I/v/build/ruby-1.8.2 -I/usr/local/include -g -O2 conftest.c -L"/v/build/ruby-1.8.2" -lruby-static -lgdbm -lcrypt -lm -lc"
/usr/bin/ld: cannot find -lgdbm
checked program was:
/* begin */

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

"gcc -o conftest -I/v/build/ruby-1.8.2 -I/v/build/ruby-1.8.2 -I/usr/local/include -g -O2 conftest.c -L"/v/build/ruby-1.8.2" -lruby-static -lgdbm -lcrypt -lm -lc"
conftest.c: In function `t':
conftest.c:5: error: `gdbm_open' undeclared (first use in this function)
conftest.c:5: error: (Each undeclared identifier is reported only once
conftest.c:5: error: for each function it appears in.)
checked program was:
/* begin */


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

--------------------


--nFreZHaLTZJo0R7j
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="mkmf.log"

have_func: checking for iconv()... -------------------- no

"gcc -o conftest -I/v/build/ruby-1.8.2 -I/v/build/ruby-1.8.2 -I/usr/local/include -g -O2 conftest.c -L"/v/build/ruby-1.8.2" -lruby-static -lcrypt -lm -lc"
conftest.c: In function `t':
conftest.c:5: error: too few arguments to function `libiconv'
checked program was:
/* begin */
#include <iconv.h>

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

"gcc -o conftest -I/v/build/ruby-1.8.2 -I/v/build/ruby-1.8.2 -I/usr/local/include -g -O2 conftest.c -L"/v/build/ruby-1.8.2" -lruby-static -lcrypt -lm -lc"
/var/tmp//ccvG6OM4.o: In function `t':
/v/build/ruby-1.8.2/ext/iconv/conftest.c:6: undefined reference to `libiconv'
checked program was:
/* begin */

#include <iconv.h>

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

--------------------

have_library: checking for iconv() in -liconv... -------------------- no

"gcc -o conftest -I/v/build/ruby-1.8.2 -I/v/build/ruby-1.8.2 -I/usr/local/include -g -O2 conftest.c -L"/v/build/ruby-1.8.2" -lruby-static -liconv -lcrypt -lm -lc"
conftest.c: In function `t':
conftest.c:4: error: too few arguments to function `libiconv'
checked program was:
/* begin */
#include <iconv.h>
/*top*/
int main() { return 0; }
int t() { iconv(); return 0; }
/* end */

"gcc -o conftest -I/v/build/ruby-1.8.2 -I/v/build/ruby-1.8.2 -I/usr/local/include -g -O2 conftest.c -L"/v/build/ruby-1.8.2" -lruby-static -liconv -lcrypt -lm -lc"
/usr/bin/ld: cannot find -liconv
checked program was:
/* begin */

#include <iconv.h>
/*top*/
int main() { return 0; }
int t() { void ((*volatile p)()); p = (void ((*)()))iconv; return 0; }
/* end */
 
B

Brian Candler

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.

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,998
Messages
2,570,242
Members
46,835
Latest member
lila30

Latest Threads

Top