Why doesn't LWP.pm work on Mac OSX? - macos

I have a Mac Book Pro, it has Perl.
I have a script with includes.
use LWP ;
use HTTP::Request::Common qw{ POST };
use HTML::Form;
LWP so I ran (twice once as root once as normal user) Guide I followed
perl -MCPAN -e 'shell'
install Bundle::LWP
install HTML::Tree
install HTML::Form
Warning: Cannot install HTML::Format, don't know what it is.
It says its missing two dependencies, but when I install them it says they are already done...?
Pastebin showing the output of the dependencies problem
When I run the script this is the error I get:
Can't locate LWP.pm in #INC (#INC contains: /opt/local/lib/perl5/site_perl/5.16.3/darwin-thread-multi-2level /opt/local/lib/perl5/site_perl/5.16.3 /opt/local/lib/perl5/vendor_perl/5.16.3/darwin-thread-multi-2level /opt/local/lib/perl5/vendor_perl/5.16.3 /opt/local/lib/perl5/5.16.3/darwin-thread-multi-2level /opt/local/lib/perl5/5.16.3 /opt/local/lib/perl5/site_perl /opt/local/lib/perl5/vendor_perl .) at NMLRegAttack2.pl line 1.
BEGIN failed--compilation aborted at NMLRegAttack2.pl line 1.

build_dir_reuse is not set correctly
Solution
cpan
conf build_dir_reuse 0
o conf commit
exit

Related

Perl can't install Glib on Mac Big Sur

I'm trying to install Gtk2 from CPAN on my Mac (Big Sur), but it requires Glib, and Glib install is failing. The tail of the installer output is here:
echo Generating POD...
Generating POD...
"/usr/bin/perl" -I blib/lib -I blib/arch -MGlib::GenPod -MGlib \
-e "add_types (qq(doctypes)); Glib::GenPod::set_copyright(qq/Copyright (C) 2003-2011 by the gtk2-perl team.\n\nThis software is licensed under the LGPL. See L<Glib> for a full notice.\n/); Glib::GenPod::set_main_mod(qq(Glib)); xsdoc2pod(q(build/doc.pl), q(blib/lib), q(build/podindex));"
Can't load 'blib/arch/auto/Glib/Glib.bundle' for module Glib: dlopen(blib/arch/auto/Glib/Glib.bundle, 0x0001): open("", O_RDONLY) failed with errno=2 at /System/Library/Perl/5.30/darwin-thread-multi-2level/DynaLoader.pm line 197.
at blib/lib/Glib/GenPod.pm line 21.
Compilation failed in require at blib/lib/Glib/GenPod.pm line 21.
BEGIN failed--compilation aborted at blib/lib/Glib/GenPod.pm line 21.
Compilation failed in require.
BEGIN failed--compilation aborted.
make: *** [build/podindex] Error 2
FAIL
! Installing Glib failed. See /Users/principal/.cpanm/work/1626461722.68580/build.log for details. Retry with --force to force install it.
Retry with --force gives the same results. The specified build.log file gives less detail than the console output above.
If I understand what it's telling me, it is that the GenPod.m module fails at the point where it is trying to "use Glib;". But when I look at the specified search point (blib/arch/auto/Glib/Glib.bundle) there is such a file there.
I'm using the Mac-installed Perl (5.30) and have had no other issues installing via CPAN. Any help would be appreciated. I would even welcome knowing how to bypass the "GenPod" step, as having working code is better than having documentation. The latest post I could find on the topic of Glib failing to install on Mac was four years ago in the El Capitan days, and the OP there was having an entirely different problem.

gendef returning invalid syntax error

I am trying to install Theano for machine learning on my Windows 7 computer.
One of the last steps in installing the dependencies is to 'create a link library for GCC' by 'Opening up the Python shell and cd to C:\SciSoft. Then execute:
gendef WinPython-64bit-2.7.9.4\python-2.7.9.amd64\python27.dll
dlltool --dllname python27.dll --def python27.def --output-lib WinPython-
64bit-2.7.9.4\python-2.7.9.amd64\libs\libpython27.a
I've tried doing this but I get a invalid syntax error highlighted on 'WinPython'. I tried changing directory to go deeper and running gendef again and it also returned the same error. This is a copy and paste job from http://deeplearning.net/software/theano/install_windows.html#install-windows
I also followed the tutorial at the link to install Theano.
The line "Finally we need to create a link library for GCC. Open up the Python shell and cd to c:\SciSoft" is probably an error; "the Python shell" should be modified to "cmd.exe".
The two-line scripts are not python scripts, and can be successfully run on cmd.exe after changing directory to c:\SciSoft.

Mac OSX Perl cannot find DBD::mysql in #INC

I have installed CPAN module DBD::mysql via sudo cpan install DBD::mysql in order to run the code below, however I keep getting the error message:
Can't locate loadable object for module DBD::mysql in #INC (#INC contains:
/sw/lib/perl5/5.12.3/darwin-thread-multi-2level
/sw/lib/perl5/5.12.3
/sw/lib/perl5/darwin-thread-multi-2level
/sw/lib/perl5
/sw/lib/perl5/darwin
/Library/Perl/5.12/darwin-thread-multi-2level
/Library/Perl/5.12
/Network/Library/Perl/5.12/darwin-thread-multi-2level
/Network/Library/Perl/5.12
/Library/Perl/Updates/5.12.3/darwin-thread-multi-2level
/Library/Perl/Updates/5.12.3
/System/Library/Perl/5.12/darwin-thread-multi-2level
/System/Library/Perl/5.12
/System/Library/Perl/Extras/5.12/darwin-thread-multi-2level
/System/Library/Perl/Extras/5.12
.
)
at dbi_write.pl line 11
Compilation failed in require at dbi_write.pl line 11.
BEGIN failed--compilation aborted at dbi_write.pl line 11.
This is my code
#!/usr/bin/perl
#use lib '/usr/bin/cpan';
use strict;
use FileHandle;
use File::Spec;
use DBI;
use DBD::mysql;
Did your CPAN install succeed? If it did, then the module has been installed in the wrong place for the version of Perl you are running.
Look at the CPAN log to see where DBD::mysql has been installed. The answer lies there, and the fix depends on where it has been installed and why it isn't in your Perl's #INC.
Do you have multiple installations of Perl?
By the way, you don't have to use DBD::mysql. DBI will load it automatically when you call DBI->new specifying a MySQL source. That tidies up the code at the expense of loading the driver module at run time - a small price to pay.
I solved it by doing the following:
copy libmysqlclient.18.dylib into /usr/lib/
Also, there are two different Perls in my Mac OS X. One in /usr/local/ActivePerl5.16/ And another in /Systems/Library/Per/Perl5.12

How to include other folders within the #INC for Perl? (Was: `Can't locate Git.pm in #INC` for svn2git)

I am attempting to import an svn repo into git via svn2git. When I run svn2git --verbose https://url_to_repo I end up getting the following output:
Running command: git svn init --prefix=svn/ --no-metadata --trunk=trunk --tags=tags --branches=branches https://url_for_repository
Can't locate Git.pm in #INC (#INC contains: /usr/lib/perl5/site_perl/5.8.8 /home/cpdirect/perl5/lib/perl5 /usr/local/lib/perl5/5.8.8/x86_64-linux /usr/local/lib/perl5/5.8.8 /usr/local/lib/perl5/site_perl/5.8.8/x86_64-linux /usr/local/lib/perl5/site_perl/5.8.8 /usr/local/lib/perl5/site_perl .) at /usr/libexec/git-core/git-svn line 80.
BEGIN failed--compilation aborted at /usr/libexec/git-core/git-svn line 80.
command failed:
2>&1 git svn init --prefix=svn/ --no-metadata --trunk=trunk --tags=tags --branches=branches https://url_for_repository
It is obvious that Perl is unable to find the module within the path, however everything I've tried so far on CentOS 5.9 has not yielded results. For example, the following are installed:
git-1.7.11.3-1.el5.rf
git-svn-1.7.11.3-1.el5.rf
cpanel-git-1.7.11.3-1.cp1136
Any ideas of how to resolve this issue?
So it turns out that for some reason Perl doesn't know how to look at /usr/lib/perl5/vendor_perl/5.8.8/. If I make links to every module that it needs within /usr/lib/perl5/site_perl/5.8.8 it works seemingly fine and without error.
So the real question here is HOW do you force Perl to look under that vendor_perl folder?
So I've discovered how to add multiple libs and it solves the missing Perl libs:
PERL5LIB="/usr/lib/perl5/vendor_perl/5.8.8/:/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi" svn2git -v file:///my/path/to/svn/repo

perl module installation shared host

My shared hosting is missing two Perl modules required by Amazon SES Scripts. They are:
Digest::SHA and XML::LibXML
I downloaded Digest::SHA from here and XML::LibXML from here
Extracted, and uploaded LibXML.pm and SHA.pm to my custome directory (my_perl_lib).
I have added:
use lib "/var/chroot/home/content/09/6758009/html/my_perl_lib";
to the second line to the perl script.
I get this:
Can't locate XML/LibXML.pm in #INC (#INC contains: /var/chroot/home/content/09/6758009
/html/my_perl_lib /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 .) at ./ses-get-stats.pl line 24.
BEGIN failed--compilation aborted at ./ses-get-stats.pl line 24.
Please advise.
Updated:
thanks, i created the directory, the error gone, but i faced another one:
Can't locate loadable object for module XML::LibXML in #INC (#INC contains: /var/chroot
/home/content/09/6758009/html/my_perl_lib .......) at /var/chroot/home/content/09/6758009
/html/my_perl_lib/XML/LibXML.pm line 153 BEGIN failed--compilation aborted at /var/chroot
/home/content/09/6758009/html/my_perl_lib/XML/LibXML.pm line 153. Compilation failed in require
at ./ses-get-stats.pl line 24. BEGIN failed--compilation aborted at ./ses-get-stats.pl line 24.
Updated:
thanks again for your reply.
here are the results:
-bash-3.2$ perl Makefile.PL INSTALL_BASE=/var/chroot/home/content/09/6758009/html/my_perl_lib
enable native perl UTF8
running xml2-config...ok (2.6.26)
looking for -lxml2... no
looking for -llibxml2... no
libxml2 not found
Try setting LIBS and INC values on the command line
Or get libxml2 from
http://xmlsoft.org/
If you install via RPMs, make sure you also install the -devel
RPMs, as this is where the headers (.h files) are.
Also, you may try to run perl Makefile.PL with the DEBUG=1 parameter
to see the exact reason why the detection of libxml2 installation
failed or why Makefile.PL was not able to compile a test program.
-bash-3.2$
It needs to be inside an "XML" directory... IE, make sure that LibXML.pm is actually in /var/chroot/home/content/09/6758009/html/my_perl_lib/XML/LibXML.pm.
Updated:
You probably need to do a full local install of the perl module, and the shared object that accompanies it. You can do this by using:
# extract sources
# cd source-directory
# perl Makefile.PL INSTALL_BASE=/var/chroot/home/content/09/6758009/html/my_perl_lib
# make
# make install
This will install everything needed into that directory. Then in the script, reference both of these paths:
use lib '/var/chroot/home/content/09/6758009/html/my_perl_lib/lib/perl5';
use lib '/var/chroot/home/content/09/6758009/html/my_perl_lib/lib/perl5/i386-linux-thread-multi/auto';
Note that you'll likely need to change the architecture of the i386-linux-thread-multi part of that line. That's where the .so file is installed.

Resources