|
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
6 u( @, g3 t7 N1 o% FARM-linux-gnueabi-readelf工具解决问题7 z: |# N3 e# j3 B& Z" D1 f
编译一个32位平台的内核时,出现如下错误提示:( J. U% Y& b ^2 {3 }- N; d
* q9 L2 }* R$ Z( ?7 Clibschw.a: could not read symbols: File format not recognized
- v9 n9 V. {( j0 _
2 H6 U4 R# e- J于是进入相应的目录发现,libschw.a这个文件是存在的,但是为啥编译不过呢,同样的编译在另外一个64位平台却没有这个报错。( ]( i$ \$ B7 G$ M V
# s9 U s9 t' n; P: o
思路:是否与32位64位平台有关?# G8 K$ ~. t9 L. C. k) X8 b
使用readelf来查看一下这个库,
3 \& ^. \) K7 F2 P A$ arm-linux-gnueabi-readelf -h modules/aw_schw/libschw5 v* c2 z; r- }
File: modules/aw_schw/libschw(aw_schw_lib.o)4 O$ Z ]9 r: q, Z5 r
ELF Header:- [2 G9 x! Z1 h
Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00& o- P7 l# g3 o7 J0 |# t7 p$ ~
Class: ELF64 g' v6 m5 S. Q4 U7 t6 V; A
Data: 2's complement, little endian# G, ?4 h7 Q$ W% O
Version: 1 (current)
7 B6 _% K/ J. ^ ^# X! z OS/ABI: UNIX - System V
* z' ~/ I! B# ~% s2 w ABI Version: 0
1 L( @% |# V7 r' d' x. Z Type: REL (Relocatable file)4 h5 P2 X8 f# C
Machine: <unknown>: 0xb7
% D4 o" Q0 k: g% R9 Y0 g7 U5 Y Version: 0x1! h1 g4 r: r/ ]: ?% k
Entry point address: 0x0
- O& b! w* s5 l1 \" o Start of program headers: 0 (bytes into file)! J' P; ~; k& x. m3 s
Start of section headers: 161192 (bytes into file)' C+ U/ f3 z4 {8 }3 g" {3 d
Flags: 0x0
3 u* t5 S$ ^: R3 n Size of this header: 64 (bytes)
) `5 u/ b; \" S: L- v8 p7 W Size of program headers: 0 (bytes)
0 t1 a) Y' B' g( W6 g Z Number of program headers: 0; N7 X% d4 j$ O# G( |
Size of section headers: 64 (bytes)) C+ a) e. Y6 R9 h! f
Number of section headers: 29
% D, x- S5 e% ~ Section header string table index: 24( P/ ~1 ~$ k9 U' R
果然,这个库显示是64位的,为了兼容32位的,只能修改Makefile,判断到32位时,使用32位的库。
& H) W7 ^/ i# r" N' I% F. z. s+ifeq ($(LICHEE_ARCH),arm64)5 D& i7 P; x( N5 d
cp libschw libschw.a: G& O4 Q- l8 v6 d7 \/ x4 D* {* S
+else
- C* n! q9 J# m# y% l Z, L+ cp libschw32 libschw.a
+ P, D* |9 ]+ G9 F+ A+ o5 v8 \ u+endif2 Q# y* m/ n; ~( ?2 X
重新弄一份新32位的libschw32库后,重新编译,问题解决。
4 R! M- s; G- l |
|