Buliding lftp from source with OpenSSL libraries

How to build the best ftp client for linux?

This is one of the best FTP client available, but it will take a little using to it as it’s command line and there is no GUI for it.

I’ve needed to connect to SSL sites but the lftp that comes with Ubuntu 10.04 doesn’t have SSL support compiled into it.

To check if your version has SSL support compiled into it:

ldd /usr/bin/lftp

linux-vdso.so.1 =>  (0x00007fffcc983000)
libgnutls.so.26 => /usr/lib/libgnutls.so.26 (0x00007f99eacc5000)
librt.so.1 => /lib/librt.so.1 (0x00007f99eaabd000)
libreadline.so.6 => /lib/libreadline.so.6 (0x00007f99ea87b000)
libutil.so.1 => /lib/libutil.so.1 (0x00007f99ea678000)
libncurses.so.5 => /lib/libncurses.so.5 (0x00007f99ea435000)
libdl.so.2 => /lib/libdl.so.2 (0x00007f99ea230000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f99ea019000)
libc.so.6 => /lib/libc.so.6 (0x00007f99e9c93000)
/lib64/ld-linux-x86-64.so.2 (0x00007f99eaf93000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00007f99e9a75000)
libtasn1.so.3 => /usr/lib/libtasn1.so.3 (0x00007f99e9864000)
libz.so.1 => /lib/libz.so.1 (0x00007f99e964d000)
libgcrypt.so.11 => /lib/libgcrypt.so.11 (0x00007f99e93d4000)
libgpg-error.so.0 => /lib/libgpg-error.so.0 (0x00007f99e91d0000)

This will give you a list of the dependencies libraries, see ldd for a more complete description.

So if there is no libssl library in the list that means you need to compile it from source.

apt-src install lftp

Now we need to modify the building rules. We need to edit the debian/rules file and add the following details to the configuration section.

--with-openssl=/usr/lib \
--with-socks=/usr/lib

We also need to install some libraries needed to compile.

apt-get build-dep lftp
apt-get install libsocks4 libsocksd0-dev libssl-dev

So the new configuration should look like this.

./configure \
--prefix=/usr \
--mandir=\$${prefix}/share/man \
--infodir=\$${prefix}/share/info \
--sysconfdir=/etc \
--with-pager=/etc/alternatives/pager \
--with-openssl=/usr/lib \
--with-socks=/usr/lib

So after this we need to compile the packages.

apt-src build lftp

And after a while you should have a package ready to compile. And we can install it with:

dpkg -i lftp*.deb