ncurses交叉编译

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<T>::UserData() const’:
../c++/cursesp.h:256:43: error: no matching function for call to ‘NCursesUserPanel<T>::get_user() const’
     return reinterpret_cast<T*>(get_user ());

 网上搜索后发现:

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

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

 

  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值