Running Mkbootstrap for DBI () => DBIXS.h:22:20: fatal error: EXTERN.h: No such file or directory - perl

I try to install MHA node on a docker container based on Alpine. The container has perl, make and gcc via apk. :
RUN apk add --update perl make gcc
A prerequisite for MHA node is DBD::mysql. The command
perl -MCPAN -e 'install DBD::mysql'
results in the above given error. Google does know nothing about it.
The following commands, needed for MHA manager, do run fine, however:
perl -MCPAN -e "install Config::Tiny"
perl -MCPAN -e "install Log::Dispatch"
perl -MCPAN -e "install Parallel::ForkManager"
The problem obviously is related to DBI:
Running Mkbootstrap for DBI ()
chmod 644 "DBI.bs"
"/usr/bin/perl" -p -e "s/~DRIVER~/Perl/g" ./Driver.xst > Perl.xsi
"/usr/bin/perl" "/usr/share/perl5/core_perl/ExtUtils/xsubpp" -typemap "/usr/share/perl5/core_perl/ExtUtils/typemap" -typemap "typemap" Perl.xs > Perl.xsc && mv Perl.xsc Perl.c
cc -c -D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Os -fomit-frame-pointer -DVERSION=\"1.636\" -DXS_VERSION=\"1.636\" -fPIC "-I/usr/lib/perl5/core_perl/CORE" -W -Wall -Wpointer-arith -Wbad-function-cast -Wno-comment -Wno-sign-compare -Wno-cast-qual -Wmissing-noreturn -Wno-unused-parameter Perl.c
In file included from Perl.xs:7:0:
DBIXS.h:22:20: fatal error: EXTERN.h: No such file or directory
compilation terminated.
Makefile:625: recipe for target 'Perl.o' failed
make: *** [Perl.o] Error 1
TIMB/DBI-1.636.tar.gz
/usr/bin/make -- NOT OK
What can I do to resolve it?
Works with Ubuntu 14.04 after install make gcc

You need the libperl headers to be able to build certain modules, including DBI. On Alpine it looks like they are provided by the package perl-dev.

From http://www.perlmonks.org/bare/?node_id=486526
EXTERN.h is part of the perl C API which is needed for embedding the interpreter and building XS modules. The official perl distribution contains all these files, but many linux distributions don't bundle it as part of the base perl package (some even leave out a lot of core modules). There should be one or more additional packages for your distribution that supply the C API files. They're usually called "perl-dev" or something like it. (From googling, it looks like the mandrage package is "perl-devel-5.*.rpm")
So the solution looked like to add perl-dev to the apk add command, but this was not enough:
In file included from DBIXS.h:23:0,
from Perl.xs:7:
/usr/lib/perl5/core_perl/CORE/perl.h:699:23: fatal error: sys/types.h: No such file or directory
compilation terminated.
Makefile:628: recipe for target 'Perl.o' failed
Ok, some more googling resulted in addin musl-dev as well. Now that works:
FROM alpine
ENV MHA_NODE_VERSION=0.54 \
MHA_MANAGER_VERSION=0.55
COPY ./mha/* /tmp/
# mha4mysql-manager-0.55.tar.gz
# mha4mysql-node-0.54.tar.gz
RUN apk add --update perl perl-dev musl-dev make gcc \
&& perl -MCPAN -e 'install DBD::mysql' \
&& perl -MCPAN -e "install Config::Tiny" \
&& perl -MCPAN -e "install Log::Dispatch" \
&& perl -MCPAN -e "install Parallel::ForkManager" \
&& cd /tmp \
&& tar -zxf mha4mysql-node-${MHA_NODE_VERSION}.tar.gz \
&& cd mha4mysql-node-${MHA_NODE_VERSION}/ \
&& perl Makefile.PL \
&& make \
&& make install \
&& cd /tmp \
&& tar -zxf mha4mysql-manager-${MHA_MANAGER_VERSION}.tar.gz \
&& cd mha4mysql-manager-${MHA_MANAGER_VERSION}/ \
&& perl Makefile.PL \
&& make \
&& make install \
&& apk del make gcc musl-dev perl-dev \
&& rm -rf /var/cache/apk/*
ENTRYPOINT ["/usr/bin/perl", "-de0"]

Related

Building postgres from source throws "'utils/errcodes.h' file not found" when called from other makefile

I am currently constructing a Makefile and one of the things it will be doing is downloading and building postgres from source. Before starting to write the makefile file I always used the following set of commands to do this:
curl -LJ https://github.com/postgres/postgres/archive/refs/tags/REL_13_3.zip -o postgres.zip
unzip postgres.zip
rm postgres.zip
cd postgres-REL_13_3
./configure --prefix "`pwd`" --without-readline --without-zlib
make
make install
Executing the above listed commands in the terminal results in the successful installation of postgres. Then I translated these into a makefile which looks as follows:
build:
curl -LJ https://github.com/postgres/postgres/archive/refs/tags/REL_13_3.zip -o postgres.zip
unzip postgres.zip
rm postgres.zip
cd postgres-REL_13_3 \
&& ./configure --prefix "`pwd`" --without-readline --without-zlib \
&& $(MAKE) \
&& $(MAKE) install
Running this Makefile results in the error:
../../src/include/utils/elog.h:71:10: fatal error: 'utils/errcodes.h' file not found
It seems that something about calling the make from another Makefile causes a referencing issue with the files during the build process, but I just can figure out for the life of me what I have to change to fix this.
It appears to be the influence of Makefile enviromental variables. I didn't discover the exact mechanism, but unsetting them helps.
build:
curl -LJ https://github.com/postgres/postgres/archive/refs/tags/REL_13_3.zip -o postgres.zip
unzip postgres.zip
rm postgres.zip
unset MAKELEVEL && unset MAKEFLAGS && unset MFLAGS && cd postgres-REL_13_3 \
&& ./configure --prefix "`pwd`" --without-readline --without-zlib \
&& $(MAKE) \
&& $(MAKE) install

Install postgres extension PGXN "fatal error: unistd.h: No such file or directory"

I need to sync some postgres tables with elasticsearch and come to conclusion that the best solution for my case is the one described here. Unfortunately I'm still failing to install required postgres extension amqp.
I use docker so I start from image postgres:13-alpine.
Here is how my Dockerfile looks like so far:
FROM postgres:13-alpine
ENV POSTGRES_DB ''
ENV POSTGRES_USER ''
ENV POSTGRES_PASSWORD ''
RUN apk update \
&& apk add py-pip make gcc \
&& pip install pgxnclient
Then when you enter the container and try to run pgxn install pg_amqp you will get following error.
bash-5.1# pgxn install pg_amqp
INFO: best version: pg_amqp 0.3.0
INFO: saving /tmp/tmpgjtefhgh/pg_amqp-0.3.0.zip
INFO: unpacking: /tmp/tmpgjtefhgh/pg_amqp-0.3.0.zip
INFO: building extension
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -fPIC -I. -I./ -I/usr/local/include/postgresql/server -I/usr/local/include/postgresql/internal -D_GNU_SOURCE -I/usr/include/libxml2 -c -o src/pg_amqp.o src/pg_amqp.c
src/pg_amqp.c:36:10: fatal error: unistd.h: No such file or directory
36 | #include <unistd.h>
| ^~~~~~~~~~
compilation terminated.
make: *** [<builtin>: src/pg_amqp.o] Error 1
ERROR: command returned 2: make PG_CONFIG=/usr/local/bin/pg_config all
It seems that I am out of the ideas what to do with that. Any help?
You are missing the musl C library (libc) implementation: musl-dev
RUN apk update \
&& apk add py-pip make gcc musl-dev \
&& pip install pgxnclient

Can't install pvl8 v.2.3.15: Regenerating ninja files - FAILED: build.ninja

Linux Mint 20.2 , kernel 5.11.0-25-generic
I want to install plv8-2.3.15
Help here:
https://github.com/plv8/plv8/blob/v2.3.15/docs/BUILDING.md
Installed the next packages:
sudo apt-get update
sudo apt install git
sudo apt install python2
sudo apt install g++
sudo apt install pkg-config
sudo apt install libc-dev-bin
sudo apt install libc++abi-dev
sudo apt-get install libc++abi-dev
sudo apt install libc++-dev
sudo apt install libglib2.0-dev-bin
sudo apt install libtinfo5
sudo apt install ninja-build
Steps:
After make I get the next result:
./generate_upgrade.sh 2.3.15
sed -e 's/#PLV8_VERSION#/2.3.15/g' plv8.control.common | g++ -E -P -DLANG_plv8 - > plv8.control
sed -e 's/#LANG_NAME#/plv8/g' plv8.sql.common | sed -e 's/#PLV8_VERSION#/2.3.15/g' | g++ -E -P -I. -I./ -I/usr/include/postgresql/9.6/server -I/usr/include/postgresql/internal -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include/mit-krb5 -DLANG_plv8 - > plv8--2.3.15.sql
sed -e 's/#PLV8_VERSION#/2.3.15/g' plv8.control.common | g++ -E -P -DLANG_plcoffee - > plcoffee.control
sed -e 's/#LANG_NAME#/plcoffee/g' plv8.sql.common | sed -e 's/#PLV8_VERSION#/2.3.15/g' | g++ -E -P -I. -I./ -I/usr/include/postgresql/9.6/server -I/usr/include/postgresql/internal -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include/mit-krb5 -DLANG_plcoffee - > plcoffee--2.3.15.sql
sed -e 's/#PLV8_VERSION#/2.3.15/g' plv8.control.common | g++ -E -P -DLANG_plls - > plls.control
sed -e 's/#LANG_NAME#/plls/g' plv8.sql.common | sed -e 's/#PLV8_VERSION#/2.3.15/g' | g++ -E -P -I. -I./ -I/usr/include/postgresql/9.6/server -I/usr/include/postgresql/internal -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include/mit-krb5 -DLANG_plls - > plls--2.3.15.sql
Nice.
Now I want to install.
Try this
sudo make install
But I get error:
sudo make install
cd build/v8 ; env CXXFLAGS=-fPIC CFLAGS=-fPIC ninja -C out.gn/x64.release d8
ninja: Entering directory `out.gn/x64.release'
[1/1] Regenerating ninja files
FAILED: build.ninja
/home/Downloads/plv8-2.3.15/build/v8/buildtools/linux64/gn --root=/home/alexei/Downloads/plv8-2.3.15/build/v8 -q --check gen .
/bin/sh: 1: /home/alexei/Downloads/plv8-2.3.15/build/v8/buildtools/linux64/gn: not found
ninja: error: rebuilding 'build.ninja': subcommand failed
make: *** [Makefile:42: v8] Error 1

How to install perl Kafka::Connection on alpine image

I have a working UBUNTU image with this Dockerfile:
FROM perl:5.14
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update -y
RUN apt-get upgrade -y
RUN apt-get install -y libgd-dev
RUN perl -MCPAN -e 'install (Try::Tiny)'
RUN perl -MCPAN -e 'install (Kafka::Connection)'
RUN perl -MCPAN -e 'install (YAML)'
RUN perl -MCPAN -e 'install (GD::Simple)'
RUN perl -MCPAN -e 'install (GD::Graph)'
RUN perl -MCPAN -e 'install (JSON)'
RUN perl -MCPAN -e 'install (JSON::MaybeXS)'
RUN perl -MCPAN -e 'install (HTTP::Request)'
RUN perl -MCPAN -e 'install (HTTP::Response)'
RUN perl -MCPAN -e 'install (HTTP::Daemon)'
COPY run.sh /run.sh
RUN chmod +x "/run.sh"
RUN mkdir -p /code_path
WORKDIR /code_path
CMD ["/run.sh"]
I'n trying to get a slimmer alpine version like this:
FROM alpine:3.10.3
## alpine curl and wget aren't fully compatible, so we install them
## here. gnupg is needed for Module::Signature.
RUN apk update && apk upgrade
RUN apk add curl tar make gcc build-base wget gnupg
RUN mkdir -p /usr/src/perl
WORKDIR /usr/src/perl
## from perl; `true make test_harness` because 3 tests fail
## some flags from http://git.alpinelinux.org/cgit/aports/tree/main/perl/APKBUILD?id=19b23f225d6e4f25330e13144c7bf6c01e624656
RUN curl -SLO https://www.cpan.org/src/5.0/perl-5.30.0.tar.gz \
&& echo 'aa5620fb5a4ca125257ae3f8a7e5d05269388856 *perl-5.30.0.tar.gz' | sha1sum -c - \
&& tar --strip-components=1 -xzf perl-5.30.0.tar.gz -C /usr/src/perl \
&& rm perl-5.30.0.tar.gz \
&& ./Configure -des \
-Duse64bitall \
-Dcccdlflags='-fPIC' \
-Dcccdlflags='-fPIC' \
-Dccdlflags='-rdynamic' \
-Dlocincpth=' ' \
-Duselargefiles \
-Dusethreads \
-Duseshrplib \
-Dd_semctl_semun \
-Dusenm \
&& make libperl.so \
&& make -j$(nproc) \
&& true TEST_JOBS=$(nproc) make test_harness \
&& make install \
&& curl -LO https://raw.githubusercontent.com/miyagawa/cpanminus/master/cpanm \
&& chmod +x cpanm \
&& ./cpanm App::cpanminus \
&& rm -fr ./cpanm /root/.cpanm /usr/src/perl
## from tianon/perl
ENV PERL_CPANM_OPT --verbose --mirror https://cpan.metacpan.org --mirror-only
RUN cpanm Digest::SHA Module::Signature && rm -rf ~/.cpanm
ENV PERL_CPANM_OPT $PERL_CPANM_OPT --verify
RUN perl -MCPAN -e 'install (Try::Tiny)'
RUN perl -MCPAN -e 'install (Kafka::Connection)'
RUN perl -MCPAN -e 'install (YAML)'
RUN perl -MCPAN -e 'install (GD::Simple)'
RUN perl -MCPAN -e 'install (GD::Graph)'
RUN perl -MCPAN -e 'install (JSON)'
RUN perl -MCPAN -e 'install (JSON::MaybeXS)'
RUN perl -MCPAN -e 'install (HTTP::Request)'
RUN perl -MCPAN -e 'install (HTTP::Response)'
RUN perl -MCPAN -e 'install (HTTP::Daemon)'
COPY run.sh /run.sh
RUN chmod +x "/run.sh"
RUN mkdir -p /code_path
WORKDIR /code_path
CMD ["/run.sh"]
I keep getting this error
OS.c:18:10: fatal error: obstack.h: No such file or directory
#include <obstack.h> /* glibc's handy obstacks */
how do I get all the dependencies for Kafka on the image?
Alpine does not ship glibc, and obstack.h is not part of musl-dev.
Try alpine-pkg-glibc.
You could try grabbing obstack.h on Alpine by installing the newly available musl-obstack-dev package of the edge/testing repository:
apk add musl-obstack-dev --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing
Note that edge/testing packages are cutting edge and are considered experimental (as opposed to main stable package).
While Alpine (musl libc) is generally not glibc compatible, it does provide lightweight glibc compatibility in terms of convenience headers and libraries, particularly via the libc6-compat package, and packages as the aforementioned.
Tip: use Alpine's excellent package search for locating missing files. Alpine is vivid and active and sees new packages regularly. Most of the time you'll find that missing files are available in apk packages. Results for obstack.h package contents search:
https://pkgs.alpinelinux.org/contents?file=obstack.h&path=&name=&branch=edge
I eventually searched Github to find a newer alpine perl image and was greatly helped by valino's answer in arriving at this Dockerfile:
FROM alpine:3.10.3
## alpine curl and wget aren't fully compatible, so we install them
## here. gnupg is needed for Module::Signature.
RUN apk update && apk upgrade
RUN apk add --no-cache curl tar make gcc build-base wget gnupg ca-certificates g++ git gd-dev
RUN apk add --no-cache zlib zlib-dev
RUN apk add --no-cache perl perl-dev
RUN curl -L <check the link above "newer alpine perl image" for this line it was rejected> > /bin/cpanm && chmod +x /bin/cpanm
RUN cpanm App::cpm
WORKDIR /usr
RUN cpm install Try::Tiny
RUN cpm install YAML
RUN cpm install JSON
RUN cpm install JSON::MaybeXS
RUN cpm install HTTP::Request
RUN cpm install HTTP::Response
RUN cpm install HTTP::Daemon
RUN cpm install GD::Simple
RUN cpm install GD::Graph
RUN cpm install Data::HexDump::Range
RUN cpm install Proc::Daemon
RUN cpm install Test::Block
RUN cpm install Text::Colorizer
RUN cpm install Gzip::Faster
ENV PERL5LIB=/usr/local/lib/perl5
ENV PATH=/usr/local/bin:$PATH
RUN apk add --no-cache musl-obstack-dev --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing
RUN cpm install Proc::ProcessTable
RUN cpm install Kafka::Connection
COPY run.sh /run.sh
RUN chmod +x "/run.sh"
RUN mkdir -p /code_path
WORKDIR /code_path
CMD ["/run.sh"]

Keys for Net::SSH2

I have a simple perl test script which uses Net::SSH2, and I'm having trouble getting it to work with public key authentication.
Note: After reading a couple of replies, I realise that I should mention that I created the script to help narrow down a problem I was having with another application that uses Net::SSH2. It's therefore not possible for me to switch to an alternative package such as Net::OpenSSH or Net::OpenSSH::Compat::SSH2.
Note Update: As salva pointed out, Net::OpenSSH::Compat::SSH2 can be used without having to patch the original application.
Here's the code:
use strict;
use warnings;
use 5.10.0;
use Net::SSH2;
my $ssh2 = Net::SSH2->new();
my $auth;
if ( $ssh2->connect('hostname') ) {
$auth = $ssh2->auth_publickey(
'username',
'/home/mike/.ssh/id_rsa.pub',
'/home/mike/.ssh/id_rsa',
'password'
);
}
if ($auth && $ssh2->auth_ok) {
say 'Success';
} else {
say join ', ', $ssh2->error;
}
I have been generating key pairs using ssh-keygen on Ubuntu:
ssh-keygen -t rsa
ssh-copy-id user#server
ssh user#server
The above works correctly - I can SSH to the server.
When I run the Perl code, I get the following error when using a password protected key:
-16, LIBSSH2_ERROR_FILE, Unable to initialize private key from file
If I try with a non-password protected key, it works correctly.
I have the following libraries installed:
Net::SSH2 0.35
libssh2-1 1.2.2-1
libssh2-1-dev 1.2.2-1
ssh 1:5.3p1-3ubuntu6
openssh-server 1:5.3p1-3ubuntu6
openssh-client 1:5.3p1-3ubuntu6
openssl 0.9.8k-7ubuntu8.6
libssl-dev 0.9.8k-7ubuntu8.6
The plot thickens
If I remove libssh2-1 and libssh2-1-dev, I get an error, as expected:
Can't load '/usr/local/lib/perl/5.10.1/auto/Net/SSH2/SSH2.so'
If I then build libssh2 from source, I am unable to reinstall Net::SSH2, as it can't find the development headers. However, if I reinstall libssh2-1 and libssh2-1-dev and then build and install libssh2 from source, it works.
Does that mean that the build of libssh2-1-dev on Ubuntu 10.04 is at fault? If so, how do I install libssh2 from source and correctly install Net::SSH2, without requiring libssh2-1-dev. I presume that the build from source is overwriting or overriding the Ubuntu package.
UPDATE
As noted in Daniel Stenberg's reply, the Ubuntu 10.04 package is now a little out of date (version 1.2.2, compared with the latest stable build at 1.2.8). Installing libssh2 from source 'over the top' of the Ubuntu package solves the problem. However, this feels messy to me. How can I remove the Ubuntu package, install libssh2 from source, and still build Net::SSH2 — how do I tell Net::SSH2 where to find the libssh2 development headers?
UPDATE 2
salva came to the rescue again, and showed how the Net::SSH2 installer can be configured with lib and include directories, so that it may be used with the source install of libssh2. Thanks salva! Note that instead of patching Makefile.PL, it's possible to just override the $lib and $inc variables at the top of Makefile.PL. I wasn't aware of this until I looked at salva's patch.
I have been able to successfully log into a server using a pass-phrase protected key with Net::SSH2 from the the Ubuntu 11.04 libnet-ssh2-perl package.
Anyway, consider using Net::OpenSSH or Net::OpenSSH::Compat::SSH2 instead of Net::SSH2.
Update: Net::OpenSSH::Compat::SSH2 tries to be a replacement for Net::SSH2. There is no need to patch the application in order to try it:
perl -MNet::OpenSSH::Compat=Net::SSH2 yor_app.pl
When you install libssh2 from the source package it will by default install itself in /usr/local, while the default package installs in /usr which probably is why it only finds the "stock" installed version.
Unfortunately it seems your Ubuntu has a fairly old libssh2 version as it has been bugfixed a lot since then.
I recommend using the libssh2-devel mailing list for in-depth libssh2 questions. It's a small but friendly community.
I have created a patch for Net::SSH2 Makefile.PL that allows to set the location of libssh2 libs and headers from the command line.
Here is a capture of the full build process for libssh2 + Net::SSH2 using it:
salva#leon:/tmp/salva$ wget http://www.libssh2.org/download/libssh2-1.2.8.tar.gz
--2011-05-27 11:21:10-- http://www.libssh2.org/download/libssh2-1.2.8.tar.gz
Resolving www.libssh2.org... 80.67.6.50
Connecting to www.libssh2.org|80.67.6.50|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 637707 (623K) [application/x-gzip]
Saving to: `libssh2-1.2.8.tar.gz'
100%[================================================================================================================================================================================================>] 637,707 525K/s in 1.2s
2011-05-27 11:21:14 (525 KB/s) - `libssh2-1.2.8.tar.gz' saved [637707/637707]
salva#leon:/tmp/salva$ tar xzf libssh2-1.2.8.tar.gz
salva#leon:/tmp/salva$ cd libssh2-1.2.8
salva#leon:/tmp/salva/libssh2-1.2.8$ ./configure --prefix=/usr/local/libssh2
checking whether to enable maintainer-specific portions of Makefiles... no
checking for sed... /bin/sed
checking for a BSD-compatible install... /usr/bin/install -c
...
salva#leon:/tmp/salva/libssh2-1.2.8$ make
Making all in src
make[1]: Entering directory `/tmp/salva/libssh2-1.2.8/src'
make all-am
make[2]: Entering directory `/tmp/salva/libssh2-1.2.8/src'
if /bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I../include -I../src -g -O2 -MT channel.lo -MD -MP -MF ".deps/channel.Tpo" -c -o channel.lo channel.c; \
then mv -f ".deps/channel.Tpo" ".deps/channel.Plo"; else rm -f ".deps/channel.Tpo"; exit 1; fi
libtool: compile: gcc -DHAVE_CONFIG_H -I../include -I../src -g -O2 -MT channel.lo -MD -MP -MF .deps/channel.Tpo -c channel.c -fPIC -DPIC -o .libs/channel.o
...
salva#leon:/tmp/salva/libssh2-1.2.8$ sudo make install
Making install in src
make[1]: Entering directory `/tmp/salva/libssh2-1.2.8/src'
make[2]: Entering directory `/tmp/salva/libssh2-1.2.8/src'
test -z "/usr/local/libssh2/lib" || mkdir -p -- "/usr/local/libssh2/lib"
/bin/bash ../libtool --mode=install /usr/bin/install -c 'libssh2.la' '/usr/local/libssh2/lib/libssh2.la'
libtool: install: /usr/bin/install -c .libs/libssh2.so.1.0.1 /usr/local/libssh2/lib/libssh2.so.1.0.1
...
salva#leon:/tmp/salva/libssh2-1.2.8$ cd ..
salva#leon:/tmp/salva$ wget http://search.cpan.org/CPAN/authors/id/R/RK/RKITOVER/Net-SSH2-0.35.tar.gz
--2011-05-27 11:22:56-- http://search.cpan.org/CPAN/authors/id/R/RK/RKITOVER/Net-SSH2-0.35.tar.gz
Resolving search.cpan.org... 207.115.101.144
Connecting to search.cpan.org|207.115.101.144|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://osl.ugr.es/CPAN/authors/id/R/RK/RKITOVER/Net-SSH2-0.35.tar.gz [following]
--2011-05-27 11:22:59-- http://osl.ugr.es/CPAN/authors/id/R/RK/RKITOVER/Net-SSH2-0.35.tar.gz
Resolving osl.ugr.es... 150.214.21.7
Connecting to osl.ugr.es|150.214.21.7|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 92434 (90K) [application/x-gzip]
Saving to: `Net-SSH2-0.35.tar.gz'
100%[================================================================================================================================================================================================>] 92,434 328K/s in 0.3s
2011-05-27 11:22:59 (328 KB/s) - `Net-SSH2-0.35.tar.gz' saved [92434/92434]
salva#leon:/tmp/salva$ tar xzf Net-SSH2-0.35.tar.gz
salva#leon:/tmp/salva$ cd Net-SSH2-0.35
salva#leon:/tmp/salva/Net-SSH2-0.35$ wget -q --no-check-certificate -O - https://github.com/salva/net-ssh2/commit/3c7261f4584137f4240d204731e20f709f1addb1.patch|patch -p1
patching file Makefile.PL
salva#leon:/tmp/salva/Net-SSH2-0.35$ perl Makefile.PL lib=/usr/local/libssh2/lib/ inc=/usr/local/libssh2/include/
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.
Debian: sudo aptitude install libssh2-1-dev
OpenSUSE: sudo zypper in libssh2-1 libssh2-devel
Checking if your kit is complete...
Looks good
Writing Makefile for Net::SSH2
salva#leon:/tmp/salva/Net-SSH2-0.35$ make
cp lib/Net/SSH2/File.pm blib/lib/Net/SSH2/File.pm
cp lib/Net/SSH2/PublicKey.pm blib/lib/Net/SSH2/PublicKey.pm
cp lib/Net/SSH2/Dir.pm blib/lib/Net/SSH2/Dir.pm
cp lib/Net/SSH2/SFTP.pm blib/lib/Net/SSH2/SFTP.pm
cp lib/Net/SSH2/Listener.pm blib/lib/Net/SSH2/Listener.pm
cp lib/Net/SSH2/Channel.pm blib/lib/Net/SSH2/Channel.pm
cp lib/Net/SSH2.pm blib/lib/Net/SSH2.pm
AutoSplitting blib/lib/Net/SSH2.pm (blib/lib/auto/Net/SSH2)
/usr/bin/perl "-Iinc" /usr/local/share/perl/5.10.1/ExtUtils/xsubpp -typemap /usr/share/perl/5.10/ExtUtils/typemap -typemap typemap SSH2.xs > SSH2.xsc && mv SSH2.xsc SSH2.c
cc -c /usr/local/libssh2/include/ -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -DVERSION=\"0.35\" -DXS_VERSION=\"0.35\" -fPIC "-I/usr/lib/perl/5.10/CORE" SSH2.c
In file included from SSH2.xs:11:0:
ppport.h:3042:0: warning: "PERL_UNUSED_DECL" redefined
/usr/lib/perl/5.10/CORE/perl.h:330:0: note: this is the location of the previous definition
cc: /usr/local/libssh2/include/: linker input file unused because linking not done
Running Mkbootstrap for Net::SSH2 ()
chmod 644 SSH2.bs
rm -f blib/arch/auto/Net/SSH2/SSH2.so
LD_RUN_PATH="/usr/local/libssh2/lib:/lib/x86_64-linux-gnu" cc -shared -O2 -g -L/usr/local/lib -fstack-protector SSH2.o -o blib/arch/auto/Net/SSH2/SSH2.so \
-L/usr/local/libssh2/lib/ -lssh2 -lz -lssl -lcrypto \
chmod 755 blib/arch/auto/Net/SSH2/SSH2.so
cp SSH2.bs blib/arch/auto/Net/SSH2/SSH2.bs
chmod 644 blib/arch/auto/Net/SSH2/SSH2.bs
Manifying blib/man3/Net::SSH2::File.3pm
Manifying blib/man3/Net::SSH2::Dir.3pm
Manifying blib/man3/Net::SSH2::PublicKey.3pm
Manifying blib/man3/Net::SSH2::SFTP.3pm
Manifying blib/man3/Net::SSH2::Listener.3pm
Manifying blib/man3/Net::SSH2::Channel.3pm
Manifying blib/man3/Net::SSH2.3pm
salva#leon:/tmp/salva/Net-SSH2-0.35$ ldd ./blib/arch/auto/Net/SSH2/SSH2.so
linux-vdso.so.1 => (0x00007fff20abc000)
libssh2.so.1 => /usr/local/libssh2/lib/libssh2.so.1 (0x00007f464d52f000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f464d317000)
libssl.so.0.9.8 => /lib/libssl.so.0.9.8 (0x00007f464d09a000)
libcrypto.so.0.9.8 => /lib/libcrypto.so.0.9.8 (0x00007f464cd0b000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f464c977000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f464c772000)
/lib64/ld-linux-x86-64.so.2 (0x00007f464d97e000)
salva#leon:/tmp/salva/Net-SSH2-0.35$ sudo make install
...