Page 1 of 1

file format not recognized when link an external .a lidrary

Posted: Wed Apr 08, 2020 5:48 am
by frank_he
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?

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

Posted: Wed Apr 08, 2020 7:30 am
by ESP_igrr
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.

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

Posted: Thu Apr 23, 2020 12:28 pm
by frank_he
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