Skip to content

Commit 6124a98

Browse files
committed
add alpine_sh_not_found
1 parent 8385bba commit 6124a98

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

2022/04/alpine_sh_not_found.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# [alpine sh not found](/2022/04/alpine_sh_not_found.md)
2+
3+
发现 alpine linux 的 `sh: command not found` 除了可执行文件不存在之外,还有一种可能就是 ld-linux (可执行文件的解释器?) 版本太低导致 ld-linux 找不到所以显示 sh: not found
4+
5+
如果 Rust 程序有 C/C++ 一些动态库依赖之后打成 musl 就加入了 ld-linux 的版本信息到可执行文件(无法做成 static linked) 建个高版本 ld-linux 软链接即可解决
6+
7+
https://twitter.com/ospopen/status/1514953405269430272
8+
9+
## musl 带 C 动态库依赖
10+
11+
需求: 由高版本的 archlinux 编译出 musl 给 centos8 用,包含 python 和 zmq 的动态库
12+
13+
除了 rustcflags 要加上 `-Ctarget-feature=-crt-static` 之外,还有设置下 PYO3_PYTHON 环境变量的路径,
14+
以及 PKG_CONFIG_SYSROOT_DIR=/usr/lib (zmq 用的 pkgconf 那个库设置的交叉编译引用的动态库路径)
15+
16+
参考: https://dustri.org/b/error-loading-shared-library-ld-linux-x86-64so2-on-alpine-linux.html
17+
18+
```
19+
FROM alpine
20+
RUN apk add --no-cache python3-dev zeromq
21+
COPY config/kernel-123-kernel_id.json /etc/
22+
COPY target/x86_64-unknown-linux-musl/release/idp_kernel /usr/bin/
23+
RUN ln -s /lib/libc.musl-x86_64.so.1 /lib/ld-linux-x86-64.so.2
24+
ENTRYPOINT [ "/lib/ld-linux-x86-64.so.2", "/usr/bin/idp_kernel", "-f", "/etc/kernel-123-kernel_id.json" ]
25+
```

2022/04/brk.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ Rust 的 spawn 用的是 clone (不清楚什么时候会用 posix_spawn)
3737

3838
根据 man 文档说也就 clone 提供了更细粒度的子进程控制,例如父子进程共享虚拟内存
3939

40+
## LWP
41+
42+
clone 创建的是轻量级进程(LWP),轻量级进程等于线程?
43+
4044
## strace 必经流程
4145

4246
1. execve

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
- [归档 - 吴翱翔的博客](/)
22
- **2022-04**
3+
- [alpine sh not found](/2022/04/alpine_sh_not_found.md)
34
- [brk](/2022/04/brk.md)
45
- [用时序图理解接口业务](/2022/04/uml_sequence_diagram.md)
56
- **2022-03**

0 commit comments

Comments
 (0)