What is wrong with my MyConfig.pm? - perl

I'm trying to install perl modules local to my user - I don't have root access. I have setup in my directory structure the following place for perl libs: /dasd/home/miner/perl5lib/lib/lib (don't ask) - I want my perl modules there.
I am going to foolishly post my whole MyConfig.pm - I think just make_arg, make_install_arg, and make_pl_arg are important, but I spose therein lies my question: I'm not sure exactly how cpan works (and can't easily google it) so I don't know exactly the point of params in MyConfig.pm.
'build_dir' => q[/dasd/home/miner/.cpan/build],
'cache_metadata' => q[1],
'cpan_home' => q[/dasd/home/miner/.cpan],
'dontload_hash' => { },
'ftp' => q[/usr/kerberos/bin/ftp],
'ftp_proxy' => q[],
'getcwd' => q[cwd],
'gpg' => q[/usr/bin/gpg],
'gzip' => q[/bin/gzip],
'histfile' => q[/dasd/home/miner/.cpan/histfile],
'histsize' => q[100],
'http_proxy' => q[],
'inactivity_timeout' => q[0],
'index_expire' => q[1],
'inhibit_startup_message' => q[0],
'keep_source_where' => q[/dasd/home/miner/.cpan/sources],
'links' => q[/usr/bin/links],
'make' => q[/usr/bin/make],
'make_arg' => q[LIB= dasd/home/perl5lib/lib/lib PREFIX=~/perl5lib],
'make_install_arg' => q[LIB= dasd/home/perl5lib/lib/lib],
'makepl_arg' => q[PREFIX=~/perl5lib LIB=/dasd/home/perl5lib/lib/lib INSTALLMAN1DIR=~/perl5lib/man1 INSTALLMAN3DIR=~/perl5lib/man3],
'ncftp' => q[],
To further explain, I run 'cpan MongoDB', for example, and I get a lot of output, all screaming a bunch of errors, it all dies on this error:
Checking if your kit is complete...
Looks good
Writing Makefile for File::Slurp
Writing MYMETA.yml and MYMETA.json
make: *** No rule to make target `dasd/home/perl5lib/lib/lib'. Stop.
/usr/bin/make LIB= dasd/home/perl5lib/lib/lib PREFIX=~/perl5lib -- NOT OK
Running make test
Can't test without successful make
Running make install
make had returned bad status, install seems impossible
Running make for K/KR/KRISTINA/MongoDB-0.45.tar.gz
Is already unwrapped into directory /dasd/home/miner/.cpan/build/MongoDB-0.45
CPAN.pm: Going to build K/KR/KRISTINA/MongoDB-0.45.tar.gz
make: *** No rule to make target `dasd/home/perl5lib/lib/lib'. Stop.
/usr/bin/make LIB= dasd/home/perl5lib/lib/lib PREFIX=~/perl5lib -- NOT OK
Running make test
Can't test without successful make
Running make install
make had returned bad status, install seems impossible
What does "No rule to make target `dasd/home/perl5lib/lib/lib' mean? I don't want to make that dir...I want to make the makefile echoed by cpan when they say this "Writing Makefile for File::Slurp". Which i think I want to be in the /dasd/home/perl5lib/lib/lib directory. I'm assuming we are doing File::Slurp because MongoDB depends on it in some way.
I wish I had a better way to phrase the question - but in short here it is: teach me what this all means - how can MyConfig.pm be changed to do what I want?

"No rule to make target `dasd/home/perl5lib/lib/lib'" means that you put a space between LIB= and dasd/home/perl5lib/lib/lib (when it should have been a /), making them separate arguments. make thinks that dasd/home/perl5lib/lib/lib is the name of a file you want it to build, and it doesn't know how.
I'd start by editing MyConfig.pm in a text editor and just search for LIB= dasd and replace it with LIB=/dasd.

You say your libraries are stored in /dasd/home/miner/perl5lib/lib/lib yet your config file has dasd/home/perl5lib/lib/lib.
You seem to need a leading / and a /miner step in the path.

Related

How do we add swift compile flag to `gym` when using fastlane

There are not much documentation about this here in the office documentation page https://docs.fastlane.tools/actions/gym/.
The only thing that mentioned compile flag is:
xcargs:
Pass additional arguments to xcodebuild for the build phase. Be sure to quote the setting names and values e.g. OTHER_LDFLAGS="-ObjC -lstdc++"
This is what we have currently:
gym(options.merge(:export_xcargs => "-allowProvisioningUpdates",
:export_method => "development"))
We would like now adding this flag to our build:
-Xfrontend -warn-long-expression-type-checking=100
We don't want to add it to Xcode project file like this https://github.com/fastred/Optimizing-Swift-Build-Times since we only want this check on the build machine which uses fastlane.
So this is what we tried:
gym(options.merge(:export_xcargs => "-allowProvisioningUpdates",
:export_method => "development",
:xcargs => "-Xfrontend -warn-long-expression-type-checking=100"))
But it keeps complaining about this error:
xcodebuild: error: invalid option '-Xfrontend'
How do we add this flag properly?
This works!
gym(options.merge(:export_xcargs => "-allowProvisioningUpdates",
:export_method => "development",
:xcargs => "OTHER_SWIFT_FLAGS='-Xfrontend -warn-long-expression-type-checking=100'"))
Since it's gym, use export_xcargs: instead of xcargs: and see related answer here if you need to assign a value for the flag - https://stackoverflow.com/a/57972046/4970749

Perl Invalid version format from Compat.pm

I'm trying to publish a module, and am running into a lot of weird errors, the latest of which is as follows:
C:\Shared\John\Perl\unifdef+.0.5.1>build disttest
Creating Makefile.PL
Invalid version format (non-numeric data) at C:/perl/lib/Module/Build/Compat.pm
line 134.
The code at the specified line is:
if ( my $minimum_perl = $requires->{perl} ) {
my $min_ver = version->new($minimum_perl)->numify;
print {$fh} "require $min_ver;\n";
}
so it looks like $minimum_perl is corrupted. I do have the line:
require 5.10.0;
In the code, but that should be OK according to the documentation I've read.
I tried upgrading various modules, and finally I tried a cpan upgrade, and upgraded my entire cpan, but I'm still getting the error. Can anyone tell me what I'm doing wrong? I am running perl 5.24.1
Ok, figured it out (sort of). I'm posting an answer, as I assume others will run into the same problem, and hopefully this will help them. My Build.PL script was a cut/paste/modify from an example on the web. I had the following:
use 5.010000; # NOT 5.8.8 - needed by CPAN testers
use Module::Build;
my $builder = Module::Build->new( module_name => 'code::unifdef+'
, license => 'perl'
, requires => { perl => '>= 5.10.0' } #hmm, this doesn't work...
, dist_version => '0.005.001'
, dist_author => 'John Ulvr <perldev#ulvr.com>'
, dist_abstract => 'processes conditional parts of makefiles, c/c++ and kconfig files'
, create_readme => 0
, create_makefile_pl => 'traditional'
);
$builder->create_build_script; #generate Build
The requires line was causing the problem. I'm not sure why though, as I've seen other similar examples on the web of the requires clause, so either everyone is wrong, or there's some sort of bug in in Compat.pm. Removing the requires line fixes the problem (I have requires in the .pl file itself, so it should catch out-of-date issues).

Testing for LibreSSL in a Perl build script

I released Net::NSCAng::Client a while ago and am getting a lot of test failures on OpenBSD. The reason for that is that the NSCAng protocol uses OpenSSL in preshared-key mode (RFC4279), something the folks at LibreSSL (default on OpenBSD now) have ripped out. However, they seem to have been hell-bent on doing this the most intransparent way: the include files have all the functions defined, just the shared library is missing the corresponding symbols, so compilation works fine but the tests fail.
There is a compatibility package on OpenBSD called eopenssl, and by testing for this first in Makefile.PL (using ExtUtils::PkgConfig) I can make it work if the compatibility library is installed. If it isn't, things still fail.
I could check for the CPP symbol OPENSSL_NO_PSK, but as the includes always come from LibreSSL, this fails even if linking with eopenssl would work fine. The only idea I have left is to try and have a test program run as part of the compilation phase as autoconf does it. Is that even possible with ExtUtils::MakeMaker (or something else -- I wouldn't mind switching the build system if necessary)?
It's easy to write feature tests with Devel::CheckLib. Something like the following can be used to check for the presence of function your_func (in Makefile.PL):
my $your_func_exists = check_lib(
header => 'your_header.h',
function => 'return your_func ? 1 : 0;',
);
If you simply want to abort compilation if the function is missing:
check_lib(
...
) or warn('your_func is missing'), exit;
Exiting with 0 should avoid a CPAN Tester's 'FAIL' report.

'make installdeps' fails with Net::FTP-related error

I am writing Catalyst application which uses Module::Install for module building. I keep all project-related modules in separate directory with local::lib:
eval $(perl -Mlocal::lib=$HOME/work/projects/freevideo)
Recently I've moved to amd64 environment, and 'make installdeps' stopped working:
nikita#freevideo-dev:~/fv$ make installdeps
/usr/bin/perl "-Iinc" Makefile.PL --config= \
--installdeps=Text::Table,0,Catalyst::Log::Log4perl,1.04,\
Catalyst::Plugin::Session,0,Catalyst::Plugin::Session::State::Cookie,0,\
Catalyst::Plugin::Session::Store::FastMmap,0,Catalyst::Plugin::Authentication,0,\
Catalyst::Plugin::Authorization::Roles,0,Catalyst::Plugin::Unicode,0,\
Catalyst::Plugin::SmartURI,0,Catalyst::Model::DBIC::Schema,0.5,\
Catalyst::View::JSON,0.33,Catalyst::View::TT,0.37,\
Template::Plugin::ListUtil,0.02,Template::Stash::ForceUTF8,0.03,\
Encode,2.43,DateTime,0.70,DateTime::Format::MySQL,0.04,\
Mail::RFC822::Address,0.3,Digest::MD5,2.51,Data::Dumper,2.131,DBIx::Class,0.08194
include /home/nikita/work/projects/freevideo/FreeVideo/inc/Module/Install.pm
include inc/Module/Install/Metadata.pm
include inc/Module/Install/Base.pm
include inc/Module/Install/Makefile.pm
Cannot determine perl version info from lib/FV.pm
Cannot determine license info from lib/FV.pm
include inc/Module/Install/Catalyst.pm
include inc/Module/Install/Include.pm
include inc/File/Copy/Recursive.pm
*** Module::Install::Catalyst
Please run "make catalyst_par" to create the PAR package!
*** Module::Install::Catalyst finished.
include inc/Module/Install/Scripts.pm
include inc/Module/Install/AutoInstall.pm
include inc/Module/AutoInstall.pm
*** Installing dependencies...
Can't use an undefined value as a symbol reference at \
/usr/share/perl/5.10/Net/FTP/dataconn.pm line 54.
Compilation failed in require at \
/usr/share/perl5/Module/Install/AutoInstall.pm line 37.
make: *** [installdeps] Error 111
Here's my Makefile.PL:
# IMPORTANT: if you delete this file your app will not work as
# expected. you have been warned
use inc::Module::Install;
use strict;
use warnings;
name 'FV';
all_from 'lib/FV.pm';
requires 'Moose'; # Moose is required for Catalyst
# Catalyst components
requires 'Catalyst::Runtime' => '5.7015';
requires 'Catalyst::Log::Log4perl' => '1.04';
requires 'Catalyst::Plugin::ConfigLoader';
requires 'Catalyst::Plugin::Static::Simple';
requires 'Catalyst::Plugin::Session';
requires 'Catalyst::Plugin::Session::State::Cookie';
requires 'Catalyst::Plugin::Session::Store::FastMmap';
requires 'Catalyst::Plugin::Authentication';
requires 'Catalyst::Plugin::Authorization::Roles';
requires 'Catalyst::Plugin::Unicode';
requires 'Catalyst::Plugin::SmartURI';
requires 'Catalyst::Action::RenderView';
requires 'Catalyst::Model::DBIC::Schema' => '0.5';
requires 'Catalyst::View::JSON' => '0.33';
requires 'Catalyst::View::TT' => '0.37';
# pragmas
requires 'parent';
requires 'utf8' => '1.07';
requires 'feature' => '1.13';
requires 'Config::General'; # This should reflect the config file format you've chosen
# See Catalyst::Plugin::ConfigLoader for supported formats
# Template Toolkit
requires 'Template' => '2.22';
requires 'Template::Plugin::ListUtil' => '0.02';
requires 'Template::Stash::ForceUTF8' => '0.03';
# other
requires 'POSIX' => '1.17';
requires 'Exporter' => '5.63';
requires 'Encode' => '2.43';
requires 'Data::GUID' => '0.046';
requires 'DateTime' => '0.70';
requires 'DateTime::Format::MySQL' => '0.04';
requires 'Mail::RFC822::Address' => '0.3';
requires 'Digest::MD5' => '2.51';
requires 'Data::Dumper' => '2.131';
requires 'File::Copy' => '2.14';
requires 'DBIx::Class' => '0.08194';
test_requires 'Test::More';
test_requires 'Test::Exception';
test_requires 'Text::Table';
catalyst;
install_script glob('script/*.pl');
auto_install;
WriteAll;
Everything runs on Ubuntu Natty amd64. Is there any workaround for this?
Solved! CPANPLUS had FTP mirrors written in its configuration, and I was too lazy to properly configure my ftp proxy. After replacing all ftp mirrors with http dependencies were successfully installed.
I had a similar error message : Can't use an undefined value as a symbol reference at /System/Library/Perl/5.12/Net/FTP/dataconn.pm line 54.
From reading Nikita answer, I made these changes to fix it:
sudo vim ~/.cpan/CPAN/MyConfig.pm
in the 'urllist' line: replace ftp by http

How do I find the standard site_perl directory for Perl?

How can I find the standard site_perl (non-arch specific) location? Is it safe to just loop over #INC and find the path ending with "site_perl", or is there a standard way to do this?
The reason for trying to find this, is I have a very large project built up from hundreds of individual modules, all with their own Makefile.PL files (pretty much every .pm file has been built as its own CPAN style module). Along with this, each module may have artifacts (templates, .cgi's, etc), in various locations, all which need to be deployed to various locations, nothing is standard. This is the first step in trying to get this under control, basically having a single Makefile which can find and deploy everything, the next step will be getting it in sensible layout in version control.
I've spent time trying to do this with standard installation tools, but have had no luck.
C:\Temp> perl -MConfig -e "print qq{$_ => $Config{$_}\n} for grep { /site/ } keys %Config"
d_sitearch => define
installsitearch => C:\opt\perl\site\lib
installsitebin => C:\opt\perl\site\bin
installsitehtml1dir =>
installsitehtml3dir =>
installsitelib => C:\opt\perl\site\lib
installsiteman1dir =>
installsiteman3dir =>
installsitescript => C:\opt\perl\site\bin
sitearch => C:\opt\perl\site\lib
sitearchexp => C:\opt\perl\site\lib
sitebin => C:\opt\perl\site\bin
sitebinexp => C:\opt\perl\site\bin
sitehtml1dir =>
sitehtml1direxp =>
sitehtml3dir =>
sitehtml3direxp =>
sitelib => C:\opt\perl\site\lib
sitelib_stem =>
sitelibexp => C:\opt\perl\site\lib
siteman1dir =>
siteman1direxp =>
siteman3dir =>
siteman3direxp =>
siteprefix => C:\opt\perl\site
siteprefixexp => C:\opt\perl\site
sitescript =>
sitescriptexp =>
usesitecustomize => define
Or, as #ysth points out in comments, you can use:
C:\Temp> perl -V:.*site.*
on Windows and
$ perl '-V:.*site.*'
in *nix shells.
Is there a reason not to use one of the module installers (ExtUtils::MakeMaker, Module::Build, Module::Install)?
But if you must, the directory is available (after loading Config) as $Config::Config{'installsitelib'}. Note that some platforms may configure perl such that this directory doesn't literally appear in #INC, instead having some other directory that's symlinked to the installsitelib directory.
Just run perl -V. It will print the default #INC at the end.
It is not safe to loop over #INC as it can be modified by code or the environment, and, therefore, may contain multiple directories that end in site_perl.
If you are trying to determine where a given module is installed use %INC.