一.背景:

lftp依赖于ncurses,readline和gnutls

二.准备工作

2.1交叉编译ncurses

2.1.1获取ncurses源码

wget ftp://ftp.invisible-island.net/ncurses/ncurses.tar.gz

2.1.2解压

tar xvf ncurses.tar.gz

2.1.3配置以生成Makefile

./configure CC=arm-linux-gnueabi-gcc --host=arm-linux-gnueabi --prefix=/home/jello/ncurses-5.9/__install

../configure  --host=arm-linux-gnueabi --prefix=$PWD/__install --with-shared

2.1.4 编译

make

2.1.5 安装

make install

2.2 交叉编译readline

2.2.1获取readline源码

wget ftp://ftp.cwru.edu/pub/bash/readline-6.3.tar.gz

2.2.2 解压

tar xvf readline-6.3.tar.gz

2.2.3生成Makefile

../configure --host=arm-linux-gnueabi --prefix=$PWD/__install

2.2.4 编译

make

2.2.5安装

make install

2.3 交叉编译gnutls

2.3.1 获取gnutls源码

git clone https://gitlab.com/gnutls/gnutls.git

cd gnutls

git submodule update --init

git checkout master

2.3.2 生成configure

autoreconf

2.3.2.1出现以下错误提示

configure.ac: error: required file 'build-aux/ylwrap' not found
configure.ac:   'automake --add-missing' can install 'ylwrap'
autoreconf: automake failed with exit status: 1

解决方案:

automake --add-missing

2.3.2.2创建编译目录,防止污染源码

mkdir build

2.3.2.3 切换到编译目录

cd build

2.3.3 生成Makefile

../configure --host=arm-linux-gnueabi --prefix=$PWD/__install

2.3.3.1 出现以下错误:

configure: error:
  ***
  *** Libnettle 3.1 was not found.

解决方案:

安装版本号为3.1的nettle库(加密库)

2.3.3.1.1 获取nettle库源码

wget ftp.gnu.org/gnu/nettle/nettle-3.1.tar.gz

2.3.3.1.2 解压nettle库源码

tar xvf nettle-3.1.tar.gz

2.3.3.1.3 切换到源码目录下

cd nettle-3.1

2.3.3.1.4 创建编译目录

mkdir build

2.3.3.1.5 切换到编译目录

cd build

2.3.3.1.6 生成Makefile

../configure --host=arm-linux-gnueabi --prefix=$PWD/__install

2.3.3.1.7 编译源码

make -j4

2.3.3.1.8 安装

make install

2.3.4 重新生成Makefile

../configure --host=arm-linux-gnueabi --prefix=$PWD/__install  NETTLE_CFLAGS=-I/home/jello/nettle-3.1/build/__install/include NETTLE_LIBS="-L/home/jello/nettle-3.1/build/__install/lib -lnettle"

2.3.4.1 出现以下错误:

*** Libhogweed (nettle's companion library) was not found. Note that you must compile nettle with gmp support.

解决方案:

2.3.4.1.1 在编译nettle时加上gmp库

前情提要:

nettle 是symmetric algorithms

hogweed 是public-key algorithms

nettle库和hogweed库组合起来就是Nettle low-level cryptographic library

2.3.4.1.2 重新交叉编译nettle

2.3.4.1.2.1 切换到nettle源码目录下并将之前编译的内容全部清除

cd nettle-3.1 && rm -rf build

2.3.4.1.2.2 创建编译目录

mkdir build

2.3.4.1.2.3 切换到编译目录

cd build

2.3.4.1.2.4 生成Makefile

../configure --host=arm-linux-gnueabi --prefix=$PWD/__install CFLAGS=-I/home/jello/gmp-6.1.2/build/__install/include LDFLAGS=-L/home/jello/gmp-6.1.2/build/__install/lib LIBS=-lgmp   (gmp库的编译方法在后面)

2.3.4.1.2.5 编译源码

make -j4

2.3.4.1.2.6 安装

make install

2.3.5 再次生成Makefile

../configure --host=arm-linux-gnueabi --prefix=$PWD/__install NETTLE_CFLAGS="-I/home/jello/nettle-3.1/build/__install/include" NETTLE_LIBS="-L/home/jello/nettle-3.1/build/__install/lib -lnettle" HOGWEED_CFLAGS="-I/home/jello/nettle-3.1/build/__install/include" HOGWEED_LIBS="-L/home/jello/nettle-3.1/build/__install/lib -lhogweed"

2.3.5.1 提示以下错误:

Libtasn1 4.9 was not found. To use the included one, use --with-included-libtasn1

解决方案:

2.3.5.1.1 将--with-included-libtasn1这个选项加入

2.3.6 重新生成Makefile

../configure --host=arm-linux-gnueabi --prefix=$PWD/__install NETTLE_CFLAGS="-I/home/jello/nettle-3.1/build/__install/include" NETTLE_LIBS="-L/home/jello/nettle-3.1/build/__install/lib -lnettle" HOGWEED_CFLAGS="-I/home/jello/nettle-3.1/build/__install/include" HOGWEED_LIBS="-L/home/jello/nettle-3.1/build/__install/lib -lhogweed" --with-nettle-mini --with-included-libtasn1

出现以下错误提示:

Libunistring was not found. To use the included one, use --with-included-unistring

解决方案:

2.3.6.1 将--with-included-unistring这个选项加入

2.3.7 重新生成Makefile

../configure --host=arm-linux-gnueabi --prefix=$PWD/__install NETTLE_CFLAGS="-I/home/jello/nettle-3.1/build/__install/include" NETTLE_LIBS="-L/home/jello/nettle-3.1/build/__install/lib -lnettle" HOGWEED_CFLAGS="-I/home/jello/nettle-3.1/build/__install/include" HOGWEED_LIBS="-L/home/jello/nettle-3.1/build/__install/lib -lhogweed" --with-nettle-mini --with-included-libtasn1 --with-included-unistring

出现以下错误:

checking for unbound library... no
configure: WARNING:
***
*** libunbound was not found. Libdane will not be built.
***
checking for P11_KIT... no
configure: error:
***
*** p11-kit >= 0.23.1 was not found. To disable PKCS #11 support
*** use --without-p11-kit, otherwise you may get p11-kit from
*** http://p11-glue.freedesktop.org/p11-kit.html

解决方案:

2.3.7.1 加入两个选项--disable-libdane和-without-p11-kit

2.3.7.1.1 第一个选项就是不要编译libdane库,第二个选项就是不要加入p11-kit库

2.3.8 重新生成Makefile

../configure --host=arm-linux-gnueabi --prefix=$PWD/__install NETTLE_CFLAGS="-I/home/jello/nettle-3.1/build/__install/include" NETTLE_LIBS="-L/home/jello/nettle-3.1/build/__install/lib -lnettle" HOGWEED_CFLAGS="-I/home/jello/nettle-3.1/build/__install/include" HOGWEED_LIBS="-L/home/jello/nettle-3.1/build/__install/lib -lhogweed"  --with-included-libtasn1 --with-included-unistring --disable-libdane -without-p11-kit

出现以下错误:

checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: error: cannot find input file: `src/libopts/Makefile.in'

2.3.8.1 换成release版本试试,目前使用的是开发版本

2.3.9 获取release版本

wget ftp://ftp.gnutls.org/gcrypt/gnutls/v3.5/gnutls-3.5.17.tar.xz

2.3.10 解压

tar xvf gnutls-3.5.17.tar.xz

2.3.11 切换到源码目录

cd gnutls-3.5.17

2.3.12 创建编译目录

mkdir build

2.3.13 生成Makefile

../configure --host=arm-linux-gnueabi --prefix=$PWD/__install NETTLE_CFLAGS="-I/home/jello/nettle-3.1/build/__install/include" NETTLE_LIBS="-L/home/jello/nettle-3.1/build/__install/lib -lnettle" HOGWEED_CFLAGS="-I/home/jello/nettle-3.1/build/__install/include" HOGWEED_LIBS="-L/home/jello/nettle-3.1/build/__install/lib -lhogweed"  --with-included-libtasn1 --with-included-unistring --disable-libdane --without-p11-kit

2.3.14 编译

make -j4

出现以下错误:

In file included from ../../../lib/nettle/pk.c:41:0:
../../../lib/nettle/int/dsa-fips.h:27:17: fatal error: gmp.h: No such file or directory
 #include <gmp.h>
                 ^
compilation terminated.
Makefile:1474: recipe for target 'pk.lo' failed

解决方案:

从以上错误可知gnutls还依赖于gmp库,所以解决方案是编译好gmp库

2.3.14.1 获取gmp库

wget https://gmplib.org/download/gmp/gmp-6.1.2.tar.lz

2.3.14.2 解压gmp-6.1.2.tar.lz

lunzip gmp-6.1.2.tar.lz  (需要安装lunzip这个软件,ubuntu下的安装方法: sudo apt-get install lunzip)

tar xvf gmp-6.1.2.tar

2.3.14.3 切换到解压后的源码目录

cd gmp-6.1.2

2.3.14.4 创建编译目录build

mkdir build

2.3.14.5 切换到build目录

cd build

2.3.14.6 生成Makefile

../configure --host=arm-linux-gnueabi --prefix=$PWD/__install

2.3.14.7 编译

make

2.3.14.8 安装

make install

2.3.15 重新编译gnutls,生成Makefile  (需要删除之前gnutls的build目录里的内容)

../configure --host=arm-linux-gnueabi --prefix=$PWD/__install GMP_CFLAGS="-I/home/jello/gmp-6.1.2/build/__install/include" GMP_LIBS="-L/home/jello/gmp-6.1.2/build/__install/lib -lgmp" NETTLE_CFLAGS="-I/home/jello/nettle-3.1/build/__install/include" NETTLE_LIBS="-L/home/jello/nettle-3.1/build/__install/lib -lnettle" HOGWEED_CFLAGS="-I/home/jello/nettle-3.1/build/__install/include" HOGWEED_LIBS="-L/home/jello/nettle-3.1/build/__install/lib -lhogweed" --with-included-libtasn1 --with-included-unistring --disable-libdane --without-p11-kit

2.3.16 编译

make

此时会出现以下错误

eabi/4.8.3/../../../../armlinux-gnueabi/bin/ld: warning: libnettle.so.6, needed by ../lib/.libs/libgnutls.so, not found (try using -rpath or -rpath-link)
/opt/hisi-linux/x86-arm/arm--linux/bin/../lib/gcc/arm-linux-gnueabi/4.8.3/../../../../arm-linux-gnueabi/bin/ld: warning: libhogweed.so.4, needed by ../lib/.libs/libgnutls.so, not found (try using -rpath or -rpath-link)
/opt/hisi-linux/x86-arm/arm-linux/bin/../lib/gcc/arm-linux-gnueabi/4.8.3/../../../../arm-linux-gnueabi/bin/ld: warning: libgmp.so.10, needed by ../lib/.libs/libgnutls.so, not found (try using -rpath or -rpath-link)
../lib/.libs/libgnutls.so: undefined reference to `nettle_aes192_encrypt@NETTLE_6'
../lib/.libs/libgnutls.so: undefined referenc

2.3.15 安装

三.交叉编译lftp

3.1获取lftp源码

wget http://lftp.yar.ru/ftp/lftp-4.8.3.tar.gz

3.2解压

tar xvf lftp-4.8.3.tar.gz

3.3生成Makefile

3.4安装

未完待续......

ubuntu下交叉编译lftp的更多相关文章

  1. ubuntu下交叉编译ffmpeg

    环境:ubuntu16.04 交叉编译器版本:4.8.3 依赖x264,lame x264: 1.wget ftp://ftp.videolan.org/pub/x264/snapshots/last ...

  2. ubuntu下交叉编译imagemagick

    环境:ubuntu16.04 交叉编译器版本号:4.8.3 在编译之前要编译以下其依赖的软件或库:freetype,libpng,libxml2,libtiff,libjpeg,zlib,graphv ...

  3. ubuntu 下交叉编译环境的搭建

    1. 安装标准的C开发环境,由于Linux安装默认是不安装的,所以需要先安装一下(如果已经安装好的话,就可以免去这一步了): #sudo apt-get install gcc g++ libgcc1 ...

  4. ubuntu下交叉编译windows c程序

    简介 采用mingw32可以在linux下直接编译c程序输出为windows下的exe程序或dll链接库. 个人编译的纯c程序(不含winapi),主要是c99程序,通常采用gcc/cc编译调试后,再 ...

  5. ubuntu下交叉编译mono

    环境:ubuntu16.04 wget download.mono-project.com/sources/mono/mono-4.8.1.0.tar.bz2 配置: CC=arm-linux-you ...

  6. 在Ubuntu下安装imx6linux系统的交叉编译环境遇到的问题总结

    这段时间一直忙于手上的嵌入式项目,可以说自己从嵌入式的菜鸟一点点的入门了,关于嵌入式和imx6核心板的开发有了一点的了解,尤其是对于板子环境的搭建.硬件的开发,搭建环境,是一个很大的工程量,也是很重要 ...

  7. UBUNTU下FPT工具--lftp使用说明

    lftp 是UBUNTU下一个功能强大的下载工具,它支持访问文件的协议: ftp, ftps, http, https, hftp, fish.(其中ftps 和https需要在编译的时候包含open ...

  8. Ubuntu下 QT添加外部链接库(.so文件)示例

    参考:https://blog.csdn.net/KKALL1314/article/details/81915354 https://forum.qt.io/topic/80301/file-not ...

  9. Zedboard学习(二):zedboard的Linux下交叉编译环境搭建 标签: 交叉编译linuxzedboard 2017-07-04 23:49 19人阅读

    环境准备 首先肯定是要下载xilinx-2011.09-50-arm-xilinx-linux-gnueabi.bin文件,这是官方提供的linux下交叉编译链安装文件,下载地址为:https://p ...

随机推荐

  1. mysql获取下一篇和上一篇文章的ID

    mysql获取上一篇和下一篇文章的ID只要在当前页面读取上一个和下一个的ID就可以了.假设当前ID为10:搜索上一个的ID:select  id  from table where id<10 ...

  2. nodejs(五)同步异步--USING SETTIMEOUT INSTEAD OF SETINTERVAL TO FORCE SERIALIZATION

    Let’s say you want a function that does some I/O — such as parsing a log fi le — that will periodica ...

  3. qt——QObject 与 QWidget 的区别

    QObject是QT中所有类的基类,QWidget是所有UI Widget类的基类,所以QObject是QWidget的基类,从QWidget继承也就表示继承了QObject的所有属性.

  4. python 基础 列表生成式 生成器

    列表生成式 列表生成式即List Comprehensions,是Python内置的非常简单却强大的可以用来创建list的生成式 举个例子,要生成list [1, 2, 3, 4, 5, 6, 7, ...

  5. ABP项目创建

    第一种:1.在MyAbp.Migrator下面的appsettings.json里面的sql连接语句 MyAbp.Web.Host 下面的appsettings.json 里面的连接语句2.把MyAb ...

  6. HDU1180:诡异的楼梯(bfs+优先队列)

    http://acm.hdu.edu.cn/showproblem.php?pid=1180 Problem Description Hogwarts正式开学以后,Harry发现在Hogwarts里, ...

  7. hdu2159FATE(二维背包)

    http://acm.hdu.edu.cn/showproblem.php?pid=2159 Problem Description 最近xhd正在玩一款叫做FATE的游戏,为了得到极品装备,xhd在 ...

  8. HTML <input> 标签的 name 属性

    定义和用法 name 属性规定 input 元素的名称. name 属性用于对提交到服务器后的表单数据进行标识,或者在客户端通过 JavaScript 引用表单数据. 注释:只有设置了 name 属性 ...

  9. Sublime text 3搭建Python-Anaconda开发环境

    网络上的教程各种各样,大同小异.自己安装时还是出了些问题,因此总结一篇博文. Sublime Text 是一款轻量级跨平台的文本编辑器,可通过包(Package)扩充自身功能. 有很多搭建python ...

  10. 制作系统U盘,不用做任何动作直接从U盘启动装系统(非PE的)

    用U盘装系统可以用PE方式,进入PE系统,选择镜像文件,然后装,这种比较麻烦. 下面介绍一下从U盘启动,直接装系统的方法,这种方法从U盘启动后,不用做任何动作,就像用光盘装系统一样简单 首先要制作一下 ...