Skip Menu |
 

This queue is for tickets about the DateTime CPAN distribution.

Report information
The Basics
Id: 92671
Status: resolved
Priority: 0/
Queue: DateTime

People
Owner: Nobody in particular
Requestors: fraserbn [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 1.07



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[1306]: 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?
Download (untitled) / with headers
text/plain 2.3k
On Mon Feb 03 04:06:47 2014, Hugmeir wrote: Show quoted text
> 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[1306]: 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?
I really don't know anything about compiling C on Android, so I'll add this hack for now.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.