arsv/perl-cross

Android build with NDK r25c fails on

baniaqmc opened this issue · 1 comments

Hello,

I'm trying to make the Perl 5.36.0 work on android. I need to call some functions from the List/Util core module.
Unfortunately when I try to run very simple code, like

perl/bin/perl -e "use List::Util;"

It fails with such error:

perl/lib/perl5/5.36.0/aarch64-linux/auto/List/Util/Util.so' for module List::Util: dlopen failed: cannot locate symbol "modf" referenced by "perl/lib/perl5/5.36.0/aarch64-linux/auto/List/Util/Util.so"

I've already tried with -lm and -ldl flags.
Here is the perl -V summary:

+ adb shell /data/local/tmp/perl/bin/perl -V
Summary of my perl5 (revision 5 version 36 subversion 0) configuration:

  Platform:
    osname=linux
    osvers=current
    archname=aarch64-linux
    uname=''
    config_args='--target=aarch64-unknown-linux-android31 --sysroot=/ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot --prefix=/data/local/tmp/perl --keeplog --mode=target --target=aarch64-unknown-linux-android31 --targetarch=aarch64-unknown-linux-android31'
    hint=default
    useposix=true
    d_sigaction=define
    useithreads=undef
    usemultiplicity=undef
    use64bitint=undef
    use64bitall=undef
    uselongdouble=undef
    usemymalloc=n
    default_inc_excludes_dot=define
  Compiler:
    cc='/ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android31-clang'
    ccflags ='--sysroot=/ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
    optimize=''
    cppflags='--sysroot=/ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot'
    ccversion=''
    gccversion='0.0'
    gccosandvers=''
    intsize=4
    longsize=8
    ptrsize=8
    doublesize=8
    byteorder=12345678
    doublekind=3
    d_longlong=define
    longlongsize=8
    d_longdbl=define
    longdblsize=16
    longdblkind=0
    ivtype='long'
    ivsize=8
    nvtype='double'
    nvsize=8
    Off_t='off_t'
    lseeksize=8
    alignbytes=8
    prototype=define
  Linker and Libraries:
    ld='/ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android31-clang'
    ldflags ='--sysroot=/ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot'
    libpth=/lib /usr/lib /usr/local/lib
    libs=-lm -ldl
    perllibs=-lm -ldl
    libc=
    so=so
    useshrplib=false
    libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs
    dlext=so
    d_dlsymun=undef
    ccdlflags='-Wl,-E'
    cccdlflags='-fPIC -Wno-unused-function'
    lddlflags='--sysroot=/ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot -shared --sysroot=/ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot'


Characteristics of this binary (from libperl):
  Compile-time options:
    HAS_TIMES
    PERLIO_LAYERS
    PERL_COPY_ON_WRITE
    PERL_DONT_CREATE_GVSV
    PERL_MALLOC_WRAP
    PERL_OP_PARENT
    PERL_PRESERVE_IVUV
    USE_LARGE_FILES
    USE_LOCALE
    USE_LOCALE_COLLATE
    USE_LOCALE_CTYPE
    USE_LOCALE_NUMERIC
    USE_LOCALE_TIME
    USE_PERLIO
    USE_PERL_ATOF
  Built under linux
  Compiled at Feb 14 2023 10:54:56
  @INC:
    /data/local/tmp/perl/lib/perl5/site_perl/5.36.0/aarch64-linux
    /data/local/tmp/perl/lib/perl5/site_perl/5.36.0
    /data/local/tmp/perl/lib/perl5/5.36.0/aarch64-linux
    /data/local/tmp/perl/lib/perl5/5.36.0

The objdump shows exactly that:

0000000000000000      D  *UND*	0000000000000000              modf

Please let me know if you have any ideas what can be the issue...

Best Regards!

Looks similar to issue described in android/ndk#1614, try adding $(your-compiler -print-libgcc-file-name) to ldflags when building perl