ncurses交叉编译
创始人
2024-03-26 22:18:43
0

1.环境

        编译环境:ubuntu18.04虚拟机

        板端:移远AG550平台 编译链aarch64-oe-linux

2.ncurses下载

ncurses库下载地址:Index of /pub/gnu/ncurses

下载5.9的版本

3.解压并且编译

tar xvf ncurses-5.9.tar.gz
cd ncurses-5.9

 执行configure命令后出现如下错误:

./configure --prefix=/home/share/work/code/v2xapp_ql/v2xstack/opensource/ncurses-5.9/install --host=aarch64-oe-linux --with-shared
configure: WARNING: If you wanted to set the --build type, don't use --host.If a cross compiler is detected then cross compile mode will be used.
configure: loading site script /opt/ag215_crosstools/crosstools/site-config-aarch64-oe-linux
checking for egrep... grep -E
Configuring NCURSES 5.9 ABI 5 (Wed Dec  7 20:38:01 CST 2022)
checking build system type... x86_64-unknown-linux-gnu
checking host system type... Invalid configuration `aarch64-oe-linux': machine `aarch64-oe' not recognized
configure: error: /bin/sh ./config.sub aarch64-oe-linux failed

其中:
–prefix 是指定生成文件的路径
–host 指定的是交叉编译工具链的前缀
–with-shared 生成动态库 

解决方法:

sudo apt-get install libtool
cp /usr/share/libtool/build-aux/config.sub .
cp /usr/share/libtool/build-aux/config.guess .

安装后配置完成

 

make编译出现错误

In file included from ../ncurses/curses.priv.h:283,from ../ncurses/lib_gen.c:19:
_91379.c:835:15: error: expected ‘)’ before ‘int’
../include/curses.h:1594:56: note: in definition of macro ‘mouse_trafo’#define mouse_trafo(y,x,to_screen) wmouse_trafo(stdscr,y,x,to_screen)^
Makefile:794: recipe for target '../obj_s/lib_gen.o' failed
make[1]: *** [../obj_s/lib_gen.o] Error 1
make[1]: Leaving directory '/home/share/work/code/v2xapp_ql/v2xstack/opensource/ncurses-5.9/ncurses'
Makefile:109: recipe for target 'all' failed
make: *** [all] Error 2

 解决方法:

根据出错提示,找到ncurses目录下,include文件夹里的curses.h文件,查找mouse_trafo,锁定在1584行:
1583 extern NCURSES_EXPORT(bool)    wmouse_trafo (const WINDOW*, int*, int*, bool);
1584 extern NCURSES_EXPORT(bool)    mouse_trafo (int*, int*, bool);   /* generated */应该是由后面的一行注释引起的,具体原因不详。
由于代码的部分是由另一个文件curses.tail导入的,所以要修改curses.tail:
sudo vim curses.tail查找mouse_trafo,定位到104行,去除104行后面的注释:
103 extern NCURSES_EXPORT(bool)    wmouse_trafo (const WINDOW*, int*, int*, bool);
104 extern NCURSES_EXPORT(bool)    mouse_trafo (int*, int*, bool);   /* generated */保存后退出,重新make即可。

 make后还是出现错误:

../c++/cursesp.h: In member function ‘T* NCursesUserPanel::UserData() const’:
../c++/cursesp.h:256:43: error: no matching function for call to ‘NCursesUserPanel::get_user() const’return reinterpret_cast(get_user ());

 网上搜索后发现:

出错的原因是编译器版本过高。
解决方法有两个,一是更新ncurses到6.2版本,或者降低编译器版本。

下载6.2版本的源码重新按照上面的步骤编译一次,就可以完成编译了。 

 

相关内容

热门资讯

【NI Multisim 14...   目录 序言 一、工具栏 🍊1.“标准”工具栏 🍊 2.视图工具...
银河麒麟V10SP1高级服务器... 银河麒麟高级服务器操作系统简介: 银河麒麟高级服务器操作系统V10是针对企业级关键业务...
不能访问光猫的的管理页面 光猫是现代家庭宽带网络的重要组成部分,它可以提供高速稳定的网络连接。但是,有时候我们会遇到不能访问光...
AWSECS:访问外部网络时出... 如果您在AWS ECS中部署了应用程序,并且该应用程序需要访问外部网络,但是无法正常访问,可能是因为...
Android|无法访问或保存... 这个问题可能是由于权限设置不正确导致的。您需要在应用程序清单文件中添加以下代码来请求适当的权限:此外...
北信源内网安全管理卸载 北信源内网安全管理是一款网络安全管理软件,主要用于保护内网安全。在日常使用过程中,卸载该软件是一种常...
AWSElasticBeans... 在Dockerfile中手动配置nginx反向代理。例如,在Dockerfile中添加以下代码:FR...
AsusVivobook无法开... 首先,我们可以尝试重置BIOS(Basic Input/Output System)来解决这个问题。...
ASM贪吃蛇游戏-解决错误的问... 要解决ASM贪吃蛇游戏中的错误问题,你可以按照以下步骤进行:首先,确定错误的具体表现和问题所在。在贪...
月入8000+的steam搬砖... 大家好,我是阿阳 今天要给大家介绍的是 steam 游戏搬砖项目,目前...