|
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
0 c3 s" R2 B5 G$ H4 A9 p
ARM-linux-gnueabi-readelf工具解决问题
1 \7 @: W2 e3 V; `% `( f编译一个32位平台的内核时,出现如下错误提示:
7 P7 f$ C8 y2 ?7 U, s, G) S" N/ b& T- p% O1 ?1 G' c, D3 F
libschw.a: could not read symbols: File format not recognized
2 U9 `/ V% O. \# d* O/ i% Y5 x
7 Z8 B0 Y* g7 h9 e2 O. V. A ?于是进入相应的目录发现,libschw.a这个文件是存在的,但是为啥编译不过呢,同样的编译在另外一个64位平台却没有这个报错。
! d+ w' K% |; V: W5 j. c3 T% f' g- i- }. e. `, _7 Y
思路:是否与32位64位平台有关?
* W; @) c! Z, Y使用readelf来查看一下这个库,
1 X; F- I$ ^- u5 j' d2 {2 Q$ arm-linux-gnueabi-readelf -h modules/aw_schw/libschw
" }7 \# l- L% AFile: modules/aw_schw/libschw(aw_schw_lib.o)
! N5 O: f! J; a" p" Z7 L% qELF Header:+ A6 k7 l# C! Y7 d) w) d1 e2 h- e( s
Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
" ~/ W/ H* t7 G+ Z8 }( K Class: ELF64
; l% d: r3 F/ {8 ^* c0 g# P Data: 2's complement, little endian4 E0 P% Z [! M! m
Version: 1 (current)/ P6 ]- f3 A$ q7 f; i$ p7 `% T8 R
OS/ABI: UNIX - System V! X* @- L$ o! O7 F: r. i% [% U
ABI Version: 0) r4 X, `" O' w" H, o
Type: REL (Relocatable file)
, ~' F2 e% a1 N9 l% y. l Machine: <unknown>: 0xb7
7 {9 T- R* A1 c) q Version: 0x18 B: i- [4 p+ |* R5 z K' n% h
Entry point address: 0x0( c% V% T' N$ d! Q- g/ {
Start of program headers: 0 (bytes into file)3 N5 y+ C2 l9 K* h5 {4 Q
Start of section headers: 161192 (bytes into file)
/ j' _" M0 ], M) ^- d Flags: 0x06 T$ H. i1 N" i9 {8 e& }
Size of this header: 64 (bytes)1 h2 ^/ K* U' q- t9 m, ?3 n
Size of program headers: 0 (bytes)( {" G& c- g' u3 b; |1 d
Number of program headers: 0
" L( @$ h2 T, P& e3 u1 T5 D* z Size of section headers: 64 (bytes)3 c( ]- I4 m5 z0 O( Z' T3 m
Number of section headers: 29
) V6 c2 e; \2 W/ f, U; P2 t8 i Section header string table index: 24
" `6 \) w- Y9 }7 ^ ?( q. z- f果然,这个库显示是64位的,为了兼容32位的,只能修改Makefile,判断到32位时,使用32位的库。! j3 C3 z" S) [* J+ g
+ifeq ($(LICHEE_ARCH),arm64)" y l; D1 ?/ O' s' P% T
cp libschw libschw.a) O* k; U; }4 [# x6 w# u2 b. Q
+else; f: ^9 U z( V7 o- i! r0 r5 O
+ cp libschw32 libschw.a& M) k) ~! X* s W& [- `2 b
+endif" f1 Q+ b7 f! y! B. ~+ Y) r
重新弄一份新32位的libschw32库后,重新编译,问题解决。
" t7 g/ e1 I m9 k3 t' V3 N6 m m |
|