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版本的源码重新按照上面的步骤编译一次,就可以完成编译了。 

 

相关内容

热门资讯

前端-session、jwt 目录:   (1)session (2&#x...
linux入门---制作进度条 了解缓冲区 我们首先来看看下面的操作: 我们首先创建了一个文件并在这个文件里面添加了...
关于测试,我发现了哪些新大陆 关于测试 平常也只是听说过一些关于测试的术语,但并没有使用过测试工具。偶然看到编程老师...
前缀和与对数器与二分法 1. 前缀和 假设有一个数组,我们想大量频繁的去访问L到R这个区间的和,...
nodejs:本地安装nvm实... 一、背景-使用不同版本node的原因 vue3+ts、nuxt3版本,node...
JAVA集合知识整理 Java集合知识整理 HashMap相关 HashMap的底层数据结构:jdk1.8之...
无刷直流电机介绍及单片机控制实... 无刷直流电机介绍及单片机控制实例前言基本概念优势与劣势使用寿命基本结构使用单片机控制实例电子调速器&...
fwdiary(2) dp2 1.传纸条  AcWing 275. 传纸条 - AcWing 走两条路,走一条最大的...
常用的DOS命令 常用的DOS命令 DOS(Disk Operating System,磁...
<C++> 类和对象(下) 1.const成员函数将const修饰的“成员函数”称之为const成员函数,cons...