本文使用的交叉编译器
arm-himix200-linux
本文介绍一些常用依赖库的交叉编译
包含util-linux,zlib,sqlite3,eudev ,openssl,libpng
这几个都是比较简单的就不单独开篇幅了
交叉编译util-linux
https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v2.33/util-linux-2.33.2.tar.gz
./configure --prefix=/opt/hisi-linux/x86-arm/lib/util-linux \ --host=arm-himix200-linux \ CC=/opt/hisi-linux/x86-arm/arm-himix200-linux/bin/arm-himix200-linux-gcc \ CXX=/opt/hisi-linux/x86-arm/arm-himix200-linux/bin/arm-himix200-linux-g++ make make install
configure里选项很多不过正常情况下就默认安装好了
其余的以后补充
交叉编译sqlite3
https://www.sqlite.org/2020/sqlite-autoconf-3310100.tar.gz
./configure --prefix=/opt/hisi-linux/x86-arm/lib/sqlite \ --host=arm-himix200-linux \ CC=/opt/hisi-linux/x86-arm/arm-himix200-linux/bin/arm-himix200-linux-gcc \ CXX=/opt/hisi-linux/x86-arm/arm-himix200-linux/bin/arm-himix200-linux-g++ make make install
交叉编译zlib
./configure --prefix=/opt/hisi-linux/x86-arm/lib/zlib \ --host=arm-himix200-linux \
这个库有点特殊,不能加-host参数,所以需要改教程编译环境得在makefile里改
着重修改把gcc ar ranlib三个参数
vim Makefile CC=/opt/hisi-linux/x86-arm/arm-himix200-linux/bin/arm-himix200-linux-gcc LDSHARED=/opt/hisi-linux/x86-arm/arm-himix200-linux/bin/arm-himix200-linux-gcc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map CPP=/opt/hisi-linux/x86-arm/arm-himix200-linux/bin/arm-himix200-linux-g++ -E AR=/opt/hisi-linux/x86-arm/arm-himix200-linux/bin/arm-himix200-linux-ar RANLIB=/opt/hisi-linux/x86-arm/arm-himix200-linux/bin/arm-himix200-linux-ranlib
make make install
交叉编译eudev
由于udev很久没有更新了,现在已被eudev取代。
https://dev.gentoo.org/~blueness/eudev/eudev-3.2.9.tar.gz
./configure --prefix=/opt/hisi-linux/x86-arm/lib/eudev \ --host=arm-himix200-linux \ CC=/opt/hisi-linux/x86-arm/arm-himix200-linux/bin/arm-himix200-linux-gcc \ CXX=/opt/hisi-linux/x86-arm/arm-himix200-linux/bin/arm-himix200-linux-g++ make make install
交叉编译openssl
可参考
也可用以下的方式
https://www.openssl.org/source/openssl-1.1.1d.tar.gz
./config no-asm shared \ --prefix=/opt/hisi-linux/x86-arm/lib/openssl \ --openssldir=/opt/hisi-linux/x86-arm/lib/openssl
然后改Makefile
CROSS_COMPILE=/opt/hisi-linux/x86-arm/arm-himix200-linux/bin/arm-himix200-linux- #再CNF_CFLAGS和CNF_CXXFLAGS带的-m64参数去掉
最后
make make install
交叉编译libpng
https://nchc.dl.sourceforge.net/project/libpng/libpng16/1.6.37/libpng-1.6.37.tar.gz
./configure \ --prefix=/opt/hisi-linux/x86-arm/lib/png \ --host=arm-himix200-linux \ CC=/opt/hisi-linux/x86-arm/arm-himix200-linux/bin/arm-himix200-linux-gcc \ CXX=/opt/hisi-linux/x86-arm/arm-himix200-linux/bin/arm-himix200-linux-g++ \ --with-pkgconfigdir=/usr/lib/pkgconfig \ --with-zlib-prefix=/opt/hisi-linux/x86-arm/lib/zlib \ LIBS=-L/opt/hisi-linux/x86-arm/lib/zlib/lib \ CPPFLAGS=-I/opt/hisi-linux/x86-arm/lib/zlib/include make #有可能还会报找不到头文件的错误,直接按实际指定吧 make install
交叉编译glibc
/temp/glibc-2.31/configure --prefix=/opt/hisi-linux/x86-arm/lib/glibc --host=arm-himix200-linux --enable-static-nss \ CC=/opt/hisi-linux/x86-arm/arm-himix200-linux/bin/arm-himix200-linux-gcc \ CXX=/opt/hisi-linux/x86-arm/arm-himix200-linux/bin/arm-himix200-linux-g++ make make install