总结 交叉编译 技术经验.
Signed-off-by: chen.yang <chen.yang@yuzhen-iot.com>
This commit is contained in:
parent
533973ecf6
commit
bc82d4d728
|
@ -147,6 +147,8 @@ Dynamic section at offset 0xe08 contains 26 entries:
|
|||
...
|
||||
```
|
||||
|
||||
运行可执行程序时,-rpath-link指定的路径不再有效,而-rpath指定的路径还有效。
|
||||
|
||||
## 3. 外部参考资料
|
||||
|
||||
1. [gcc警告选项汇总](https://blog.csdn.net/qq_17308321/article/details/79979514)
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
# Patchelf 修改 Linux 下 ELF 文件 Library 搜索路径 Runpath
|
||||
|
||||
## 1. 安装
|
||||
|
||||
```bash
|
||||
# Ubuntu
|
||||
sudo apt install patchelf
|
||||
```
|
||||
|
||||
## 2. 基本用法
|
||||
|
||||
```bash
|
||||
# elf file 可以为可执行性程序,也可以为动态库
|
||||
patchelf --set-rpath <new runpath> <elf file>
|
||||
# 修改后确认
|
||||
readelf -d <elf file>
|
||||
```
|
|
@ -23,7 +23,7 @@ autogen.sh
|
|||
* i386-linux
|
||||
|
||||
```bash
|
||||
./configure --build=arm-linux
|
||||
./configure --build=x86-64-linux
|
||||
```
|
||||
|
||||
### 1.2. --host
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
# 交叉编译软件库并安装
|
||||
|
||||
## 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
|
||||
patchelf --set-rpath /usr/lib <elf file>
|
||||
```
|
Loading…
Reference in New Issue