Subject: | Issue on oldish Android devices |
Howdy!
POSIX::AtFork doesn't work in older android devices (older than 2.3.6, which make up for a relatively large chunk of the current android users[0]), because their libc doesn't define a pthread_atfork() function. Googling suggested that there was a fix for this, but the fix only gets rid of the linking problems; the module will "work", but none of the registered callbacks will actually run, which makes it of little use.
So I would suggest just bailing out in Makefile.PL if $^O eq 'android' && $Config{osvers} lt "2.3.6".
In case you want it, the partial 'fix' is to bundle the pthread-atfork.c from the android source with the module[1], compile that, then add the path to the resulting object file to the libraries that POSIX::AtFork links again.
Basically, you want something like this in your Makefile.PL:
use Config;
use ExtUtils::CBuilder;
if ( $^O eq 'android' ) {
if ($Config{osvers} lt "2.3.6") {
# This android doesn't have pthread-atfork()
my $b = ExtUtils::CBuilder->new(quiet => 1);
my $obj_file = $b->compile(source => 'pthread-atfork.c');
cc_append_to_ccflags( $obj_file );
}
}
[0] https://developer.android.com/about/dashboards/index.html
[1] https://android.googlesource.com/platform/bionic.git/+/android-4.0.1_r1/libc/bionic/pthread-atfork.c