git-svn Can't locate SVN/Core.pm after fresh installation of macOS Catalina 10.15.4 - macos

Recently I reinstalled macOS Catalina 10.15.4. After I installed Command_Line_Tools_11.4.1, it told me svn is no longer working with Xcode. Then I installed both git and svn by brew, hopefully git-svn would work. Unfortunately got this error message:
Can't locate SVN/Core.pm in #INC (you may need to install the SVN::Core module) (#INC contains: /usr/local/Cellar/git/2.26.2/share/perl5 /Applications/Xcode.app/Contents/Developer/Library/Perl/5.18/darwin-thread-multi-2level /Library/Developer/CommandLineTools/Library/Perl/5.18/darwin-thread-multi-2level /Library/Perl/5.18/darwin-thread-multi-2level /Library/Perl/5.18 /Network/Library/Perl/5.18/darwin-thread-multi-2level /Network/Library/Perl/5.18 /Library/Perl/Updates/5.18.4 /System/Library/Perl/5.18/darwin-thread-multi-2level /System/Library/Perl/5.18 /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level /System/Library/Perl/Extras/5.18 .) at /usr/local/Cellar/git/2.26.2/share/perl5/Git/SVN/Utils.pm line 6.
Both git & svn are the latest version.
Please help me out.

Finally I figure it out!!!
Open the git-svn file (perl script, in my case file location is /usr/local/opt/git/libexec/git-core/git-svn), change the first line #!/usr/bin/perl to #!/usr/local/bin/perl
And it works!
I guess system perl doesn't include perl SVN/Core, but brew perl has it (dependency of brew svn).

Solution for MacOS Big Sur 11.5
After struggling with this error for hours:
Can't locate SVN/Core.pm in #INC (you may need to install the SVN::Core module)
I've finally found a solution that actually works.
If you run:
brew reinstall subversion
It will print a message like this:
The perl bindings are located in various subdirectories of:
/usr/local/opt/subversion/lib/perl5
Then you just need to run this command before using git svn to load the SVN module from the correct path:
export PERL5LIB=/usr/local/opt/subversion/lib/perl5/site_perl/5.30.2/darwin-thread-multi-2level

Solution for those, who, like me - want to use Sourcetree client on macOS Catalina with git-svn:
First step:
brew install git
brew install perl
brew install subversion
edit
/usr/local/Cellar/git/git_version/libexec/git-core/git-svn
replace
#!/usr/bin/perl
with
#!/usr/local/bin/perl
Second step, install missed perl modules:
cpan SVN::Core
cpan Term::ReadKey
Third step, configure SourceTree:
In Sourcetree->Preferences - set option "use system git", from:
/usr/local/Cellar/git/git_version/git

While not a permanent fix, a workaround is to set ${GITPERLLIB}:
$ export GITPERLLIB=/usr/local/Cellar/git/2.31.1/share/perl5:/usr/local/lib/perl5/site_perl/5.28.2/darwin-thread-multi-2level
$ git svn clone svn+ssh://...
worked for me without editing any scripts installed by brew.

Ensure you've installed Perl, Subversion and dependencies via Homebrew:
brew install perl subversion apr apr-util
Install required Perl modules into ~/perl5:
export PATH="/usr/local/opt/apr/bin:/usr/local/opt/apr-util/bin:$PATH"
PERL_MM_OPT="INSTALL_BASE=$HOME/perl5" cpan local::lib Git::SVN SVN::Core
Verify installed modules by:
PERL5LIB="$HOME/perl5" cpan -l | grep SVN
Then configure Perl as following (based on brew info perl steps):
eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib=$HOME/perl5)"
Finally run Git's SVN:
PERLLIB="$HOME/perl5" git svn clone https://svn.somecode.example.com/svn/trunk
If you're still stuck, try GitHub and GitLab websites which offer migration with a Git/SVN.
E.g. in GitHub, create a new repository, then import the project by pasting old repository’s clone URL.

The error message says:
$ git svn --version
Can't locate SVN/Core.pm in #INC (you may need to install the SVN::Core module) (#INC contains: /usr/local/opt/subversion/lib/perl5 /usr/local/Cellar/git/2.31.1/share/perl5 /Applications/Xcode.app/Contents/Developer/Library/Perl/5.28/darwin-thread-multi-2level /Library/Developer/CommandLineTools/Library/Perl/5.28/darwin-thread-multi-2level /Library/Perl/5.30/darwin-thread-multi-2level /Library/Perl/5.30 /Network/Library/Perl/5.30/darwin-thread-multi-2level /Network/Library/Perl/5.30 /Library/Perl/Updates/5.30.2 /System/Library/Perl/5.30/darwin-thread-multi-2level /System/Library/Perl/5.30 /System/Library/Perl/Extras/5.30/darwin-thread-multi-2level /System/Library/Perl/Extras/5.30) at /usr/local/Cellar/git/2.31.1/share/perl5/Git/SVN/Utils.pm line 6.
BEGIN failed--compilation aborted at /usr/local/Cellar/git/2.31.1/share/perl5/Git/SVN/Utils.pm line 6.
Compilation failed in require at /usr/local/Cellar/git/2.31.1/share/perl5/Git/SVN.pm line 25.
BEGIN failed--compilation aborted at /usr/local/Cellar/git/2.31.1/share/perl5/Git/SVN.pm line 32.
Compilation failed in require at /usr/local/Cellar/git/2.31.1/libexec/git-core/git-svn line 23.
BEGIN failed--compilation aborted at /usr/local/Cellar/git/2.31.1/libexec/git-core/git-svn line 23.
This is because git-svn is implemented by Perl, it needs a Perl library called SVN::Core to run。
Changing the first line of git-svn script from #!/usr/bin/perl to #!/usr/local/bin/perl won't fix this error!!! Because this just changes the Perl library from system default version to brew installed version。If the brew installed version doesn't contains SVN::Core, it'll still fail:
$ git svn --version
Can't locate SVN/Core.pm in #INC (you may need to install the SVN::Core module) (#INC contains: /usr/local/Cellar/git/2.31.1/share/perl5 /Applications/Xcode.app/Contents/Developer/Library/Perl/5.28/darwin-thread-multi-2level /Library/Developer/CommandLineTools/Library/Perl/5.28/darwin-thread-multi-2level /usr/local/Cellar/perl/5.34.0/lib/perl5/site_perl/5.34.0/darwin-thread-multi-2level /usr/local/Cellar/perl/5.34.0/lib/perl5/site_perl/5.34.0 /usr/local/Cellar/perl/5.34.0/lib/perl5/5.34.0/darwin-thread-multi-2level /usr/local/Cellar/perl/5.34.0/lib/perl5/5.34.0 /usr/local/lib/perl5/site_perl/5.34.0/darwin-thread-multi-2level /usr/local/lib/perl5/site_perl/5.34.0) at /usr/local/Cellar/git/2.31.1/share/perl5/Git/SVN/Utils.pm line 6.
BEGIN failed--compilation aborted at /usr/local/Cellar/git/2.31.1/share/perl5/Git/SVN/Utils.pm line 6.
Compilation failed in require at /usr/local/Cellar/git/2.31.1/share/perl5/Git/SVN.pm line 25.
BEGIN failed--compilation aborted at /usr/local/Cellar/git/2.31.1/share/perl5/Git/SVN.pm line 32.
Compilation failed in require at /usr/local/Cellar/git/2.31.1/libexec/git-core/git-svn line 23.
BEGIN failed--compilation aborted at /usr/local/Cellar/git/2.31.1/libexec/git-core/git-svn line 23.
Note that the Perl version has been changed, but the error still exists. Because there is no SVN:Core in the directories indicated by #INC.
Now some answers may tell you to install SVN::Core by cpan SVN::Core, Don't do that!!! This won't solve the problem! Because the version of SVN::Core it installed, may not match with your SVN version:
$ git svn --version
error: git-svn died of signal 11
By the way, cpan is rubbish, don't use it to install anything. It compiles the source before installation but cannot control the compile flags/options, and it cannot uninstall things that are installed by itself.
Here is the right solution:
The corresponding Perl libraries are already installed when you installed svn, and brew has already told you:
$ brew info svn
subversion: stable 1.14.1 (bottled), HEAD
Version control system designed to be a better CVS
https://subversion.apache.org/
/usr/local/Cellar/subversion/1.14.1_2 (234 files, 32.1MB) *
Poured from bottle on 2021-06-02 at 15:52:30
From: https://mirrors.ustc.edu.cn/homebrew-core.git/Formula/subversion.rb
License: Apache-2.0
==> Dependencies
Build: openjdk ✘, pkg-config ✘, python#3.9 ✔, scons ✘, swig ✘
Required: apr ✔, apr-util ✔, gettext ✔, lz4 ✔, openssl#1.1 ✔, utf8proc ✔
==> Options
--HEAD
Install HEAD version
==> Caveats
svntools have been installed to:
/usr/local/opt/subversion/libexec
The perl bindings are located in various subdirectories of:
/usr/local/opt/subversion/lib/perl5
You may need to link the Java bindings into the Java Extensions folder:
sudo mkdir -p /Library/Java/Extensions
sudo ln -s /usr/local/lib/libsvnjavahl-1.dylib /Library/Java/Extensions/libsvnjavahl-1.dylib
==> Analytics
install: 33,749 (30 days), 67,978 (90 days), 239,148 (365 days)
install-on-request: 33,129 (30 days), 67,011 (90 days), 229,097 (365 days)
build-error: 0 (30 days)
We can see that the Perl bindings are located in /usr/local/opt/subversion/lib/perl5, we just need to let git-svn use this path. With a little investigation of git-svn script, we can see this behavior is controlled by an environment variable called GITPERLLIB:
$ head /usr/local/Cellar/git/2.31.1/libexec/git-core/git-svn
#!/usr/bin/perl
use lib (split(/:/, $ENV{GITPERLLIB} || '/usr/local/Cellar/git/2.31.1/share/perl5:/Applications/Xcode.app/Contents/Developer/Library/Perl/5.28/darwin-thread-multi-2level:/Library/Developer/CommandLineTools/Library/Perl/5.28/darwin-thread-multi-2level'));
# Copyright (C) 2006, Eric Wong <normalperson#yhbt.net>
# License: GPL v2 or later
So the right way to solve this problem is to add the following code to your bashrc or zshrc:
export GITPERLLIB=/usr/local/opt/subversion/lib/perl5/site_perl/$<your_perl_version>/darwin-thread-multi-2level
Problem solved!

Related

I have Perl5.28 installed and Net::LibIDN installed but amavisd cant find it

I'm on a MacMini, using Homebrew to install things.
But - amavisd can't start because apparently it can't find this Net::IDN module?
I'm getting this
ERROR: MISSING REQUIRED BASIC MODULES:
Net::LibIDN
BEGIN failed--compilation aborted at /usr/local/sbin/amavisd line 251.
But I'm sure it is installed.
Fetching http://www.cpan.org/authors/id/D/DA/DAGOLDEN/install- 0.01.tar.gz ... OK
Configuring install-0.01 ... OK
Building and testing install-0.01 ... OK
Successfully installed install-0.01
Net::LibIDN is up to date. (0.12)
1 distribution installed
So how do I tell Perl to find it now?
EDIT:
So I'm forcing a reinstall - but still no joy
zeus:~ robert$ sudo cpanm --reinstall Net::LibIDN
Password:
--> Working on Net::LibIDN
Fetching http://www.cpan.org/authors/id/T/TH/THOR/Net-LibIDN-0.12.tar.gz ... OK
Configuring Net-LibIDN-0.12 ... OK
Building and testing Net-LibIDN-0.12 ... OK
Successfully reinstalled Net-LibIDN-0.12
1 distribution installed
zeus:~ robert$
and trying to run amavisd ...
zeus:~ robert$ sudo /usr/local/sbin/amavisd -c /usr/local/etc/amavisd.conf debug
Password:
ERROR: MISSING REQUIRED BASIC MODULES:
Net::LibIDN
BEGIN failed--compilation aborted at /usr/local/sbin/amavisd line 251.
zeus:~ robert$
So for some reason, it seems amavisd-new can't find the module. Just that Module?
It's because amavisd uses the system perl, while cpanm was installed to a custom perl and installs modules there.
Either install the module to system perl, or try to convince amavisd to run in the custom perl (might involve manually changing the shebang lines in its source files).

Installation of modules Perl 6 failed - No compiler available for Perl v6.c

I installed Rakudo, the Perl 6 interpreter, by:
sudo apt-get install rakudo
I am following a tutorial about installation of Perl 6 modules:
http://perl6maven.com/how-to-install-perl6-modules
And in the last step I get this error:
perl6 bootstrap.pl===SORRY!=== Error while compiling /home/daniel/test/panda/bootstrap.pl
No compiler available for Perl v6.c
at /home/daniel/test/panda/bootstrap.pl:3
------> use v6.c⏏;
Information about versions:
Ubuntu 16.04.2 LTS
This is perl6 version 2015.11 built on MoarVM version 2015.11
How do I install the lacking compiler?
Warning: This solution can be used for development, but for production it is recommended to manually compile the interpreter until the Ubuntu repository will not be updated.
Panda described in the linked tutorial is depreciated. I should use zef to install Perl modules.
My build of Perl was too old. I realized this after reading issue 380 about not working version 6.c.
The correct tutorial about installation of the newest Perl, 6.c, on Ubuntu is here:
http://linuxtot.com/installing-perl-6-on-debian-or-ubuntu/
Now my rakudo -v prints:
This is Rakudo version 2017.07-132-gabf1cfe built on MoarVM version 2017.07-318-g604da4d
implementing Perl 6.c.
And everything works great.
The below commands are extracted from a tutorial linked below:
apt-get install build-essential git libssl-dev
git clone https://github.com/tadzik/rakudobrew ~/.rakudobrew
echo 'export PATH=~/.rakudobrew/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
rakudobrew build moar
rakudobrew build zef
Now to install the perl6 module:
zef install Module::Name
If you are comfortable installing your own software from source, then try the following (update the URL for the latest Rakudo Star from https://rakudo.perl6.org/downloads/star/):
wget -O rakudo-star-2017.07.tar.gz https://rakudo.perl6.org/downloads/star/rakudo-star-2017.07.tar.gz
tar -xvf rakudo-star-2017.07.tar.gz
cd rakudo-star-2017.07
perl Configure.pl --backend=moar --gen-moar
make
make rakudo-test
make install
Then add the following paths to your $PATH (replacing /path/to with the actual path, of course):
/path/to/rakudo-star-2017.07/install/bin
/path/to/rakudo-star-2017.07/install/share/perl6/site/bin
I use a module file for this:
#%Module1.0
## Metadata ###########################################
set this_module rakudo-star
set this_version 2017.07
set this_root /path/to/$this_module/$this_module-$this_version/install
set this_docs http://rakudo.org/documentation/
#######################################################
## Module #############################################
proc ModulesHelp { } {
global this_module this_version this_root this_docs
puts stderr "$this_module $this_version"
puts stderr "****************************************************"
puts stderr " $this_docs"
puts stderr "****************************************************\n"
}
module-whatis "Set up environment for $this_module $this_version"
prepend-path PATH $this_root/bin
prepend-path PATH $this_root/share/perl6/site/bin

updating to svn 1.9.4 via command line in mac

I am using SVN against my will. The current team I work with uses it for version control and they are not always available to help me. I am just trying to go from SVN Version 1.8.13 to the latest 1.9.4
I have download it and I have ran this command too
curl -o subversion-latest.tar.gz http://apache.mirrors.tds.net/subversion/subversion-1.9.4.tar.gz
tar -xvf subversion-latest.tar.gz
I have combined these two different tutorials with no luck.
svn update version
stackover flow issue
I am STUCK at with the configure part..
mymac ~/Downloads/subversion-1.9.4/serf
$ ./configure
-bash: ./configure: No such file or directory
mymac ~/Downloads/subversion-1.9.4/serf
UPDATE
I exited out of serf path and on
`mymac ~/Downloads/subversion-1.9.4` file path i ran the `./configure` My command line ran a bunch of "checks"
configure: Configuring Subversion 1.9.4
configure: creating config.nice checking for gcc...
gcc checking whether the C compiler works...
yes but eventually shot an error at the end...
configure: error: failed to recognize APR_INT64_T_FMT on this platform
mymac ~/Downloads/subversion-1.9.4
I have the latest version of XCode..
UPDATE2 tried neon, again
mymac ~/Downloads/subversion-1.9.4
$ sh get-deps.sh neon
Local directory 'serf' already exists; the downloaded copy won't be used
Local directory 'apr' already exists; the downloaded copy won't be used
Local directory 'apr-util' already exists; the downloaded copy won't be used
get-deps.sh: line 151: get_neon: command not found
Usage: get-deps.sh
Usage: get-deps.sh [ apr | serf | zlib | sqlite | gmock ] ...
mymac ~/Downloads/subversion-1.9.4
$ cd neon
-bash: cd: neon: No such file or directory
UPDATE 3
ran this command first ..
mymac ~/Downloads/subversion-1.9.4
$ ./configure --prefix=/usr/local --with-serf=/usr/local/serf
configure: Configuring Subversion 1.9.4
configure: creating config.nice
checking for gcc... gcc
checking whether the C compiler works... yes
I guess I should install a new version of serf?
checking was serf enabled... no
An appropriate version of serf could not be found, so libsvn_ra_serf
will not be built. If you want to build libsvn_ra_serf, please
install serf 1.3.4 or newer.
configure: error: Serf was explicitly enabled but an appropriate version was not found.
I have no clue where to go from here and how to get around it. I already figure out that neon is no longer supported and I am using serf Can someone offer a different way to go about this? Please? Thanks!
Consider using Brew or MacPorts, if possible. Then this can be as simple as:
brew install svn
If you really must install from source,
it might not be as complicated as the steps you described so far.
Try these much simpler steps exactly:
cd /tmp
curl -o subversion-latest.tar.gz http://apache.mirrors.tds.net/subversion/subversion-1.9.4.tar.gz
tar -xvf subversion-latest.tar.gz
cd subversion-1.9.4
./configure --prefix=/tmp/local
make
make install
This will (hopefully) build Subversion and install it into /tmp/local. Test with this command:
/tmp/local/bin/svn --version
If the output looks good, then repeat from the start, but use a different value for --prefix, as appropriate in your environment.
(I tried, and this worked well for me, right now, btw.)
Maybe it's not so simple. In that case please update your question with the output where you get stuck.

How to install Net::SSH2 from CPAN on Cygwin

I needed to install Net:SSH2 in a Cygwin environment under Windows 7 (64 bit). As usually I tried to install it with cpanm.
I already had the necessary Cygwin packages (see below) installed but the Perl build failed because it couldn't find the libssh2 library.
There is a special text file BUILDING.WIN32 in the Net::SSH2 package but this is only useful when building the module by hand and it refers mainly to MinGW. So this no help.
This is the log of the build:
Entering Net-SSH2-0.53
Checking configure dependencies from META.yml
Checking if you have ExtUtils::MakeMaker 6.59 ... Yes (7.02)
Running Makefile.PL
Configuring Net-SSH2-0.53 ... Subroutine checklibs redefined at inc/Module/Install/CheckLib.pm line 11.
Subroutine assertlibs redefined at inc/Module/Install/CheckLib.pm line 25.
Subroutine _author_side redefined at inc/Module/Install/CheckLib.pm line 39.
The libssh2 library is required by this module. If you don't have it, you can
download it from http://www.libssh2.org; you may also need OpenSSL, which can
be obtained from http://www.openssl.org , or libgcrypt, which can be obtained
from http://www.gnupg.org .
Debian: sudo aptitude install libssh2-1-dev
OpenSUSE: sudo zypper in libssh2-1 libssh2-devel
You can pass your libssh2 lib and include dirs (and extra link args) on the
command line. E.g.:
perl Makefile.PL lib=$HOME/libssh2/lib inc=$HOME/libssh2/include \
ldargs="-lz"
These can also be set through the LIBSSH2_LIB/LIBSSH2_INCLUDE/LIBSSH2_LDARGS
environment variables.
To build with libgcrypt instead of OpenSSL, pass 'gcrypt' as a parameter to
Makefile.PL, e.g.:
perl Makefile.PL gcrypt
If you want to build on Windows, see the file BUILDING.WIN32 in the
distribution.
Can't link/include C library 'ssh2', aborting.
First install the libssh2-devel package from Cygwin, e.g. with apt-cyg the command line frontend for installing packages from within a cygwin shell.
apt-cyg install libssh2-devel
Then set some environment variables to the right path for getting Net::SSH2 to work with the Cygwin packages:
LIBSSH2_LIB=/usr/lib/ LIBSSH2_INCLUDE=/usr/include/ cpanm -v Net::SSH2
That worked for me. Much easier than what the readme file linked above looked like.

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

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

Resources