cperl icon indicating copy to clipboard operation
cperl copied to clipboard

Ubuntu 18.04 on WSLv1 issues: makedepend deletes Makefile + installman fails + microperl build fails (requires perlio instead of stdio)

Open vadimkantorov opened this issue 5 years ago • 16 comments

On my machine this script leads to no makefile found (and indeed, only Makefile.micro exists which errors out as well):

PERL=https://github.com/perl11/cperl/releases/download/cperl-5.30.0/cperl-5.30.0.tar.gz
wget -nc $PERL
tar xfz $(basename $PERL)
PREFIX=$PWD/cperlprefix
mkdir -p $PREFIX
cd cperl-5.30.0
./Configure -sde -Dprefix=$PREFIX
make -j4

My platform is Ubuntu 18.04 on WSLv1. Typically this is sufficient for building all programming language runtimes.

...
Extracting cflags (with variable substitutions)
Not re-extracting config.h
Extracting makedepend (with variable substitutions)
Extracting Makefile (with variable substitutions)
Extracting myconfig (with variable substitutions)
Extracting pod/Makefile (with variable substitutions)
Extracting Policy.sh (with variable substitutions)
Extracting runtests (with variable substitutions)
Configure done.

If you compile cperl on a different machine or from a different object
directory, copy the Policy.sh file from this object directory to the
new one before you run Configure -- this will help you with most of
the policy defaults.

make: *** No targets specified and no makefile found.  Stop.
make -f Makefile.micro
cc -c -o ugenerate_uudmap.o -DPERL_CORE -DPERL_MICRO -DPERL_USE_SAFE_PUTENV -DNO_MATHOMS  generate_uudmap.c
cc -o ugenerate_uudmap  ugenerate_uudmap.o -lm
./ugenerate_uudmap uuudmap.h ubitcount.h umg_data.h
cc -c -o ugv.o -DPERL_CORE -DPERL_MICRO -DPERL_USE_SAFE_PUTENV -DNO_MATHOMS  gv.c
In file included from iperlsys.h:51:0,
                 from perl.h:3844,
                 from gv.c:36:
perlio.h:32:4: error: #error "stdio is no longer supported as the default base layer -- use perlio."
 #  error "stdio is no longer supported as the default base layer -- use perlio."
    ^~~~~
Makefile.micro:89: recipe for target 'ugv.o' failed
make: *** [ugv.o] Error 1

Context: I am looking to use perlcc / RPerl to convert tlmgr from TexLive into C/C++ code, so I thought to install locally a recent, updated Perl distribution - cperl.

vadimkantorov avatar Oct 07 '20 20:10 vadimkantorov

WSLv1, hmm. Never tried this one. Need to hear around what happens there.

rurban avatar Oct 07 '20 22:10 rurban

That's an syscall-emulated linux subsystem on Windows. Not sure if that matters. Most of user-space things work and build from source fine there (all programming languages, etc)

If you can suggest, where to put debug prints in ./Configure, I can do some debug printing

vadimkantorov avatar Oct 07 '20 22:10 vadimkantorov

I ran bash -x Makefile.SH and strace -f bash Makefile.sh, output is attached cperl-5.30.0.zip

++ osname=linux
++ osvers=4.4.0-19041-microsoft

vadimkantorov avatar Oct 07 '20 22:10 vadimkantorov

A full bash -x log of running Configure log.zip

vadimkantorov avatar Oct 07 '20 23:10 vadimkantorov

I think the problem is a case-insensitive filesystem under linux. We write to Makefile, but then rm -f makefile, i.e. $rm -f $firstmakefile in Makefile.SH

Can you try commenting out this line?

(See the very end of bash,txt)

A fix would need to probe for a case-insensitve filesystem, store it in config and don't do this line.

Another temp. fix would be

# for case-insensitive filesystems (ie WSL)
mv Makefile Makefile.new
$rm -f $firstmakefile
mv Makefile.new Makefile

rurban avatar Oct 08 '20 06:10 rurban

This helped to get Makefile generated! Thank you! I'll post here how it compiles (given that Makefile.micro does not compile)

vadimkantorov avatar Oct 08 '20 10:10 vadimkantorov

Btw, is it expected that microperl complains about perlio?

vadimkantorov avatar Oct 08 '20 11:10 vadimkantorov

make succeeds. make install works and then prints:

  /mnt/c/Users/user/wiptlmgr/cperlprefix/man/man3/version.3
  /mnt/c/Users/user/wiptlmgr/cperlprefix/man/man3/version::Internals.3
  /mnt/c/Users/user/wiptlmgr/cperlprefix/man/man3/vmsish.3
  /mnt/c/Users/user/wiptlmgr/cperlprefix/man/man3/warnings.3
  /mnt/c/Users/user/wiptlmgr/cperlprefix/man/man3/warnings::register.3
  /mnt/c/Users/user/wiptlmgr/cperlprefix/man/man1/assemble.1
readline() on closed filehandle $fh at installman line 115.

not sure if it's expected or not

vadimkantorov avatar Oct 08 '20 11:10 vadimkantorov

ls cperlprefix/bin does not contain any perl executable:

/mnt/c/Users/user/wiptlmgr/cperlprefix/bin$ ls
assemble    corelist        cperl5.30.0  disassemble    h2ph       libnetcfg     nytprofhtml   perldoc  pod2html   podchecker  ptar      splain
buildcc     cpan            cperlbug     enc2xs         h2xs       nytprofcalls  nytprofmerge  perlivp  pod2man    podselect   ptardiff  xsubpp
c2ph        cpanel_json_xs  cperldoc     encguess       instmodsh  nytprofcg     nytprofpf     piconv   pod2text   prove       ptargrep  zipdetails
cc_harness  cperl           cperlivp     flamegraph.pl  json_pp    nytprofcsv    perlcc        pl2pm    pod2usage  pstruct     shasum

vadimkantorov avatar Oct 08 '20 11:10 vadimkantorov

perl executable is produced by make and runs launches successfully, but it is not copied into cperlprefix/bin because of failed make install. If it's a problem while installing man, is there a way to disable man?

Oh, it seems that the executable in bin is named cperl (not like it's named in-tree).

Btw, commenting out installman fixes the problem and then make install succeeds:

install_all install-all: $(INSTALL_DEPENDENCE) installperl all installman
    $(RUN_PERL) installperl --destdir=$(DESTDIR)  $(INSTALLFLAGS) $(STRIPFLAGS)
    #$(RUN_PERL) installman --destdir=$(DESTDIR)
    -@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) -MCPAN -e '@ARGV&&install(@ARGV)' `cat extras.lst`

vadimkantorov avatar Oct 08 '20 11:10 vadimkantorov

The cperl vs perl exe name is expected. It is designed to co-exist with an existing perl5.

The installman failures could be another WSL thing. Nobody ever tried that before.

rurban avatar Oct 08 '20 12:10 rurban

I ran perlcc on tlmgr, it generated tlmgr.c, but also an error :) I filed that issue in https://github.com/rurban/perl-compiler/issues/434

I also renamed this issue to reflect the remaining issues

vadimkantorov avatar Oct 08 '20 13:10 vadimkantorov

@rurban https://github.com/perl11/cperl/commit/2506c06030b8dfeb548757e92c558a01fcd53c9b does not help, it still removes the Makefile (just tried it out)

vadimkantorov avatar Oct 13 '20 03:10 vadimkantorov

Here's output of Configure:

Extracting makedepend (with variable substitutions)
Extracting Makefile (with variable substitutions)
Extracting myconfig (with variable substitutions)
Extracting pod/Makefile (with variable substitutions)
Extracting Policy.sh (with variable substitutions)
Extracting runtests (with variable substitutions)
Run make depend now? [y]
`sh  cflags "optimize='-O3 --pipe'" generate_uudmap.o`  generate_uudmap.c
cc -o generate_uudmap -fstack-protector-strong -L/usr/local/lib -flto=4 -O3 --pipe generate_uudmap.o -lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
./generate_uudmap uudmap.h bitcount.h mg_data.h
sh ./makedepend MAKE="make" cflags
cp: cannot stat 'Makefile': No such file or directory
make[1]: Entering directory '/mnt/c/Users/user/wiptlmgr/cperl-5.30.0'
make[1]: *** No rule to make target 'clist'.  Stop.
make[1]: Leaving directory '/mnt/c/Users/user/wiptlmgr/cperl-5.30.0'
Searching for .c files...
Updating makefile...
Now you must run 'make'.

vadimkantorov avatar Oct 13 '20 03:10 vadimkantorov

When I then manually execute bash Makefile.SH, Makefile is produced.

vadimkantorov avatar Oct 13 '20 03:10 vadimkantorov

so maybe makedepend also removes Makefile. I'll check.

rurban avatar Oct 13 '20 07:10 rurban