|Subject:||isfinite() in DateTime.xs causes issues on Android|
Howdy! I apologize in advance -- this isn't the most detailed bug report ever. But to be frank, I've had enough of android's crap for a night :) For whatever reason, even though isfinite() AND __isfinite() are defined in libm.so and they have prototypes in math.h, and even though DateTime.xs compiles cleanly, this fails to work: shell@android:DateTime-1.06-2ca7HG # perl -Mblib -MDateTime -e1 Can't load '/mnt/asec/home/.cpan/build/DateTime-1.06-2ca7HG/blib/arch/auto/DateTime/PL_DateTime.so' for module DateTime: Cannot load library: reloc_library: 7176 cannot locate '__isfinite'... at -e line 0. Compilation failed in require. BEGIN failed--compilation aborted. As do these... # perl -Iblib/lib -Iblib/arch -MDateTime -e1 # perl -Iblib/lib -Iblib/arch/auto -MDateTime -e1 # perl -I`pwd`/blib/lib -I`pwd`/blib/arch -MDateTime -e1 Bizarrely, this works: # perl -I`pwd`/blib/lib -I`pwd`/blib/arch/auto -MDateTime -e1 ...but these don't: # perl -I`pwd`/blib/lib -I`pwd`/blib/arch -I`pwd`/blib/arch/auto -MDateTime -e1 # perl -I`pwd`/blib/lib -I`pwd`/blib/arch/auto -I`pwd`/blib/arch -MDateTime -e1 If I ignore that and make install, the installed DateTime fails as well. I have no clue why. I want to say that this is the only module where something like this happens, but I haven't installed enough of CPAN to say that for certain. I hypothesize that the problem is that libm is linked to the perl binary/libperl.so, but since perl doesn't use isfinite() anywhere, Android's linker is taking liberties in what it exposes to libraries opened later. After unsuccessfully attempting to blindly fix it in several ways, like trying to link to libm explicitly or skipping the isfinite __isfinite define, I just gave up and added this to my DateTime.xs, right after the ifndef WIN32 bit: #ifdef __ANDROID__ # undef isfinite #endif Which got it to build and test without issues: shell@android:/mnt/asec/home # perl -MDateTime -E 'say $DateTime::VERSION' 1.06 If you have any idea how to solve this properly I'll gladly lend a hand, but failing that, perhaps the above is good enough for now?