[Buildroot] [PATCH] ruby: bump version to 2.4.0

Peter Korsgaard peter at korsgaard.com
Mon Jan 30 09:18:39 UTC 2017


>>>>> "Waldemar" == Waldemar Brodkorb <wbx at openadk.org> writes:

Hi,

 >> apparantly configure has problems detecting math functions of uClibc:

 > Because configure checks for functions, but isfinite, isinf and isnan
 > are implemented as macros. For Dragonfly they explicitely set
 > isinf/isnan as available:
 > https://github.com/ruby/ruby/blob/trunk/configure.in#L1278

 > Shouldn't this be reported upstream?
 > I think this is an autotool detection bug.

 >> although uClibc supports these functions.

 > finite seems obsoleted and isfinite should be used. 

 > It appears musl implements finite as function for backward compatibility.
 > Therefore the check does not fail for musl toolchains.
 > https://git.musl-libc.org/cgit/musl/tree/src/math/finite.c

 > For glibc the check fails and the replacement functions for
 > finite, isinf and isnan are used.

 > For uclibc-ng the check fails, but the replacement functions cannot
 > be used, because finite is already defined as macro for backward
 > compatibility. (added a while ago for inetd..)

Indeed, finite is a function on musl. On my glibc version they are also
(weakly) defined (and configure correctly finds them):

nm -D /lib/x86_64-linux-gnu/libc.so.6|grep -wE 'finite|isinf|isnan'
0000000000032310 W finite
00000000000322a0 W isinf
00000000000322e0 W isnan

I'm not sure what the spec (if any exists) for these legacy BSD
functions say about if the unprefixed symbols really need to be
available, but it is certainly a difference between uClibc-ng and
glibc/musl.

 >> Hacking ruby.mk like this
 >> 
 >> RUBY_CONF_ENV += \
 >> ac_cv_func_finite=yes \
 >> ac_cv_func_isinf=yes \
 >> ac_cv_func_isnan=yes
 >> endif

 > I think this is the best thing todo inside buildroot.

Yes, that might be the way to go. Notice that musl implements isinf /
isnan as macros, so the detection fails. The reason why it doesn't cause
linker errors is that include/ruby/missing.h checks if isnan is a macro
before providing a local declaration:

#ifndef isnan
# ifndef HAVE_ISNAN
RUBY_EXTERN int isnan(double);
# endif
#endif

vs:

#ifndef HAVE_FINITE
RUBY_EXTERN int finite(double);
#endif

So another solution is to add an #ifndef finite around it. That fix
could probably be upstreamed as they already do it for a number of other
functions.

-- 
Bye, Peter Korsgaard



More information about the buildroot mailing list