Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I modify my cygwin environment to use Strawberry Perl instead of the packaged Perl distribution?

I currently use Strawberry Perl as my primary Perl distribution. However, I have some applications that make Perl calls through cygwin. These generally fail because they are calling the version of Perl that was packaged with cygwin, and only looking in cygwin's lib folders. How can I modify my cygwin environment to call Strawberry Perl (and use the C:/strawberry/perl/lib dirs) instead?

like image 908
Sam Johnson Avatar asked Jan 21 '09 02:01

Sam Johnson


2 Answers

If you remove Perl from cygwin using the setup program it will use Strawberry Perl by default.

If you are unable to remove Perl from cygwin, you can create a symbolic link to the Perl executable from Strawberry.

From a cygwin shell, use the following set of commands:

$ mv /usr/bin/perl /usr/bin/perl-cygwin
$ ln -s /cygdrive/c/strawberry/perl/bin/perl.exe /usr/bin/perl

This is assuming you used the default Strawberry Perl installer. Update your perl.exe location accordingly if you have it installed somewhere else.

Check to make sure the link is working properly by checking the Perl version:

$ perl -v

It should say This is perl, (version) built for MSWin32-x86-multi-thread (or similar) and not built for cygwin-thread-multi-64int.

like image 160
cowgod Avatar answered Sep 21 '22 06:09

cowgod


You can change your PATH to put the Strawberry directories first. Strawberry tries to be nice by putting its directories at the end of the PATH. If you installed from the .zip file, however, it didn't change the PATH at all.

You could move /usr/bin/perl, but that's a bad idea since it breaks when cygwin tries to update what it thinks is its perl. I just had that happen to me this week and used to happen to me on my Mac until I stopped playing with the system setup and installed my own stuff completely separate.

like image 45
brian d foy Avatar answered Sep 19 '22 06:09

brian d foy