I was installing libxml-ruby today and got a weird error:
extconf failure: need libm
Hm, ok, libm is supplied by the glibc-devel RPM, which is installed and there it is:
$ ls -l /usr/lib/libm.a -rw-r--r-- 1 root root 449902 Apr 15 2008 /usr/lib/libm.a $ rpm -qf /usr/lib/libm.a glibc-devel-2.3.4-2.41
After flailing around for a bit I start actually looking at libxml-ruby's ext/libxml/extconf.rb. Here's the relevant bit around line 50:
unless have_library('m', 'atan')
# more checks
end
Ok, so, have_library comes from mkmf.rb, and that method does this:
try_func(func, libs, headers, &b)
And what does try_func do? It writes out a small C program that calls that specific function and tries to compile and link it. So that should work unless.... doh, GCC isn't installed! A quick "yum install gcc" and everything works.
I think it took me so long to figure out what was happening because I was expecting a "libxml2-devel not found" kind of error, and if GCC wasn't installed I'd expect to get a "no C compiler found" error. Anyhow, hope this helps someone.
On a completely unrelated note, Ender's Game appears on both the Marine Corps and Navy reading lists. Who knew?
I absolutely concur with this post :)
Just for the sake of easing the trouble to many other users (like me) that have run into similar issues, I would like to add that another 'doh' cause for this issue is not having the 'ruby-devel' package installed.
In my case I was also getting that same absolutely unfriendly error "need libm", but after checking the logs in libxml-ruby-/ext/libxml/mkmf.log I found another error message while testing for atan function: "ruby-static" could not be found. ruby-static lives in ruby-devel package, but it seems extconf never bothers to check that it is actually installed before checking for libm.
Posted by: Leonardo Frittelli | August 25, 2009 at 05:36 AM