ubuntu执行编译好的文件显示文件不存在_ubuntu20.04编译tslib库

  • 安装编译依赖的工具

sudo apt-get install autoconf automake libtool vim

  • 从github官网下载tslib:

git clone https://github.com/kergoth/tslib

  • 配置编译工具链

创建shell脚本:touch setup-gcc-linaro-4-9-4-2017-01-x86_64_arm-linux-gnueabihf.sh

打开脚本: vim setup-gcc-linaro-4-9-4-2017-01-x86_64_arm-linux-gnueabihf.sh

添加编译工具链到脚本:

#!/bin/sh

export ARCH=arm

export PATH=$PATH:/home/sir/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/bin

脚本添加可执行权限:

chmod 766 setup-gcc-linaro-4-9-4-2017-01-x86_64_arm-linux-gnueabihf.sh

使能编译工具链

source setup-gcc-linaro-4-9-4-2017-01-x86_64_arm-linux-gnueabihf.sh

查看编译工具链:

shell命令行输入:ar,按2次Tab“键,会看到编译工具链使能了。

ubuntu@ubuntu-T450:~$ ar

c0caeef834d9116753b574d9743a0c03.png

使能编译工具链

  • 编译tslib

创建文件夹:mkdir tslib-image

配置configure:

./configure --host=arm-linux-gnueabihf ac_cv_func_malloc_0_nonnull=yes

--cache-file=arm-linux.cache -prefix=/home/ubuntu/tslib/tslib-image

编译:make -j4

安装到tslib-image目录下:make install

  • 查看编译结果:

ubuntu@ubuntu-T450:~$ ls tslib-image

bin etc include lib share

40640a823a42f5536023cefca11d2c16.png

tslib二进制文件

为什么使用shell脚本使能gcc编译工具链?

假如本地有多个gcc编译工具链,每次切换编译工具链,都需要修改/etc/profile,比较麻烦。给每个编译工具链写一个类似的shell 脚本,在新打开的terminal窗口环境中,source 指定编译工具链的脚本,编译工具链只会在该窗口生效,并不会影响到其他terminal窗口,也不需要修改/etc/profile。

每次电脑重启或打开新的terminal窗口,source 指定编译工具链的脚本,编译代码。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值