file format not recognized when link an external .a lidrary

frank_he
Posts: 7
Joined: Wed Apr 08, 2020 5:41 am

file format not recognized when link an external .a lidrary

Postby frank_he » Wed Apr 08, 2020 5:48 am

hi,
i'm trying to call the function which is implemented in a static library(.a file) in app_main(). I already defined to linke this library in the component.mk of the main.c. the libray is prebuilt with GNC toolcahin (gcc),.
the console promote "libmylib.a: error adding symbols: file format not recognized" , do i need to build and ar the library with xtensa toolchain? or i missed something .
can anybody help to figure out where is the problem?

ESP_igrr
Posts: 2067
Joined: Tue Dec 01, 2015 8:37 am

Re: file format not recognized when link an external .a lidrary

Postby ESP_igrr » Wed Apr 08, 2020 7:30 am

You should be able to use regular 'ar' tool (this tool is not architecture specific), but you do need to use "xtensa-esp32-elf-gcc -mlongcalls" to build the object files which go into the static library.

frank_he
Posts: 7
Joined: Wed Apr 08, 2020 5:41 am

Re: file format not recognized when link an external .a lidrary

Postby frank_he » Thu Apr 23, 2020 12:28 pm

ESP_igrr wrote:
Wed Apr 08, 2020 7:30 am
You should be able to use regular 'ar' tool (this tool is not architecture specific), but you do need to use "xtensa-esp32-elf-gcc -mlongcalls" to build the object files which go into the static library.
Hi, Thanks you. Yes, indeed i need to rebuild the liabrary with the correct toolchain

Who is online

Users browsing this forum: Baidu [Spider] and 222 guests