一直想在ubuntu低版本中使用高版本bear,花了两天时间从ubuntu22.10环境成功编译出相关静态可执行文件
/home/share/stage ✘ tree -L 3
.
├── bin
│ ├── bear
│ ├── citnames
│ └── intercept
├── lib
│ └── bear
│ ├── libexec.so
│ ├── wrapper
│ └── wrapper.d
└── share
└── man
└── man1
/home/share/stage ✘ file bin/*
bin/bear: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, BuildID[sha1]=042463e3327e500083bcf2d059b2148bcd91b566, for GNU/Linux 3.2.0, not stripped
bin/citnames: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, BuildID[sha1]=2bd0204f81e1cc931e7dff102b9d88efba16b388, for GNU/Linux 3.2.0, not stripped
bin/intercept: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, BuildID[sha1]=113e9edfc690df600527799ff0e0777a19969716, for GNU/Linux 3.2.0, not stripped
本来以为成功,便在ubuntu18.04环境下验证,显示版本均正常
/home/share/stage ✘ ./bin/bear --version
bear 3.0.20
/home/share/stage ✘ ./bin/intercept --version
intercept 3.0.20
/home/share/stage ✘ ./bin/citnames --version
citnames 3.0.20
/home/share/stage ✘
但是最终测试功能却异常,原因如下
/home/share/stage ✘ ldd ./lib/bear/libexec.so
./lib/bear/libexec.so: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by ./lib/bear/libexec.so)
./lib/bear/libexec.so: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by ./lib/bear/libexec.so)
linux-vdso.so.1 (0x00007ffc24e50000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fd9bdf49000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd9bdb58000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fd9bd7ba000)
/lib64/ld-linux-x86-64.so.2 (0x00007fd9be2d2000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fd9bd5a2000)
/home/share/stage ✘
总结如下
1、需要使用对应开发环境进行编译
2、需要移植海量依赖库
个人已经放弃不再折腾,记录一下供类似需求的参考
标签:bin,x86,lib,静态,share,bear,编译,64 From: https://www.cnblogs.com/rdwr/p/17292460.html