Viewing the cpanm error log in Bitbucket pipelines when installing a Perl module fails - perl

I have a BitBucket Pipeline that installs a bunch of Perl modules using cpanm. One of them fails and this is the snippet I can see in the log:
Fetching http://www.cpan.org/authors/id/P/PE/PETDANCE/ack-v3.0.2.tar.gz ... OK
Configuring ack-v3.0.2 ... OK
==> Found dependencies: File::Next
--> Working on File::Next
Fetching http://www.cpan.org/authors/id/P/PE/PETDANCE/File-Next-1.16.tar.gz ... OK
Configuring File-Next-1.16 ... OK
Building and testing File-Next-1.16 ... OK
Successfully installed File-Next-1.16
! Installing App::Ack failed. See /root/.cpanm/work/1562605191.55/build.log for details. Retry with --force to force install it.
! Installing the dependencies failed: Module 'App::Ack' is not installed
! Bailing out the installation for ..
Building and testing ack-v3.0.2 ... FAIL
How could I access the build.log that was created by the installation process?

Apparently recently Bitbucket added a feature called "after-script" so I could add the following and that would print the content of the log files.
after-script:
- ls -1 /root/.cpanm/work/*/build.log | xargs cat
or maybe even this:
after-script:
- cat /root/.cpanm/work/*/build.log
and the following, I think, will only show the content of the log files if the build failed:
after-script:
- $BITBUCKET_EXIT_CODE && cat /root/.cpanm/work/*/build.log
Read more here: https://bitbucket.org/blog/after-scripts-now-available-for-bitbucket-pipelines

Related

NixOS - Issue packaging neovim plugin from github

I'm trying to add a neovim plugin that doesn't exist in nixpkgs yet (modes.nvim), but having trouble getting it to work.
I'm using NixOS 22.05, and Home Manager, and I am using the following to build this plugin:
pkgs.vimUtils.buildVimPlugin {
name = "modes-nvim";
src = pkgs.fetchFromGitHub {
owner = "mvllow";
repo = "modes.nvim";
rev = "3188692abf02a8838ec75e59d68c2ce3e4323f5c";
sha256 = "sha256-2QDpwQ9+F5t5gTR1KLVzRrvriwo5JUHatZEJnc0ojV8=";
};
}
Initially, I used lib.pkgs.fakeSha256 to get a "mismatched hash" error, and copy/pasted the has from that error message, so I think it's correct, though other things I've seen on the internet seem to have the SHA256 as a hex string, so not sure what's going on there.
When I run home-manager switch, I get the following error:
these 12 derivations will be built:
/nix/store/pna2lzjc3q56z59b2kfazzxi8m6swp8d-vimplugin-modes-nvim.drv
/nix/store/mnj1d881d8s57yj3y8wjy7i9nl3m089f-vimplugin-modes-nvim.drv
/nix/store/5l8vqvx2bbawkkj92s8qd0p5hw16pcmq-vim-pack-dir.drv
/nix/store/jgqf68sd50s79pydzs9154p509l5109v-hm_nviminit.vim.drv
/nix/store/rq8f75qr9ahrfr0hvp51inn19088bz5p-manifest.vim.drv
/nix/store/hbzm2xr6nv8mr2l9nrlf742fqdmw9nv3-neovim-0.7.2.drv
/nix/store/zks47ifk7njz1s8y7hvq357ac8z6azkd-neovim-0.7.2-fish-completions.drv
/nix/store/rkaa094vvyjcyy4v1zkh4f8xz64vqxas-cameron-fish-completions.drv
/nix/store/0073403x9b4wv13gm7a6bqy4765pi8g5-home-manager-files.drv
/nix/store/lxwpbhb6ryhwrff4cjyniff11843cf9x-home-manager-path.drv
/nix/store/xbbn44253wjh90md4hqrrc2wfpafkc55-activation-script.drv
/nix/store/ijwmv897xc2wlr1ij4a30vk4z154ikbf-home-manager-generation.drv
building '/nix/store/pna2lzjc3q56z59b2kfazzxi8m6swp8d-vimplugin-modes-nvim.drv'...
Sourcing vim-command-check-hook.sh
Using vimCommandCheckHook
Sourcing vim-gen-doc-hook
unpacking sources
unpacking source archive /nix/store/fcxyif8piqar9w9ynmi6ym71hw6zsy7a-source
source root is source
patching sources
configuring
no configure script, doing nothing
building
build flags: SHELL=/nix/store/iffl6dlplhv22i2xy7n1w51a5r631kmi-bash-5.1-p16/bin/bash
test -r dependencies/pack/vendor/start/plenary.nvim || git clone --depth=1 https://github.com/nvim-lua/plenary.nvim.git dependencies/pack/vendor/start/plenary.nvim
/nix/store/iffl6dlplhv22i2xy7n1w51a5r631kmi-bash-5.1-p16/bin/bash: line 1: git: command not found
make: *** [Makefile:7: install_dependencies] Error 127
error: builder for '/nix/store/pna2lzjc3q56z59b2kfazzxi8m6swp8d-vimplugin-modes-nvim.drv' failed with exit code 2;
last 10 log lines:
> unpacking source archive /nix/store/fcxyif8piqar9w9ynmi6ym71hw6zsy7a-source
> source root is source
> patching sources
> configuring
> no configure script, doing nothing
> building
> build flags: SHELL=/nix/store/iffl6dlplhv22i2xy7n1w51a5r631kmi-bash-5.1-p16/bin/bash
> test -r dependencies/pack/vendor/start/plenary.nvim || git clone --depth=1 https://github.com/nvim-lua/plenary.nvim.git dependencies/pack/vendor/start/plenary.nvim
> /nix/store/iffl6dlplhv22i2xy7n1w51a5r631kmi-bash-5.1-p16/bin/bash: line 1: git: command not found
> make: *** [Makefile:7: install_dependencies] Error 127
For full logs, run 'nix log /nix/store/pna2lzjc3q56z59b2kfazzxi8m6swp8d-vimplugin-modes-nvim.drv'.
error: 1 dependencies of derivation '/nix/store/mnj1d881d8s57yj3y8wjy7i9nl3m089f-vimplugin-modes-nvim.drv' failed to build
error: 1 dependencies of derivation '/nix/store/5l8vqvx2bbawkkj92s8qd0p5hw16pcmq-vim-pack-dir.drv' failed to build
error: 1 dependencies of derivation '/nix/store/jgqf68sd50s79pydzs9154p509l5109v-hm_nviminit.vim.drv' failed to build
error: 1 dependencies of derivation '/nix/store/rq8f75qr9ahrfr0hvp51inn19088bz5p-manifest.vim.drv' failed to build
error: 1 dependencies of derivation '/nix/store/0073403x9b4wv13gm7a6bqy4765pi8g5-home-manager-files.drv' failed to build
error: 1 dependencies of derivation '/nix/store/hbzm2xr6nv8mr2l9nrlf742fqdmw9nv3-neovim-0.7.2.drv' failed to build
error: 1 dependencies of derivation '/nix/store/ijwmv897xc2wlr1ij4a30vk4z154ikbf-home-manager-generation.drv' failed to build
It appears to be failing due to git not being found. Of course, I have git installed for me, but perhaps this command is being run in an environment that doesn't have access to my installed packages.
I'm very new to Nix and NixOS, so I'm not really sure how to begin fixing this issue. I've searched online for answers, but haven't found anything about this issue. Any advice is much appreciated.

How to debug program compilation when Perl module fails

I'm trying to compile Slic3r 1.2.9 (Git 65a23b) on Raspbian, and running sudo perl Build.PL --verbose fails while building the Perl module Time-HiRes-1.9754:
...
--> Working on Time::HiRes
Fetching http://www.cpan.org/authors/id/J/JH/JHI/Time-HiRes-1.9754.tar.gz ... OK
Configuring Time-HiRes-1.9754 ... FAIL
! Timed out (> 60s). Use --verbose to retry.
! Configure failed for Time-HiRes-1.9754. See /root/.cpanm/work/1520227993.988/build.log for details.
The log file shows a little more information, but I've never worked with Perl and I don't know where to start debugging:
$ tail /root/.cpanm/work/1520234788.2186/build.log
Looking for clock_getres()... found.
Looking for clock_nanosleep()... found.
Looking for clock()... found.
Looking for working futimens()... found.
Looking for working utimensat()... found.
You seem to have subsecond timestamp setting.
Looking for stat() subsecond timestamps...
Trying struct stat st_atimespec.tv_nsec...-> FAIL Timed out (> 60s). Use --verbose to retry.
-> N/A
-> FAIL Configure failed for Time-HiRes-1.9754. See /root/.cpanm/work/1520234788.2186/build.log for details.
I've posted an issue with Slic3r on GitHub, but I haven't had any suggestions yet - presumably it's not actually a problem with Slic3r itself.
What should I do next to work out what's going wrong?

Perl cpan: error installing DateTime, CHECKSUM download failure

I am running Perl 5.10 on a shared Red Hat Linux 6.2 server. I have asked the root user of the machine to install the Perl DateTime module for me, using the following commands:
perl -MCPAN -e shell
cpan> install DateTime
We were able to successfully install other Perl modules such as Text::CSV before.
But the following error occurred while installing DateTime. Here is the last bits of error log:
Question: It looks like the error might be complaining about not being able to fetch the CHECKSUM file from ftp://ftp.perl.org/pub/CPAN/authors/id/R/RJ/RJBS. However, I have no problem browsing to this exact file from my Internet Explorer. Can someone suggest ways to workaround this? Thanks.
Trying with "/usr/bin/wget -O /root/.cpan/sources/authors/id/R/RJ/RJBS/CHECKSUMS.tmp12173" to get
"ftp://ftp.perl.org/pub/CPAN/authors/id/R/RJ/RJBS/CHECKSUMS.gz"
--2013-06-20 09:30:06-- ftp://ftp.perl.org/pub/CPAN/authors/id/R/RJ/RJBS/CHECKSUMS.gz
=> b/root/.cpan/sources/authors/id/R/RJ/RJBS/CHECKSUMS.tmp12173b
Resolving ftp.perl.org... 203.178.137.175, 163.143.1.21 Connecting to ftp.perl.org|203.178.137.175|:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done. ==> PWD ... done.
==> TYPE I ... done. ==> CWD (1) /pub/CPAN/authors/id/R/RJ/RJBS ... done.
==> SIZE CHECKSUMS.gz ... done.
==> PASV ... done. ==> RETR CHECKSUMS.gz ...
No such file bCHECKSUMS.gzb.
Warning: no success downloading '/root/.cpan/sources/authors/id/R/RJ/RJBS/CHECKSUMS.tmp12173'. Giving up on it. at /usr/share/perl5/CPAN/Distribution.pm line
1311
As a last resort we now switch to the external ftp command '/usr/kerberos/bin/ftp'
to get '/root/.cpan/sources/authors/id/R/RJ/RJBS/CHECKSUMS.tmp12173'.
Doing so often leads to problems that are hard to diagnose.
If you're the victim of such problems, please consider unsetting the ftp config variable with
o conf ftp ""
o conf commit
Issuing "/usr/kerberos/bin/ftp -n"
Trying with external ftp to get
ftp://ftp.perl.org/pub/CPAN/authors/id/R/RJ/RJBS/CHECKSUMS
Going to send the dialog
open ftp.perl.org
user anonymous Red Hat, Inc.#localhost.localdomain
lcd /root/.cpan/sources/authors/id/R/RJ/RJBS
cd /
cd pub
cd CPAN
cd authors
cd id
cd R
cd RJ
cd RJBS
bin
get CHECKSUMS CHECKSUMS.tmp12173
quit
Not connected.
Local directory now /root/.cpan/sources/authors/id/R/RJ/RJBS
Not connected.
Not connected.
Not connected.
Not connected.
Not connected.
Not connected.
Not connected.
Not connected.
Not connected.
Not connected.
Bad luck... Still failed!
Can't access URL ftp://ftp.perl.org/pub/CPAN/authors/id/R/RJ/RJBS/CHECKSUMS.
Your urllist is empty! The urllist can be edited. E.g. with 'o conf urllist push ftp://myurl/'
Could not fetch authors/id/R/RJ/RJBS/CHECKSUMS
UPDATE1:
We also tried the o conf ftp "" and o conf commit commands, but we still had an error.
Trying with "/usr/bin/wget -O /root/.cpan/sources/authors/id/R/RJ/RJBS/CHECKSUMS.tmp16529" to get
"http://www.perl.org/CPAN/authors/id/R/RJ/RJBS/CHECKSUMS.gz"
--2013-06-20 13:52:07-- http://www.perl.org/CPAN/authors/id/R/RJ/RJBS/CHECKSUMS.gz
Resolving www.perl.org... 207.171.7.41, 207.171.7.51 Connecting to www.perl.org|207.171.7.41|:80... failed: Connection refused.
Connecting to www.perl.org|207.171.7.51|:80... failed: Connection refused.
Warning: no success downloading '/root/.cpan/sources/authors/id/R/RJ/RJBS/CHECKSUMS.tmp16529'. Giving up on it. at /usr/share/perl5/CPAN/Distribution.pm line
1311
Fetching with LWP:
ftp://ftp.perl.org/pub/CPAN/authors/id/R/RJ/RJBS/CHECKSUMS
Checksum for /root/.cpan/sources/authors/id/R/RJ/RJBS/Test-Fatal-0.010.tar.gz ok Test-Fatal-0.010 Test-Fatal-0.010/README Test-Fatal-0.010/Changes Test-Fatal-0.010/LICENSE Test-Fatal-0.010/dist.ini Test-Fatal-0.010/META.yml Test-Fatal-0.010/MANIFEST Test-Fatal-0.010/t Test-Fatal-0.010/t/basic.t Test-Fatal-0.010/META.json Test-Fatal-0.010/Makefile.PL Test-Fatal-0.010/lib/Test Test-Fatal-0.010/lib/Test/Fatal.pm
Test-Fatal-0.010/t/like-exception.t
Test-Fatal-0.010/t/release-pod-syntax.t
CPAN.pm: Going to build R/RJ/RJBS/Test-Fatal-0.010.tar.gz
Checking if your kit is complete...
Looks good
Warning: prerequisite Try::Tiny 0.07 not found.
Writing Makefile for Test::Fatal
Could not read '/root/.cpan/build/Test-Fatal-0.010-GNYnPy/META.yml'. Falling back to other methods to determine prerequisites
---- Unsatisfied dependencies detected during ----
---- RJBS/Test-Fatal-0.010.tar.gz ----
Try::Tiny [requires]
Shall I follow them and prepend them to the queue of modules we are processing right now? [yes] Running make test
Delayed until after prerequisites
Running make install
Delayed until after prerequisites
Running install for module 'Try::Tiny'
'YAML' not installed, falling back to Data::Dumper and Storable to read prefs '/root/.cpan/prefs'
Running make for D/DO/DOY/Try-Tiny-0.12.tar.gz Fetching with LWP:
http://www.perl.org/CPAN/authors/id/D/DO/DOY/Try-Tiny-0.12.tar.gz
LWP failed with code[500] message[Can't connect to www.perl.org:80 (connect: Connection refused)] Fetching with LWP:
ftp://ftp.perl.org/pub/CPAN/authors/id/D/DO/DOY/Try-Tiny-0.12.tar.gz
LWP failed with code[500] message[]
Fetching with Net::FTP:
ftp://ftp.perl.org/pub/CPAN/authors/id/D/DO/DOY/Try-Tiny-0.12.tar.gz
Catching error: "Timeout at /usr/share/perl5/Net/FTP.pm line 491\cJ" at /usr/share/perl5/CPAN.pm line 391
CPAN::shell() called at -e line 1
did you do what it suggested?
If you're the victim of such problems, please consider unsetting the ftp config variable with
o conf ftp ""
o conf commit
Alternatively, you can download the module as a gz file from the cpan site
uncompress it cd to the directory
do
perl Build.PL
./Build install
or
perl Makefile.PL
make install
accordingly.
This is all that cpan will be doing so you will see if you're missing any packages or modules
incidentally, you don't need to be root if you are happy to install your modules somewhere else. There are plenty of examples to achieve this

How to set node path for nodejs (Ubuntu)

I'm trying to setup nodejs to access a postgres database. What I've done so far is the following (https://gist.github.com/579814):
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl http://npmjs.org/install.sh | sh
then
git clone git://github.com/isaacs/npm.git
make
make install
so far, so good. However, when I try to install the postgres driver
npm install pg
I get the following:
node-waf configure build || true
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for node path : not found
Checking for node prefix : ok /usr/local
Checking for program pg_config : /usr/bin/pg_config
'configure' finished successfully (0.066s)
Waf: Entering directory `/home/christian/node_modules/pg/build'
[1/2] cxx: src/binding.cc -> build/default/src/binding_1.o
../src/binding.cc:3:25: fatal error: node_events.h: No such file or directory
compilation terminated.
Waf: Leaving directory `/home/christian/node_modules/pg/build'
Build failed: -> task failed (err #1):
{task: cxx binding.cc -> binding_1.o}
I've been looking around for setting the node path, although haven't found anything of help so far - probably also because I'm totally new to nodejs, so I'd be happy about any hint.
Now, you have NodeJS installed in your Ubuntu. You should set /etc/environment and load nodeJS path that can be executed by another users. For example:
NODE="/home/ubuntu/local/node"
NODE_PATH="/usr/local/lib/node_modules"
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:$NODE/bin:$NODE/lib/node_modules"
#PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
Do this in bash:
echo 'export NODE_PATH=~/local/:~/local/node_modules' >> ~/.bashrc
before things are fixed you must use node 0.5.1 (you can use gitk to revert the tree to this version)
Auteur: Ryan Dahl <ry#tinyclouds.org> 2011-07-19 10:46:38
Auteur du commit: Ryan Dahl <ry#tinyclouds.org> 2011-07-19 10:46:38
Parent: 0a3fc1d9c8becc32c63ae736ca2b3719a3d03c5b (Remove StatWatcher's dep on C++ EventEmitter)
Enfant: 061ce7b0ac370c8a5ae93d95ab7da171cbd488f0 (net_uv: Fix simple/test-http-expect-continue.js)
Branche: master, remotes/origin/master
Suit: v0.5.1
Précède: v0.5.2
Finally remove node::EventEmitter
I had the same problem.
The issue was that I was specifying a old version of PG in my package.js
After I removed the old version dependancy I was able to install PG without issue.

Error while starting Apache

I am getting following error while starting apache.
Can't locate /usr/sbin/webmux.pl in #INC (#INC contains: /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 . /etc/httpd) at (eval 2) line 1.\n
Can't load Perl file: /usr/sbin/webmux.pl for server 127.0.0.1:0, exiting...
Can anyone please suggest me what i am missing ?
mod_perl-2.0.4
So, it looks like webmux.pl needs the mysql daemon started first. I found the error message in /var/log/httpd/error_log. Start mysqld first and then the web server will start
Search your Apache config files for webmux.pl. Something must be trying to load it. Either remove the reference to it, or install it.
Found this in RT configs. After comment it, things are working now.
Error:
[root#localhost conf]# service httpd restart
Deteniendo httpd: [FALLÓ]
Iniciando httpd: [FALLÓ]
[root#localhost conf]#
Log:
[error] Can't load Perl file: /usr/sbin/webmux.pl for server localhost.localdomain:0, exiting...
DBI connect('dbname=rt3;host=localhost','rt_user',...) failed: Access denied for user 'rt_user'#'localhost' (using password: YES) at /usr/share/perl5/DBIx/SearchBuilder/Handle.pm line 106
Solution:
[root#localhost conf]# mkdir /root/backup/httpd/ -p
[root#localhost conf]# mv /etc/httpd/conf.d/rt3.conf /root/backup/httpd/
[root#localhost conf]# service httpd restart
Deteniendo httpd: [ OK ]
Iniciando httpd: [ OK ]
[root#localhost conf]#
here is what i found on http://wiki.bestpractical.com/view/Troubleshooting
Can't locate Apache/Response.pm in #INC ...
Can't load Perl file: bin/webmux.pl for server localhost:0, exiting...
Found this issue in Aurora SPARC Linux 2.0 (Fedora Core 3 for SPARC)
when trying to install...
turns out that after installing all the modules for rt,
I still had an ancient verion of CGI.pm,
which was not intended to correctly detect the mod_perl2 modules vs.
regular mod_perl. Upgrading CGI via CPAN quickly resolved this problem after an
embarrassing number of hours troubleshooting.
If Apache refuses to start after you add PerlRequire bin/webmux.pl to your
config and you're sure you've got a valid mod_perl2 installation,
try upgrading CGI to the latest version.
maybe you can try first to update your CGI.pm module.
Did you find your call to webmux.pl in your apache conf ?
old previous useless response :
well, can you post the code from the script that tries to launch webmux.pl ?
but i would suggest a simple solution, if you don't have administrative rights or don't want
to go further in your perl conf :
add at top of your code (but below use strict...never forget this one)
in your script the code :
use lib "/usr/sbin/"
so you script will be able to use libraries located in /usr/sbin/