ARM移植lftp

版权声明:转载请注明出处 https://blog.csdn.net/understand125/article/details/78688941

转载请注明出处

版本:4.8.3


依赖的库(需在编译lftp前,编译完成,编译方法可自行百度or谷歌):

ncurses

readline(需要5.0版本之上)

openssl

zlib


1.  下载lftp包

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


2.   解压

tar -zxf lftp-4.8.3.tar.gz


3. 切换到解压目录

cd lftp-4.8.3


4. 生成Makefile文件

./configure --host=arm-linux --prefix="{$lftp_install}" CC=arm-linux-gcc CXX=arm-linux-g++ LDFLAGS="-L{$ncurses_lib} -L{$readline_lib} -L{$zlib_lib}" CPPFLAGS="-I{$openssl_include} -I{nucrses_include} -I{readline_include} -I{zlib_include}" --with-openssl={openssl_install} --with-readline={$readline_install} --with-zlib={$zlib_install}

说明:

*install:库的安装目录

*include:库的头文件目录

*lib:库的链接库文件目录


5. 编译(编译前先查看问题汇总,进行对应修改)

make


6. 安装

make install

注:若安装目录指定为系统目录,需切换到root用户,再敲命令


问题汇总:

1. 找不到readline库文件

错误提示:

checking for Readline... no
configure: error: cannot find readline library, install readline-devel package


解决方案:

--with-readline、CPPFLAGS 、LDFLAGS中的readline设置不能少


2. getProgname模块编译错误

错误提示:

getprogname.c:180: error: #error "getprogname module not ported to this OS"


解决方案:

1)修改lib/config.h

添加:

#define ARM 1

2)修改lib/getprogname.c

修改

# if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME 

# if ARM
    char strProcessPath[1024] = {0};
    if(readlink("/proc/self/exe", strProcessPath,1024) <=0)
    {
            return NULL;
    }


    char *strProcessName = strrchr(strProcessPath, '/');


    if(strProcessName)
    {
        size_t nameLen = strlen(strProcessName);
        char* namecopy = malloc(nameLen + 1);
        if (namecopy)
        {
            namecopy[nameLen] = 0;
            return memcpy(namecopy, strProcessName, nameLen);
        }
    }

return NULL;
# elif HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME 


3. 编译Resolver.cc出错

错误提示:

Resolver.cc:881: error: invalid 'asm': invalid operand for code 'w'

解决方案:

修改src/Makefile

ZLIB_CPPFLAGS = 

ZLIB_LDFLAGS = 

猜你喜欢

转载自blog.csdn.net/understand125/article/details/78688941