Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perl-5.29.6 fails to build on Android 8.1 (Oreo) under Termux app environment #16821

Closed
p5pRT opened this issue Jan 21, 2019 · 19 comments

Comments

@p5pRT
Copy link
Collaborator

commented Jan 21, 2019

Migrated from rt.perl.org#133787 (status was 'resolved')

Searchable as RT133787$

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

commented Jan 21, 2019

From rich+perl@hyphen-dash-hyphen.info

The CCTools app mentioned in README.android isn't currently available in
the Google Play store, so I'm instead using the Termux app (
https://termux.com/) to attempt a native build. (Termux does have a Perl
package, but it looks to have been cross-compiled rather than natively
built.)

The 4 build errors encountered when trying to "make minitest" are for
"unknown type name 'nl_item'"​:

In file included from ./perl.h​:5288​:
./proto.h​:4496​:43​: error​: unknown type name 'nl_item'
STATIC const char* S_my_nl_langinfo(const nl_item item, bool toggle);
  ^
./proto.h​:4500​:47​: error​: unknown type name 'nl_item'
PERL_CALLCONV const char* Perl_langinfo(const nl_item item);
  ^
locale.c​:2416​:21​: error​: unknown type name 'nl_item'
Perl_langinfo(const nl_item item)
  ^
locale.c​:2426​:24​: error​: unknown type name 'nl_item'
S_my_nl_langinfo(const nl_item item, bool toggle)
  ^

The Android C library has an apparently dummy definition for 'nl_item'​:
https://android.googlesource.com/platform/bionic/+/master/libc/include/nl_types.h

<langinfo.h> nl_langinfo/nl_langinfo_l functions entered Android's libc in
Oreo 8.0 release
https://github.com/aosp-mirror/platform_bionic/blob/master/docs/status.md

And the libandroid-support package (installed by default) attempts to
supplement this functionality​:
https://github.com/termux/libandroid-support/blob/master/include/langinfo.h

I'm new to troubleshooting the build process - and building on Android - so
the solution might be something trivial.

(kwh did suggest trying to build without locales (IIRC) on IRC before
Christmas, but the switches he suggested (and I've since forgotten) did not
result in a successful build at the time.)

Any suggestions gratefully received.


Summary of my perl5 (revision 5 version 29 subversion 6) configuration​:

  Platform​:
  osname=android
  osvers=8.1.0
  archname=aarch64-android
  uname='linux localhost 4.4.114 #1 smp preempt thu nov 8 14​:28​:26 cst
2018 aarch64 android '
  config_args='-des -Dusedevel'
  hint=previous
  useposix=true
  d_sigaction=define
  useithreads=undef
  usemultiplicity=undef
  use64bitint=define
  use64bitall=define
  uselongdouble=undef
  usemymalloc=n
  default_inc_excludes_dot=define
  bincompat5005=undef
  Compiler​:
  cc='cc'
  ccflags ='-fno-strict-aliasing -pipe -fstack-protector-strong
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2'
  optimize='-O2'
  cppflags='-fno-strict-aliasing -pipe -fstack-protector-strong'
  ccversion=''
  gccversion='4.2.1 Compatible Clang 7.0.1 (tags/RELEASE_701/final)'
  gccosandvers=''
  intsize=4
  longsize=8
  ptrsize=8
  doublesize=8
  byteorder=12345678
  doublekind=3
  d_longlong=define
  longlongsize=8
  d_longdbl=define
  longdblsize=16
  longdblkind=1
  ivtype='long'
  ivsize=8
  nvtype='double'
  nvsize=8
  Off_t='off_t'
  lseeksize=8
  alignbytes=8
  prototype=
  Linker and Libraries​:
  ld='cc'
  ldflags =' -L/system/lib -fstack-protector-strong'
  libpth=/system/lib /vendor/lib /data/data/com.termux/files/usr/include
/data/data/com.termux/files/usr/lib
/data/data/com.termux/files/usr/lib/clang/7.0.0
/data/data/com.termux/files/usr/bin/../lib
/data/data/com.termux/files/usr/lib /data/data/com.termux/files/usr/lib
  libs=-lpthread -ldb -ldl -lm -lutil -lc -landroid-support
  perllibs=-lpthread -ldl -lm -lutil -lc -landroid-support
  libc=/system/lib/libc.so
  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'
  lddlflags='-shared -O2 -L/system/lib -fstack-protector-strong'


Environment​:

LD_LIBRARY_PATH=/data/data/com.termux/files/usr/lib
LANG=en_US.UTF-8
PREFIX=/data/data/com.termux/files/usr
USER=u0_a56
PWD=/data/data/com.termux/files/home
HOME=/data/data/com.termux/files/home
TMPDIR=/data/data/com.termux/files/usr/tmp
SHELL=/data/data/com.termux/files/usr/bin/bash
TERM=xterm
SHLVL=1
ANDROID_ROOT=/system
ANDROID_DATA=/data
LOGNAME=u0_a56
EXTERNAL_STORAGE=/sdcard
PATH=/data/data/com.termux/files/usr/bin​:/data/data/com.termux/files/usr/bin/applets
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
_=/data/data/com.termux/files/usr/bin/env


@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

commented Jan 22, 2019

From @jkeenan

On Mon, 21 Jan 2019 01​:32​:25 GMT, rich+perl@​hyphen-dash-hyphen.info wrote​:

The CCTools app mentioned in README.android isn't currently available
in
the Google Play store, so I'm instead using the Termux app (
https://termux.com/) to attempt a native build. (Termux does have a
Perl
package, but it looks to have been cross-compiled rather than natively
built.)

The 4 build errors encountered when trying to "make minitest" are for
"unknown type name 'nl_item'"​:

In file included from ./perl.h​:5288​:
./proto.h​:4496​:43​: error​: unknown type name 'nl_item'
STATIC const char* S_my_nl_langinfo(const nl_item item, bool
toggle);
^
./proto.h​:4500​:47​: error​: unknown type name 'nl_item'
PERL_CALLCONV const char* Perl_langinfo(const nl_item item);
^
locale.c​:2416​:21​: error​: unknown type name 'nl_item'
Perl_langinfo(const nl_item item)
^
locale.c​:2426​:24​: error​: unknown type name 'nl_item'
S_my_nl_langinfo(const nl_item item, bool toggle)
^

The Android C library has an apparently dummy definition for
'nl_item'​:
https://android.googlesource.com/platform/bionic/+/master/libc/include/nl_types.h

<langinfo.h> nl_langinfo/nl_langinfo_l functions entered Android's
libc in
Oreo 8.0 release
https://github.com/aosp-
mirror/platform_bionic/blob/master/docs/status.md

And the libandroid-support package (installed by default) attempts to
supplement this functionality​:
https://github.com/termux/libandroid-
support/blob/master/include/langinfo.h

I'm new to troubleshooting the build process - and building on Android
- so
the solution might be something trivial.

(kwh did suggest trying to build without locales (IIRC) on IRC before
Christmas, but the switches he suggested (and I've since forgotten)
did not
result in a successful build at the time.)

Any suggestions gratefully received.

Do you have any information as to whether any production version of perl (e.g., perl-5.28.0) built on this platform?

If we knew that, we could at least distinguish between a regression and a "this has never been attempted before".

(I suspect the latter. There were a few attempts to build on Android in 2014. Go to http​://perl5.test-smoke.org/search and look for Android in the OS drop-down.)

Thank you very much.

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

commented Jan 22, 2019

The RT System itself - Status changed from 'new' to 'open'

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

commented Jan 22, 2019

From @tonycoz

On Sun, 20 Jan 2019 17​:32​:25 -0800, rich+perl@​hyphen-dash-hyphen.info wrote​:

The CCTools app mentioned in README.android isn't currently available
in
the Google Play store, so I'm instead using the Termux app (
https://termux.com/) to attempt a native build. (Termux does have a
Perl
package, but it looks to have been cross-compiled rather than natively
built.)

The 4 build errors encountered when trying to "make minitest" are for
"unknown type name 'nl_item'"​:

In file included from ./perl.h​:5288​:
./proto.h​:4496​:43​: error​: unknown type name 'nl_item'
STATIC const char* S_my_nl_langinfo(const nl_item item, bool
toggle);
^
./proto.h​:4500​:47​: error​: unknown type name 'nl_item'
PERL_CALLCONV const char* Perl_langinfo(const nl_item item);
^
locale.c​:2416​:21​: error​: unknown type name 'nl_item'
Perl_langinfo(const nl_item item)
^
locale.c​:2426​:24​: error​: unknown type name 'nl_item'
S_my_nl_langinfo(const nl_item item, bool toggle)
^

The Android C library has an apparently dummy definition for
'nl_item'​:
https://android.googlesource.com/platform/bionic/+/master/libc/include/nl_types.h

<langinfo.h> nl_langinfo/nl_langinfo_l functions entered Android's
libc in
Oreo 8.0 release
https://github.com/aosp-
mirror/platform_bionic/blob/master/docs/status.md

And the libandroid-support package (installed by default) attempts to
supplement this functionality​:
https://github.com/termux/libandroid-
support/blob/master/include/langinfo.h

It looks like something is wrong with your build environment.

The libandroid-support langinfo.h uses the nl_item type​:

https://github.com/termux/libandroid-support/blob/08ad732aa81f0109410c362eb817fbac50c73b06/include/langinfo.h#L105

as does the bionic header​:

https://github.com/aosp-mirror/platform_bionic/blob/822326db922ac5d0e4dea8cff1d774e8f04db94a/libc/include/langinfo.h#L95

Could you please attach the complete config.sh generated by Configure?

Thanks,
Tony

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

commented Jan 22, 2019

From rich@hyphen-dash-hyphen.info

On Tue, Jan 22, 2019 at 12​:32 AM James E Keenan via RT
<perlbug-followup@​perl.org> wrote​:

Do you have any information as to whether any production version of perl (e.g., perl-5.28.0) built on this platform?

perl-5.28.1 doesn't build on this setup (Oreo + Termux) out of the box either.

If we knew that, we could at least distinguish between a regression and a "this has never been attempted before".

I'm not aware of any successful native builds under Termux on Oreo.

Native builds under CCTools for earlier versions of Android look to
have been successful, as per README.android and
https://corion.net/talks/perl-on-android/perl-on-android.en.html

Thanks.

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

commented Jan 22, 2019

From rich@hyphen-dash-hyphen.info

On Tue, Jan 22, 2019 at 2​:41 AM Tony Cook via RT
<perlbug-followup@​perl.org> wrote​:

It looks like something is wrong with your build environment.

The libandroid-support langinfo.h uses the nl_item type​:

https://github.com/termux/libandroid-support/blob/08ad732aa81f0109410c362eb817fbac50c73b06/include/langinfo.h#L105

as does the bionic header​:

https://github.com/aosp-mirror/platform_bionic/blob/822326db922ac5d0e4dea8cff1d774e8f04db94a/libc/include/langinfo.h#L95

Could you please attach the complete config.sh generated by Configure?

config.sh attached.

This was generated by following the "Native Builds" instructions in
README.android (which are for CCTools not Termux, but seemed like a
good place to start)​:

export SYSROOT=/data/data/com.termux/files
export LD_LIBRARY_PATH="$SYSROOT/lib​:`pwd`​:`pwd`/lib​:`pwd`/lib/auto​:$LD_LIBRARY_PATH"
sh Configure -des -Dsysroot=$SYSROOT -Alibpth="/system/lib
/vendor/lib" -Dusedevel

Thanks.

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

commented Jan 22, 2019

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

commented Jan 22, 2019

From @tonycoz

On Tue, Jan 22, 2019 at 10​:26​:27PM +0000, Richard Leach wrote​:

On Tue, Jan 22, 2019 at 2​:41 AM Tony Cook via RT
<perlbug-followup@​perl.org> wrote​:

It looks like something is wrong with your build environment.

The libandroid-support langinfo.h uses the nl_item type​:

https://github.com/termux/libandroid-support/blob/08ad732aa81f0109410c362eb817fbac50c73b06/include/langinfo.h#L105

as does the bionic header​:

https://github.com/aosp-mirror/platform_bionic/blob/822326db922ac5d0e4dea8cff1d774e8f04db94a/libc/include/langinfo.h#L95

Could you please attach the complete config.sh generated by Configure?

config.sh attached.

This was generated by following the "Native Builds" instructions in
README.android (which are for CCTools not Termux, but seemed like a
good place to start)​:

export SYSROOT=/data/data/com.termux/files
export LD_LIBRARY_PATH="$SYSROOT/lib​:`pwd`​:`pwd`/lib​:`pwd`/lib/auto​:$LD_LIBRARY_PATH"
sh Configure -des -Dsysroot=$SYSROOT -Alibpth="/system/lib
/vendor/lib" -Dusedevel

...

i_langinfo='undef'
...
incpth='/data/data/com.termux/files/usr/lib/clang/7.0.1/include /data/data/com.termux/files/usr/include'
...

It looks like Configure isn't finding your langinfo.h header.

There's a couple of options, first, try adding the directory
containing langinfo.h to incpth​:

  sh Configure -des -Dsysroot=$SYSROOT -Alibpth="/system/lib /vendor/lib" -Dusedevel -Aincpth=/whereever/it/is

You may need to add the existing names too​:

  sh Configure -des -Dsysroot=$SYSROOT -Alibpth="/system/lib /vendor/lib" -Dusedevel -Dincpth="/data/data/com.termux/files/usr/lib/clang/7.0.1/include /data/data/com.termux/files/usr/include /whereever/it/is"

If langinfo.h is already in one of the those directories, check it's
preprocessable​:

  echo '#include <langinfo.h>' >test.c
  cc -E test.c >/dev/null && echo Success

If the file is preprocessable, but adding the directory to incpth
didn't help, try forcing i_langinfo on​:

  sh Configure -des -Dsysroot=$SYSROOT -Alibpth="/system/lib /vendor/lib" -Dusedevel -Di_langinfo

Tony

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

commented Jan 23, 2019

From rich@hyphen-dash-hyphen.info

On Tue, Jan 22, 2019 at 10​:53 PM Tony Cook <tony@​develop-help.com> wrote​:

It looks like Configure isn't finding your langinfo.h header.

There's a couple of options, first, try adding the directory
containing langinfo.h to incpth​:

sh Configure -des -Dsysroot=$SYSROOT -Alibpth="/system/lib /vendor/lib" -Dusedevel -Aincpth=/whereever/it/is

You may need to add the existing names too​:

sh Configure -des -Dsysroot=$SYSROOT -Alibpth="/system/lib /vendor/lib" -Dusedevel -Dincpth="/data/data/com.termux/files/usr/lib/clang/7.0.1/include /data/data/com.termux/files/usr/include /whereever/it/is"

No joy on either of those two, although "make minitest" got further​:

  In file included from locale.c​:48​:
  ./perl_langinfo.h​:10​:13​: fatal error​: 'langinfo.h' file not found
  # include <langinfo.h>
  ^~~~~~~~~~~~
  1 error generated.
  make​: *** [makefile​:245​: locale.o] Error 1

The preprocessor check needed
"-I/data/data/com.termux/files/usr/include/libandroid-support" to
succeed, and then adding that path to locincpth instead of incpth was
enough to build miniperl​:

  sh Configure -des -Dsysroot=$SYSROOT -Alibpth="/system/lib
/vendor/lib" -Dusedevel
-Alocincpth=/data/data/com.termux/files/usr/include/libandroid-support

Is that enough? Or should the path be added to BOTH locincpth and incpth?

Many thanks for the help so far. I'll try a full build later this week.

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

commented Jan 23, 2019

From @tonycoz

On Wed, Jan 23, 2019 at 01​:48​:32AM +0000, Richard Leach wrote​:

On Tue, Jan 22, 2019 at 10​:53 PM Tony Cook <tony@​develop-help.com> wrote​:

It looks like Configure isn't finding your langinfo.h header.

There's a couple of options, first, try adding the directory
containing langinfo.h to incpth​:

sh Configure -des -Dsysroot=$SYSROOT -Alibpth="/system/lib /vendor/lib" -Dusedevel -Aincpth=/whereever/it/is

You may need to add the existing names too​:

sh Configure -des -Dsysroot=$SYSROOT -Alibpth="/system/lib /vendor/lib" -Dusedevel -Dincpth="/data/data/com.termux/files/usr/lib/clang/7.0.1/include /data/data/com.termux/files/usr/include /whereever/it/is"

No joy on either of those two, although "make minitest" got further​:

In file included from locale\.c&#8203;:48&#8203;:
\./perl\_langinfo\.h&#8203;:10&#8203;:13&#8203;: fatal error&#8203;: 'langinfo\.h' file not found
\#   include \<langinfo\.h>
            ^~~~~~~~~~~~
1 error generated\.
make&#8203;: \*\*\* \[makefile&#8203;:245&#8203;: locale\.o\] Error 1

The preprocessor check needed
"-I/data/data/com.termux/files/usr/include/libandroid-support" to
succeed, and then adding that path to locincpth instead of incpth was
enough to build miniperl​:

sh Configure \-des \-Dsysroot=$SYSROOT \-Alibpth="/system/lib

/vendor/lib" -Dusedevel
-Alocincpth=/data/data/com.termux/files/usr/include/libandroid-support

Is that enough? Or should the path be added to BOTH locincpth and incpth?

That should be enough.

Tony

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

commented Jan 24, 2019

From rich@hyphen-dash-hyphen.info

On Wed, Jan 23, 2019 at 2​:29 AM Tony Cook <tony@​develop-help.com> wrote​:

On Wed, Jan 23, 2019 at 01​:48​:32AM +0000, Richard Leach wrote​:

The preprocessor check needed
"-I/data/data/com.termux/files/usr/include/libandroid-support" to
succeed, and then adding that path to locincpth instead of incpth was
enough to build miniperl​:

sh Configure \-des \-Dsysroot=$SYSROOT \-Alibpth="/system/lib

/vendor/lib" -Dusedevel
-Alocincpth=/data/data/com.termux/files/usr/include/libandroid-support

Is that enough? Or should the path be added to BOTH locincpth and incpth?

That should be enough.

Next problem is that although the miniperl executable does get built,
@​INC contents are duff, preventing the build from getting much
further​:

  ./miniperl -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh
-c 'echo >&2 Failed to build miniperl. Please run make minitest; exit
1'
  ./miniperl -Ilib -f write_buildcustomize.pl
  Use of uninitialized value in -x at dist/PathTools/Cwd.pm line 174.
  Use of uninitialized value $_[0] in join or string at
dist/PathTools/lib/File/Spec/Unix.pm line 87.
  Use of uninitialized value $_[0] in join or string at
dist/PathTools/lib/File/Spec/Unix.pm line 87.
  Use of uninitialized value $_[0] in join or string at
dist/PathTools/lib/File/Spec/Unix.pm line 87.
  Use of uninitialized value $_[0] in join or string at
dist/PathTools/lib/File/Spec/Unix.pm line 87.
  Use of uninitialized value $_[0] in join or string at
dist/PathTools/lib/File/Spec/Unix.pm line 87.
  Use of uninitialized value $_[0] in join or string at
dist/PathTools/lib/File/Spec/Unix.pm line 87.
  Use of uninitialized value $_[0] in join or string at
dist/PathTools/lib/File/Spec/Unix.pm line 87.
  Use of uninitialized value $_[0] in join or string at
dist/PathTools/lib/File/Spec/Unix.pm line 87.
  Use of uninitialized value $_[0] in join or string at
dist/PathTools/lib/File/Spec/Unix.pm line 87.
  Use of uninitialized value $_[0] in join or string at
dist/PathTools/lib/File/Spec/Unix.pm line 87.
  Use of uninitialized value $_[0] in join or string at
dist/PathTools/lib/File/Spec/Unix.pm line 87.
  Use of uninitialized value $_[0] in join or string at
dist/PathTools/lib/File/Spec/Unix.pm line 87.
  Use of uninitialized value $_[0] in join or string at
dist/PathTools/lib/File/Spec/Unix.pm line 87.
  Use of uninitialized value $_[0] in join or string at
dist/PathTools/lib/File/Spec/Unix.pm line 87.
  Use of uninitialized value $_[0] in join or string at
dist/PathTools/lib/File/Spec/Unix.pm line 87.
  Use of uninitialized value $_[0] in join or string at
dist/PathTools/lib/File/Spec/Unix.pm line 87.
  Use of uninitialized value $_[0] in join or string at
dist/PathTools/lib/File/Spec/Unix.pm line 87.
  rm -f pod/perl5296delta.pod
  /data/data/com.termux/files/usr/bin/ln -s perldelta.pod
pod/perl5296delta.pod
  ./miniperl -Ilib autodoc.pl
  Can't locate Exporter.pm in @​INC (you may need to install the
Exporter module) (@​INC contains​: /cpan/AutoLoader/lib /dist/Carp/lib
/dist/PathTools /dist/PathTools/lib /cpan/ExtUtils-Install/lib
/cpan/ExtUtils-MakeMaker/lib /cpan/ExtUtils-Manifest/lib
/cpan/File-Path/lib /ext/re /dist/Term-ReadLine/lib /dist/Exporter/lib
/ext/File-Find/lib /cpan/Text-Tabs/lib /dist/constant/lib
/cpan/version/lib /cpan/Getopt-Long/lib /lib
/data/data/com.termux/files/home/PerlSource/perl/lib .) at
/data/data/com.termux/files/home/PerlSource/perl/lib/File/Compare.pm
line 8.
  Compilation failed in require at ./regen/regen_lib.pl line 4.
  BEGIN failed--compilation aborted at ./regen/regen_lib.pl line 4.
  Compilation failed in require at autodoc.pl line 32.
  make​: *** [makefile​:405​: pod/perlintern.pod] Error 2

The @​INC paths are missing the pwd
("/data/data/com.termux/files/home/PerlSource/perl") prefix, but I
can't figure out from INSTALL how to fix that at this point of the
build process (i.e. prior to install).

Thanks,
Richard

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

commented Feb 5, 2019

From rich@hyphen-dash-hyphen.info

On Thu, Jan 24, 2019 at 2​:33 AM Richard Leach via RT
<perlbug-followup@​perl.org> wrote​:

Next problem is that although the miniperl executable does get built,
@​INC contents are duff, preventing the build from getting much
further​:

\./miniperl \-Ilib \-f write\_buildcustomize\.pl
Use of uninitialized value in \-x at dist/PathTools/Cwd\.pm line 174\.
Use of uninitialized value $\_\[0\] in join or string at

dist/PathTools/lib/File/Spec/Unix.pm line 87.
...
rm -f pod/perl5296delta.pod
/data/data/com.termux/files/usr/bin/ln -s perldelta.pod
pod/perl5296delta.pod
./miniperl -Ilib autodoc.pl
Can't locate Exporter.pm in @​INC (you may need to install the
Exporter module) (@​INC contains​: /cpan/AutoLoader/lib /dist/Carp/lib
/dist/PathTools /dist/PathTools/lib /cpan/ExtUtils-Install/lib
/cpan/ExtUtils-MakeMaker/lib /cpan/ExtUtils-Manifest/lib
/cpan/File-Path/lib /ext/re /dist/Term-ReadLine/lib /dist/Exporter/lib
/ext/File-Find/lib /cpan/Text-Tabs/lib /dist/constant/lib
/cpan/version/lib /cpan/Getopt-Long/lib /lib
/data/data/com.termux/files/home/PerlSource/perl/lib .) at
/data/data/com.termux/files/home/PerlSource/perl/lib/File/Compare.pm
line 8.
Compilation failed in require at ./regen/regen_lib.pl line 4.
BEGIN failed--compilation aborted at ./regen/regen_lib.pl line 4.
Compilation failed in require at autodoc.pl line 32.
make​: *** [makefile​:405​: pod/perlintern.pod] Error 2

The @​INC paths are missing the pwd
("/data/data/com.termux/files/home/PerlSource/perl") prefix, but I
can't figure out from INSTALL how to fix that at this point of the
build process (i.e. prior to install).

This problem arises in write_buildcustomize.pl, where an empty string
is assigned to $cwd​:
  my $cwd = Cwd​::getcwd();

Discussion in https://rt.cpan.org/Ticket/Display.html?id=13851
suggests that's to be expected when building as a non-root user
lacking some access to (grand)parent directories. That is in fact what
the Termux environment seems to give you.

Modifying the above line to fallback to Cwd​::cwd(), as per the
attached patch, works in this instance. I haven't tested it further
and am unsure whether this change would be detrimental to other
platforms.

Regards,
Richard

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

commented Feb 5, 2019

From rich@hyphen-dash-hyphen.info

0001-If-Cwd-getcwd-returns-an-empty-string-in-write_build.patch
From 823c3f6e4ad769c7253e1c2d24a2e8b266919ce6 Mon Sep 17 00:00:00 2001
From: Richard Leach <rich+perl@hyphen-dash-hyphen.info>
Date: Tue, 5 Feb 2019 01:40:26 +0000
Subject: [PATCH] If Cwd::getcwd() returns an empty string in
 write_buildcustomize.pl - perhaps due to filesystem permissions - try
 Cwd::cwd() instead.

---
 write_buildcustomize.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/write_buildcustomize.pl b/write_buildcustomize.pl
index e82f931bae..9d28f5776e 100644
--- a/write_buildcustomize.pl
+++ b/write_buildcustomize.pl
@@ -59,7 +59,7 @@ unshift @INC, @toolchain;
 require File::Spec::Functions;
 require Cwd;

-my $cwd  = Cwd::getcwd();
+my $cwd  = Cwd::getcwd() || Cwd::cwd();

 # lib must be last, as the toolchain modules write themselves into it
 # as they build, and it's important that @INC order ensures that the partially
--
2.20.1

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

commented Feb 5, 2019

From rich+perl@hyphen-dash-hyphen.info

On Tue, Feb 5, 2019 at 2​:01 AM Richard Leach
<rich@​hyphen-dash-hyphen.info> wrote​:

On Thu, Jan 24, 2019 at 2​:33 AM Richard Leach via RT
<perlbug-followup@​perl.org> wrote​:

Next problem is that although the miniperl executable does get built,
@​INC contents are duff, preventing the build from getting much
further​:

\./miniperl \-Ilib \-f write\_buildcustomize\.pl
Use of uninitialized value in \-x at dist/PathTools/Cwd\.pm line 174\.
Use of uninitialized value $\_\[0\] in join or string at

dist/PathTools/lib/File/Spec/Unix.pm line 87.
...
rm -f pod/perl5296delta.pod
/data/data/com.termux/files/usr/bin/ln -s perldelta.pod
pod/perl5296delta.pod
./miniperl -Ilib autodoc.pl
Can't locate Exporter.pm in @​INC (you may need to install the
Exporter module) (@​INC contains​: /cpan/AutoLoader/lib /dist/Carp/lib
/dist/PathTools /dist/PathTools/lib /cpan/ExtUtils-Install/lib
/cpan/ExtUtils-MakeMaker/lib /cpan/ExtUtils-Manifest/lib
/cpan/File-Path/lib /ext/re /dist/Term-ReadLine/lib /dist/Exporter/lib
/ext/File-Find/lib /cpan/Text-Tabs/lib /dist/constant/lib
/cpan/version/lib /cpan/Getopt-Long/lib /lib
/data/data/com.termux/files/home/PerlSource/perl/lib .) at
/data/data/com.termux/files/home/PerlSource/perl/lib/File/Compare.pm
line 8.
Compilation failed in require at ./regen/regen_lib.pl line 4.
BEGIN failed--compilation aborted at ./regen/regen_lib.pl line 4.
Compilation failed in require at autodoc.pl line 32.
make​: *** [makefile​:405​: pod/perlintern.pod] Error 2

The @​INC paths are missing the pwd
("/data/data/com.termux/files/home/PerlSource/perl") prefix, but I
can't figure out from INSTALL how to fix that at this point of the
build process (i.e. prior to install).

This problem arises in write_buildcustomize.pl, where an empty string
is assigned to $cwd​:
my $cwd = Cwd​::getcwd();

Discussion in https://rt.cpan.org/Ticket/Display.html?id=13851
suggests that's to be expected when building as a non-root user
lacking some access to (grand)parent directories. That is in fact what
the Termux environment seems to give you.

"Modifying the above line to fallback to Cwd​::cwd(), as per the
attached patch, works in this instance."

That is to say, it addresses the bulk of errors seen at this stage.
More to do to get the build to run to completion.

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

commented Apr 16, 2019

From rich@hyphen-dash-hyphen.info

On Tue, Feb 5, 2019 at 2​:01 AM Richard Leach
<rich@​hyphen-dash-hyphen.info> wrote​:

This problem arises in write_buildcustomize.pl, where an empty string
is assigned to $cwd​:
my $cwd = Cwd​::getcwd();

Discussion in https://rt.cpan.org/Ticket/Display.html?id=13851
suggests that's to be expected when building as a non-root user
lacking some access to (grand)parent directories. That is in fact what
the Termux environment seems to give you.

Now getting further in the build process with a fresh copy of blead
(including Tony's Getcwd patch from RT#133951) and updated Termux
packages, using the following commands​:

  export SYSROOT=/data/data/com.termux/files
  export LD_LIBRARY_PATH="$SYSROOT/lib​:`pwd`​:`pwd`/lib​:`pwd`/lib/auto​:$LD_LIBRARY_PATH"
  sh Configure -des -Dsysroot=$SYSROOT -Alibpth="/system/lib
/vendor/lib" -Dusedevel -Ud_newlocale

Current status is​:
* "make miniperl" - succeeds
* "make minitest" - fails with only 1 error (due to absence of /tmp​:
discussed on IRC, see RT#134039 for patch)
* "make" - the perl executable gets built, but the following fatal
error is then encountered​:

/data/data/com.termux/files/home/PerlSource/perl4/perl/ext/B/../../miniperl
"-I/data/data/com.termux/files/home/PerlSource/perl4/perl/ext/B/../../lib"
-MExtUtils​::Command​::MM -e 'cp_nonempty' -- B.bs
/data/data/com.termux/files/home/PerlSource/perl4/perl/ext/B/../../lib/auto/B/B.bs
644
"../../miniperl"
"-I/data/data/com.termux/files/home/PerlSource/perl4/perl/ext/B/../../lib"
"/data/data/com.termux/files/home/PerlSource/perl4/perl/ext/B/../../lib/ExtUtils/xsubpp"
-typemap '/data/data/com.termux/files/home/PerlSource/perl4/perl/ext/B/../../lib/ExtUtils/typemap'
-typemap '/data/data/com.termux/files/home/PerlSource/perl4/perl/ext/B/typemap'
B.xs > B.xsc
mv B.xsc B.c
cc -c -fno-strict-aliasing -pipe -fstack-protector-strong
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -Wall
-Werror=declaration-after-statement -Werror=pointer-arith -Wextra
-Wc++-compat -Wwrite-strings -O2 -DVERSION=\"1.76\"
-DXS_VERSION=\"1.76\" -fPIC --sysroot=/data/data/com.termux/files
"-I../.." B.c
In file included from B.xs​:13​:
../../perl.h​:697​:10​: fatal error​: 'sys/types.h' file not found

I'm not sure which sys/types.h is being looked for. There's one under
/data/data/com.termux/files/usr/include, but trying to pass that path
in -Alocincpth made no difference.

Any suggestions?

Regards,
Richard

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

commented Apr 19, 2019

From @khwilliamson

On 4/16/19 1​:43 PM, Richard Leach wrote​:

On Tue, Feb 5, 2019 at 2​:01 AM Richard Leach
<rich@​hyphen-dash-hyphen.info> wrote​:

This problem arises in write_buildcustomize.pl, where an empty string
is assigned to $cwd​:
my $cwd = Cwd​::getcwd();

Discussion in https://rt.cpan.org/Ticket/Display.html?id=13851
suggests that's to be expected when building as a non-root user
lacking some access to (grand)parent directories. That is in fact what
the Termux environment seems to give you.

Now getting further in the build process with a fresh copy of blead
(including Tony's Getcwd patch from RT#133951) and updated Termux
packages, using the following commands​:

 export SYSROOT=/data/data/com\.termux/files
 export LD\_LIBRARY\_PATH="$SYSROOT/lib&#8203;:\`pwd\`&#8203;:\`pwd\`/lib&#8203;:\`pwd\`/lib/auto&#8203;:$LD\_LIBRARY\_PATH"
 sh Configure \-des \-Dsysroot=$SYSROOT \-Alibpth="/system/lib

/vendor/lib" -Dusedevel -Ud_newlocale

Current status is​:
* "make miniperl" - succeeds
* "make minitest" - fails with only 1 error (due to absence of /tmp​:
discussed on IRC, see RT#134039 for patch)
* "make" - the perl executable gets built, but the following fatal
error is then encountered​:

/data/data/com.termux/files/home/PerlSource/perl4/perl/ext/B/../../miniperl
"-I/data/data/com.termux/files/home/PerlSource/perl4/perl/ext/B/../../lib"
-MExtUtils​::Command​::MM -e 'cp_nonempty' -- B.bs
/data/data/com.termux/files/home/PerlSource/perl4/perl/ext/B/../../lib/auto/B/B.bs
644
"../../miniperl"
"-I/data/data/com.termux/files/home/PerlSource/perl4/perl/ext/B/../../lib"
"/data/data/com.termux/files/home/PerlSource/perl4/perl/ext/B/../../lib/ExtUtils/xsubpp"
-typemap '/data/data/com.termux/files/home/PerlSource/perl4/perl/ext/B/../../lib/ExtUtils/typemap'
-typemap '/data/data/com.termux/files/home/PerlSource/perl4/perl/ext/B/typemap'
B.xs > B.xsc
mv B.xsc B.c
cc -c -fno-strict-aliasing -pipe -fstack-protector-strong
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -Wall
-Werror=declaration-after-statement -Werror=pointer-arith -Wextra
-Wc++-compat -Wwrite-strings -O2 -DVERSION=\"1.76\"
-DXS_VERSION=\"1.76\" -fPIC --sysroot=/data/data/com.termux/files
"-I../.." B.c
In file included from B.xs​:13​:
../../perl.h​:697​:10​: fatal error​: 'sys/types.h' file not found

I'm not sure which sys/types.h is being looked for. There's one under
/data/data/com.termux/files/usr/include, but trying to pass that path
in -Alocincpth made no difference.

Any suggestions?

Regards,
Richard

Is this ticket closable?

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

commented Apr 19, 2019

From rich@hyphen-dash-hyphen.info

On Fri, Apr 19, 2019 at 7​:09 PM Karl Williamson <public@​khwilliamson.com> wrote​:

Is this ticket closable?

Not quite, I'd like to be able to run "make" without any fatal errors
before it gets closed. (Seem to be nearly there.)

Need some help with this failure to build B​:

/data/data/com.termux/files/home/PerlSource/perl4/perl/ext/B/../../miniperl
"-I/data/data/com.termux/files/home/PerlSource/perl4/perl/ext/B/../../lib"
-MExtUtils​::Command​::MM -e 'cp_nonempty' -- B.bs
/data/data/com.termux/files/home/PerlSource/perl4/perl/ext/B/../../lib/auto/B/B.bs
644
"../../miniperl"
"-I/data/data/com.termux/files/home/PerlSource/perl4/perl/ext/B/../../lib"
"/data/data/com.termux/files/home/PerlSource/perl4/perl/ext/B/../../lib/ExtUtils/xsubpp"
-typemap '/data/data/com.termux/files/home/PerlSource/perl4/perl/ext/B/../../lib/ExtUtils/typemap'
-typemap '/data/data/com.termux/files/home/PerlSource/perl4/perl/ext/B/typemap'
B.xs > B.xsc
mv B.xsc B.c
cc -c -fno-strict-aliasing -pipe -fstack-protector-strong
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -Wall
-Werror=declaration-after-statement -Werror=pointer-arith -Wextra
-Wc++-compat -Wwrite-strings -O2 -DVERSION=\"1.76\"
-DXS_VERSION=\"1.76\" -fPIC --sysroot=/data/data/com.termux/files
"-I../.." B.c
In file included from B.xs​:13​:
../../perl.h​:697​:10​: fatal error​: 'sys/types.h' file not found

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

commented Apr 24, 2019

From rich@hyphen-dash-hyphen.info

On Fri, Apr 19, 2019 at 8​:55 PM Richard Leach
<rich@​hyphen-dash-hyphen.info> wrote​:

On Fri, Apr 19, 2019 at 7​:09 PM Karl Williamson <public@​khwilliamson.com> wrote​:

Is this ticket closable?

Not quite, I'd like to be able to run "make" without any fatal errors
before it gets closed. (Seem to be nearly there.)

This ticket is now closable. \o/

Looks like setting sysroot is unnecessary in this environment. "make"
now runs to completion without it. Will do some more testing, then
submit an update patch for README.android.

It might also be possible to revert
19abaf5 due to better support for
locales nowadays, but need to do a cross-compile build before
submitting any patch. (Also, I've no idea which Android flavour
brought in the locales support and therefore if such a change would
cause anyone problems....)

FYI There are only a few test failures​:
* cpan/ExtUtils-MakeMaker/t/02-xsdynamic.t - haven't investigated this yet
* cpan/Sys-Syslog/t/<multiple> - will shortly submit a patch for
hints/linux-android.sh to ensure that -llog is compiled in
* cpan/version/t/07locale.t - patch submitted upstream
* dist/Net-Ping/t/<multiple> - covered by
https://rt-archive.perl.org/perl5/Ticket/Display.html?id=134043

Thanks again to all who assisted!

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

commented Apr 25, 2019

@iabyn - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.