NotePublic/Software/Development/System/Linux/User/CrossBuild/交叉编译软件库并安装.md

21 lines
719 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 交叉编译软件库并安装
## 1. Autoconf 构建
```bash
# 配置
./autogen.sh
./configure CFLAGS='-O3 -fomit-frame-pointer' --disable-debug --build=x86-64-linux --host=arm-linux --prefix=$(pwd)/install
# 编译
make -j<n>
# 安装
make install-strip
# 修改 install/lib/*.la 中的 libdir、dependency_libs 为 /usr/lib
# 修改 install/lib/pkgconfig/*.cp 中的 prefix 为 /usr
# 通过 grep 装路径关键字,确认一下还有哪些库或配置文件需要修改
grep -rn <install prefix key word>
# 修改可执行程序和共享库的 run path$ORIGIN 代表可执行文件所在的目录)
patchelf --set-rpath "\$ORIGIN/../lib" <exec file>
patchelf --set-rpath "\$ORIGIN/." <shared lib file>
```