Hello,
I want to port mxml library in esp-idf where i want to use my static libmxml.a. For that i added One folder in Component , it's structure is as following:
-- component
-- libxml
-- include
(contain header file)
-- lib
(contain lib file libmxml.a)
--component.mk
COMPONENT_ADD_LDFLAGS=$(COMPONENT_PATH)/lib/libmxml.a -l$(COMPONENT_NAME)
include $(IDF_PATH)/make/component_common.mk
--main
--main.c
contain application code
-- component.mk
include $(IDF_PATH)/make/component_common.mk
Referance @ https://esp32.com/viewtopic.php?f=13&t= ... rary#p2298
after compiling this project i get following error:
/esp-idf-v2.1/components/libmxml/lib/libmxml.a: error adding symbols: File format not recognized
Am i Doing anything wrong?
Can anyone provide suggestion regarding this or guidance to port library in esp-idf?
How to Link third party library in esp-idf
-
- Posts: 23
- Joined: Thu Oct 26, 2017 7:34 am
-
- Posts: 9761
- Joined: Thu Nov 26, 2015 4:08 am
Re: How to Link third party library in esp-idf
How did you compile this static library?
-
- Posts: 23
- Joined: Thu Oct 26, 2017 7:34 am
Re: How to Link third party library in esp-idf
I have its all ".o" file, using those files I generate lib using xtensa too-chain's AR command.
so when i compile my application with mxml function. i get following error:
I have also added tried to generate my lib using xtensa ranlib. i made following makefile to generate lib:
where LIBOBJS contain my all ".o " files.
so when i compile my application with mxml function. i get following error:
Code: Select all
/libxml.a: error adding symbols: Archive has no index; run ranlib to add one
collect2: error: ld returned 1 exit status
Code: Select all
AR = xtensa-esp32-elf-ar
RAN = xtensa-esp32-elf-ranlib
ARFLAGS = cru
libxml.a:
$(RM) $@
$(AR) $(ARFLAGS) $(LIBOBJS)
$(RANLIB) $@
where LIBOBJS contain my all ".o " files.
-
- Posts: 9761
- Joined: Thu Nov 26, 2015 4:08 am
Re: How to Link third party library in esp-idf
Pretty sure the way you call $(AR) in the makefile is missing an $@ somewhere...
Who is online
Users browsing this forum: Bing [Bot], RudyWeber and 92 guests