Skip to content

Instantly share code, notes, and snippets.

@rwp0
Last active November 17, 2023 21:19
Show Gist options
  • Save rwp0/d3738e07e8f4617d5c0def113df6d4a2 to your computer and use it in GitHub Desktop.
Save rwp0/d3738e07e8f4617d5c0def113df6d4a2 to your computer and use it in GitHub Desktop.
Perl under WSL from Scratch
******************************************************************************
* COULD NOT FIND LIBSSL HEADERS                                              *
*                                                                            *
* The libssl header files are required to build Net-SSLeay, but they are     *
* missing from /usr. They would typically reside in /usr/include/openssl.    *
*                                                                            *
* If you are using the version of OpenSSL/LibreSSL packaged by your Linux    *
* distribution, you may need to install the corresponding "development"      *
* package via your package manager (e.g. libssl-dev for OpenSSL on Debian    *
* and Ubuntu, or openssl-devel for OpenSSL on Red Hat Enterprise Linux and   *
* Fedora).                                                                   *
******************************************************************************
/home/regular/perl5/perlbrew/perls/perl-blead/lib/5.39.5/x86_64-linux-thread-multi/CORE/proto.h:1015:1: note: declared here
 1015 | Perl_dowantarray(pTHX)
      | ^~~~~~~~~~~~~~~~
rm -f blib/arch/auto/Net/SSLeay/SSLeay.so
LD_RUN_PATH="/usr/lib/x86_64-linux-gnu" cc  -shared -O2 -g -L/usr -L/usr/lib64 -L/usr/lib -L/usr/local/lib -fstack-protector-strong  SSLeay.o  -o blib/arch/auto/Net/SSLeay/SSLeay.so  \
   -L/usr -L/usr/lib64 -L/usr/lib -lssl -lcrypto -lz   \

/usr/bin/ld: cannot find -lz: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [Makefile:495: blib/arch/auto/Net/SSLeay/SSLeay.so] Error 1
FAIL
! Installing Net::SSLeay failed. See /home/regular/.cpanm/work/1700253142.103396/build.log for details. Retry with --force to force install it.

Install Perlbrew

curl -kL https://install.perlbrew.pl | bash
echo "source ~/perl5/perlbrew/etc/bashrc" >> ~/.profile

Install Perl

 perlbrew install blead -j 8 --thread --debug

Switch to Blead Perl from System

perlbrew use perl-blead

perl --version

Install CPANM

perlbrew install-cpanm

cpm (install-cpm) has certificate issues since it doesn't support curl -k underneath

Install Linux Development Libraries

libssl-dev and zlib1g-dev needed for Net-SSLeay, a dependency of Dist-Zilla

libexpat needed by XML-Parser, a dependency of Rex

apt install -y \
  libssl-dev zlib1g-dev \
  libexpat-dev

Install my Perl Modules Bundle

cpanm -q Task::BeLike::RWP
Expat must be installed prior to building XML::Parser and I can't find
it in the standard library directories. Install 'expat-devel' (or
'libexpat1-dev') package with your OS package manager. See 'README'.

Or you can download expat from:

http://sourceforge.net/projects/expat/

If expat is installed, but in a non-standard directory, then use the
following options to Makefile.PL:

    EXPATLIBPATH=...  To set the directory in which to find libexpat

    EXPATINCPATH=...  To set the directory in which to find expat.h

For example:

    perl Makefile.PL EXPATLIBPATH=/home/me/lib EXPATINCPATH=/home/me/include

Note that if you build against a shareable library in a non-standard location
you may (on some platforms) also have to set your LD_LIBRARY_PATH environment
variable at run time for perl to find the library.

N/A
@rwp0
Copy link
Author

rwp0 commented Nov 17, 2023

cpanm -vf Getopt::Long::Descriptive
t/00-report-prereqs.t .. ok
t/descriptive.t ........ 1/?
#   Failed test 'got one warning about ambiguity of options'
#   at t/descriptive.t line 465.
# warning: Getopt::Long::Descriptive was configured with these ambiguous options: f
# warning: Duplicate specification "faith|f" for option "f"
# Looks like you failed 1 test of 60.
t/descriptive.t ........ Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/60 subtests
t/shortcircuit.t ....... ok
t/zzz-check-breaks.t ... ok

Test Summary Report
-------------------
t/descriptive.t      (Wstat: 256 (exited 1) Tests: 60 Failed: 1)
  Failed test:  59
  Non-zero exit status: 1
Files=4, Tests=74,  0 wallclock secs ( 0.01 usr  0.01 sys +  0.36 cusr  0.01 csys =  0.39 CPU)
Result: FAIL
Failed 1/4 test programs. 1/74 subtests failed.
make: *** [Makefile:892: test_dynamic] Error 255
FAIL
! Testing Getopt-Long-Descriptive-0.111 failed but installing it anyway.

@rwp0
Copy link
Author

rwp0 commented Nov 17, 2023

cpanm LWP::Protocol::https -f
t/example.t ............
    #   Failed test 'success status'
    #   at t/example.t line 19.

    #   Failed test 'have header Client-SSL-Socket-Class'
    #   at t/example.t line 29.

    #   Failed test 'have header Client-SSL-Cipher'
    #   at t/example.t line 44.

    #   Failed test 'found expected document content'
    #   at t/example.t line 46.
    #                   'Can't connect to www.example.com:443 (certificate verify failed)
    #
    # SSL connect attempt failed error:0A000086:SSL routines::certificate verify failed at /home/regular/perl5/perlbrew/perls/perl-blead/lib/site_perl/5.39.5/LWP/Protocol/http.pm line 50.
    # '
    #     doesn't match '(?^:Example Domain)'
    # Looks like you failed 4 tests of 6.
t/example.t ............ 1/2
#   Failed test 'Request GET https://www.example.com'
#   at t/example.t line 47.

    #   Failed test 'success status'
    #   at t/example.t line 54.
    # Looks like you failed 1 test of 2.

#   Failed test 'Check for warnings from GET https://www.example.com (RT #81948)'
#   at t/example.t line 57.
# Looks like you failed 2 tests of 2.
t/example.t ............ Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/2 subtests
t/https_proxy.t ........ ok

Test Summary Report
-------------------
t/example.t          (Wstat: 512 (exited 2) Tests: 2 Failed: 2)
  Failed tests:  1-2
  Non-zero exit status: 2
Files=4, Tests=62,  1 wallclock secs ( 0.03 usr  0.00 sys +  0.75 cusr  0.03 csys =  0.81 CPU)
Result: FAIL
Failed 1/4 test programs. 2/62 subtests failed.
make: *** [Makefile:886: test_dynamic] Error 255
FAIL
! Installing LWP::Protocol::https failed. See /home/regular/.cpanm/work/1700253527.104511/build.log for details. Retry with --force to force install it.

@rwp0
Copy link
Author

rwp0 commented Nov 17, 2023

apt install -y gh
gh auth login (paste Token)
gh auth setup-git

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment