How to install Net::SFTP::Foreign

Posted by kesavv on 2018-03-01 01:36
Forums: PPM | OS: Windows 10

I am new to perl and trying to install Net::SFTP::Foreign on window 10 with perl 5.24.

Net::SFTP::Foreign has a dependent library Math::GMP.

when trying to to install Math::GMP, it is showing message "Can't link/include gmp.h".

I google to find the solution, where it is mention to install gmp.h file.

But after my all effort, I am still getting the same message.

Please provide step by step information, How can I get ride of missing gmp.h file message and get installed Math::GMP.


ActiveState Staff
Fri, 2018-03-02 18:01

If you're going to build these modules yourself from source code, you need additional libraries not normally found on Windows.

Strawberry Perl includes many of these Non-Windows, Non-Perl, GNU project libraries under GPL licenses.

kesavv | Tue, 2018-06-12 21:01


We're able to install Net-SFTP-Foreign in Perl 5.24.3 using the PPM. We have to install this package on the Server which doesn't have Internet connection, therefore, we want to create our own repository using which we can install this package offline on any system.

While trying it out in offline mode we discovered that it has a dependency on Net-SFTP-Foreign-Backend-Net_SSH2 and Net-SSH2, we couldn't find a way to install it manually. We need Net-SSH2 first and then Net-SFTP-Foreign-Backend-Net_SSH2 could be installed. For Net-SSH2 there is another dependency on LibSSH2. LibSSH2 has dependency on LibCrypt and MinGW.

Could you please suggest how could I install LibSSH2 and Net-SSH2 manually without having internet connection? Could you please suggest me any location from where I can download the dependencies and install on any system?


ActiveState Staff
Wed, 2018-06-13 11:04

SSH2 on needs GPL licensed software.
If you can't use GPL licenses, you can't use SSH2.

And if you can use GPL licenses, the solution is to use Strawberry Perl and the GPL libraries that come with it.

kesavv | Wed, 2018-06-13 19:38

SSH2 works in Perl 5.14 without GPL license, it works in 5.24 also through PPM. The question here is PPM somehow download the dependencies automatically which we're not able to identify while doing it manually.

Could you suggest any way that we can see what all packages PPM is downloading and installing before SSH2? Can we do file copy of those to other system?

ActiveState Staff
Thu, 2018-06-14 09:28

Our PPM servers do not supply Net-SSH2 or Net-SFTP-Foreign-Backend-Net_SSH2 for platforms unless the operating system provides the required system libraries (and associated licenses) by default.

Modules themselves inform PPM as to their dependencies, and the above document also lists the module runtime dependencies. The metadata file lists another which is only required when compiling from source.

If PPM is in contact with a repo containing Net-SSH2, the command "ppm tree Net-SSH2" would get ppm to tell you what the module has reported.

The source you are using to get these modules via PPM must be the one of the two third-party PPM repositories:
Both of these repos will provide modules that are dynamically linked to the required system libraries. You will still need to provide the libraries at an appropriate version number if your operating system does not.
Note: If OpenSSL is used for encryption, these modules will not be using the static-linked version of OpenSSL that your Perl installation does. That can be confusing and may cause compatibility issues.

Yes, if two versions of Perl are the same major version number, and are installed on identical paths, you can copy the module files from one system to another and it will likely work. This process is a license infraction for some ActiveState licenses, however, material downloaded from third-parties is not covered by ActiveState licenses or support.

Note also that non-ActiveState repos may support downloads of ppm or ppmx files directly. Consult the site reference materials.