Mkmf questions

I'm having a tough time getting libxml to compile on an amd64 machine. Compiling the same library on a 32 bit machine was simple - no brains involved at all:
in the appropriate directory: ruby extconf.rb
make
make install

Everything works great.

Over on the amd64 machine, I'm having all kinds of trouble. It always fails with this message:

checking for atan() in -lm... no
  extconf failure: need libm

The libm.a and libm.so files are in the /usr/lib64 directory. I've put symbolic links in /usr/lib to these files, to make things appear the same as on the 32 bit setup, but this has no effect. I've tired all sorts of combinations of --with-libm-dir or --with-libm-lib and hacking the extconf.rb file to have a dir_config('libm') line, but with no luck. Below, I've included the relevant part from the mkmf.log file, where it fails trying to find the libm library. Can anyone enlighten me and tell me what I'm doing wrong?

----------------------- start mkmf.log section -------------------

have_library: checking for atan() in -lm... -------------------- no

"gcc -o conftest -I/home/matt/software/ruby/libxml-ruby -I/usr/local/lib/ruby/1.8/x86_64-linux -I/usr/lib64/include -g -O2 conftest.c -L'/usr/lib64/lib' -Wl,-R'/usr/lib64/lib' -L'/usr/local/lib' -Wl,-R'/usr/local/lib' -L'/usr/local/lib' -Wl,-R'/usr/local/lib' -rdynamic -Wl,-export-dynamic -lnsl -lruby-static -lm -lnsl -ldl -lcrypt -lm -lc"
conftest.c: In function `t':
conftest.c:4: error: too few arguments to function `atan'
checked program was:
/* begin */

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

"gcc -o conftest -I/home/matt/software/ruby/libxml-ruby -I/usr/local/lib/ruby/1.8/x86_64-linux -I/usr/lib64/include -g -O2 conftest.c -L'/usr/lib64/lib' -Wl,-R'/usr/lib64/lib' -L'/usr/local/lib' -Wl,-R'/usr/local/lib' -L'/usr/local/lib' -Wl,-R'/usr/local/lib' -rdynamic -Wl,-export-dynamic -lnsl -lruby-static -lm -lnsl -ldl -lcrypt -lm -lc"
conftest.c: In function `t':
conftest.c:5: error: `atan' 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 ((*)()))atan; return 0; }
/* end */

--------------------------- end mkmf.log section -----------------------

Hi,

At Sat, 16 Apr 2005 01:50:24 +0900,
Matthew Thill wrote in [ruby-talk:138371]:

have_library: checking for atan() in -lm... -------------------- no

"gcc -o conftest -I/home/matt/software/ruby/libxml-ruby
-I/usr/local/lib/ruby/1.8/x86_64-linux -I/usr/lib64/include -g -O2
conftest.c -L'/usr/lib64/lib' -Wl,-R'/usr/lib64/lib' -L'/usr/local/lib'
-Wl,-R'/usr/local/lib' -L'/usr/local/lib' -Wl,-R'/usr/local/lib'
-rdynamic -Wl,-export-dynamic -lnsl -lruby-static -lm -lnsl -ldl
-lcrypt -lm -lc"
conftest.c: In function `t':
conftest.c:4: error: too few arguments to function `atan'

Seems atan() is defined as a macro. Try changing atan in
have_library to other math function. Or, to

  macro_defined?("atan", "") or have_library("m", "atan")

···

--
Nobu Nakada