交叉编译libXinerama-1.1.4

一.下载源码

链接: libXinerama-1.1.4

  1. 解压
$ tar xvf libxinerama_1.1.4.orig.tar.gz 

2.配置configure 用脚本文件配置,我的脚本文件myconfigure.sh,脚本内容

  SRCLIB_PATH=/home/mywork/VNC
 ./configure --prefix=$(pwd)/target_bin --host=arm-linux

执行myconfigure.sh脚本
出现错误checking whether malloc(0) returns NULL… configure: error: in /home/mywork/VNC/libXinerama-1.1.4': configure: error: cannot run test program while cross compiling Seeconfig.log’ for more details

将脚本改成

 SRCLIB_PATH=/home/mywork/VNC
 echo "xorg_cv_malloc0_returns_null=yes" > arm-linux.cache
./configure --prefix=$(pwd)/target_bin --host=arm-linux --cache-file=arm-linux.cache

然后执行脚本然后生成Makefile
3.执行make

$ make

make出现错误Xinerama.c:30:25: fatal error: X11/Xlibint.h: No such file or directory
这个头文件来自X11的头文件 链接: libX11-1.6.10
把X11头文件全部拷贝到libXinerama-1.1.4源码目录的 include/X11/下面 根据自己实际目录选择

$ cp -rf /opt/myinclude/X11/*.h ./include/X11/

make出现错误Xinerama.c:32:33: fatal error: X11/extensions/Xext.h: No such file or directory
这个头文件来自X11的头文件extensions中 执行

cp -rf /opt/myinclude/X11/extensions/*.h ./include/X11/extensions/

make出现错误
Xinerama.c:35:43: fatal error: X11/extensions/panoramiXproto.h: No such file or directory
下载: x11proto-xinerama_1.2.1.orig
找到panoramiXproto.h拷贝到libXinerama-1.1.4的X11/extensions/下面

make出现错误Xinerama.c:322:2: error: implicit declaration of function ‘_XEatDataWords’ [-Werror=implicit-function-declaration]
经过各种姿势的百度,发现这个_XEatDataWords函数在/include/X11/Xlibint.h里面
如果Xlibint.h这个头文件没有这个函数定义需要下载
链接: libX11-1.6.10源码,然后把Xlibint.h头文件找出来替换掉

#这是头文件定义
extern void _XEatDataWords(
    Display*		/* dpy */,
    unsigned long	/* n */
) _XLIB_COLD;

应该是全局函数 但是C文件没有发现这个声明 打开Xinerama.c添加声明,Xinerama.c在src目录
Xinerama.c修改后
在这里插入图片描述
然后make出现错误
/opt/toolchain/aarch64-linux/bin/…/lib/gcc/aarch64-linux-gnu/5.3.1/…/…/…/…/aarch64-linux-gnu/bin/ld: cannot find -lX11
/opt/toolchain/aarch64-linux/bin/…/lib/gcc/aarch64-linux-gnu/5.3.1/…/…/…/…/aarch64-linux-gnu/bin/ld: cannot find -lXext

打开Makefile添加这个库路劲,前提是有这两个库,这两个库的编译参考libX11的编译

$  vi src/Makefile

在LIBS中添加路劲在这里插入图片描述
然后在make就通过了 然后make install
然后在目标目录生成相关的头文件和库
在这里插入图片描述
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值