EDA365电子论坛网

标题: could not read symbols: File format not recognized [打印本页]

作者: uperrua    时间: 2020-4-16 10:29
标题: could not read symbols: File format not recognized

- D  ~1 X. {/ \3 w3 _arm-linux-gnueabi-readelf工具解决问题
: _8 c9 E+ Y, q& Q/ x9 v编译一个32位平台的内核时,出现如下错误提示:
" r; w8 e7 a& J7 r- m) Y. O* t3 Z+ B2 l% c# X, Q
libschw.a: could not read symbols: File format not recognized
0 e% C1 x# V7 \/ s' g9 w
: A# N6 J" D# h! D  R4 q7 K于是进入相应的目录发现,libschw.a这个文件是存在的,但是为啥编译不过呢,同样的编译在另外一个64位平台却没有这个报错。  z8 a6 ~2 y2 S+ A2 c" I' l) l
+ z6 @+ t* J; k, ?6 |1 g* U
思路:是否与32位64位平台有关?8 ]1 u- }: M! T) \# M1 N, d
使用readelf来查看一下这个库,: w2 U9 f$ x2 A3 b+ w- g
$ arm-linux-gnueabi-readelf -h modules/aw_schw/libschw5 u# s* t2 n* {; h  x
File: modules/aw_schw/libschw(aw_schw_lib.o)
! N* e! f/ I7 v! g6 b. K8 i+ JELF Header:
( a# [( f* @) R5 b; X  Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
+ ]0 r9 h" N  ^. h  Class:                             ELF64
# m8 i" R, D' r. c. x  Data:                              2's complement, little endian
0 J. f2 ~" p5 P+ ?8 Y: O. v5 X  Version:                           1 (current)+ }9 o! o% \6 s
  OS/ABI:                            UNIX - System V" \8 k8 q! W+ @! z1 t1 f" B7 q
  ABI Version:                       0! @; y9 Y. q# \7 j+ A  v) P4 q
  Type:                              REL (Relocatable file)' b) f- n8 d) }$ j
  Machine:                           <unknown>: 0xb74 _& D* S4 M9 y( H; N) j5 Q6 N
  Version:                           0x16 i0 F6 ^0 ^  ~! @6 W0 X
  Entry point address:               0x0  G! G8 H3 M' i; h2 A! t. }
  Start of program headers:          0 (bytes into file)
: K5 D8 e% `/ ~  |" }. t* ~  Start of section headers:          161192 (bytes into file)" m" T6 }+ e+ g3 N6 U( d% c
  Flags:                             0x0
' }) n5 Z6 c) `% B/ |+ J9 N2 O  Size of this header:               64 (bytes)  S& |7 D7 {  I# L, G3 V
  Size of program headers:           0 (bytes)
4 c2 h( t/ S8 x) \4 C& C  Number of program headers:         0$ K. j, Y# q% s' {$ Z5 ^  [
  Size of section headers:           64 (bytes)3 k( o2 j* _8 E% [9 v
  Number of section headers:         299 Y, D7 J5 j: g- n9 Q
  Section header string table index: 24
5 [5 c  l/ X! s7 \" ~6 c7 s( p6 x果然,这个库显示是64位的,为了兼容32位的,只能修改Makefile,判断到32位时,使用32位的库。
% M  l% R% I( G1 ^+ifeq ($(LICHEE_ARCH),arm64)4 G% w' G4 `, W/ v' \: M' k+ H
        cp libschw libschw.a
" C; W9 b* [, h% w* K7 _9 s0 _) U+else
4 S( Z/ q6 K6 q6 i' z3 `+       cp libschw32 libschw.a
8 l0 x- w- l7 }7 R+endif, D3 V$ T. _1 ^/ i9 t0 R9 J
重新弄一份新32位的libschw32库后,重新编译,问题解决。
+ q! ?3 j$ J$ v6 E
作者: NingW    时间: 2020-4-16 18:58
could not read symbols: File format not recognized




欢迎光临 EDA365电子论坛网 (https://bbs.eda365.com/) Powered by Discuz! X3.2