Hello All,
I'm trying to create custom library .a (UART-test project)and the project is compiled and generated the .a and another project (ExternalImport) which is importing the .a.
the issue that the ExternalImport can't find a reference to the functions that are implemented in the .a
So what is wrong with the generated library?
Another question, what if I need to include a library from the ESP-IDF like spi_flash, is it possible? and if possible, what are the needed commands to be added to my CMake files?
Thanks in advance.
Mohammed
creating custom library
Re: creating custom library
Did you include header files from UART .a in ExternalImport project?
Re: creating custom library
yes, I did. I'm only getting the below library.
cmd.exe /C "cd . && C:\Users\mfawz\.espressif\tools\xtensa-esp32-elf\esp-2020r1-8.2.0\xtensa-esp32-elf\bin\xtensa-esp32-elf-g++.exe -mlongcalls -Wno-frame-address @CMakeFiles\import_prebuilt.elf.rsp -o import_prebuilt.elf && cd ."
c:/users/mfawz/.espressif/tools/xtensa-esp32-elf/esp-2020r1-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/main/libmain.a(main.c.obj):(.literal.app_main+0x0): undefined reference to `prebuilt_func'
c:/users/mfawz/.espressif/tools/xtensa-esp32-elf/esp-2020r1-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/main/libmain.a(main.c.obj):(.literal.app_main+0x4): undefined reference to `test'
c:/users/mfawz/.espressif/tools/xtensa-esp32-elf/esp-2020r1-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/main/libmain.a(main.c.obj): in function `app_main':
d:\cmaketest\externalimport\build/../main/main.c:17: undefined reference to `prebuilt_func'
c:/users/mfawz/.espressif/tools/xtensa-esp32-elf/esp-2020r1-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: d:\cmaketest\externalimport\build/../main/main.c:18: undefined reference to `test'
cmd.exe /C "cd . && C:\Users\mfawz\.espressif\tools\xtensa-esp32-elf\esp-2020r1-8.2.0\xtensa-esp32-elf\bin\xtensa-esp32-elf-g++.exe -mlongcalls -Wno-frame-address @CMakeFiles\import_prebuilt.elf.rsp -o import_prebuilt.elf && cd ."
c:/users/mfawz/.espressif/tools/xtensa-esp32-elf/esp-2020r1-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/main/libmain.a(main.c.obj):(.literal.app_main+0x0): undefined reference to `prebuilt_func'
c:/users/mfawz/.espressif/tools/xtensa-esp32-elf/esp-2020r1-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/main/libmain.a(main.c.obj):(.literal.app_main+0x4): undefined reference to `test'
c:/users/mfawz/.espressif/tools/xtensa-esp32-elf/esp-2020r1-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/main/libmain.a(main.c.obj): in function `app_main':
d:\cmaketest\externalimport\build/../main/main.c:17: undefined reference to `prebuilt_func'
c:/users/mfawz/.espressif/tools/xtensa-esp32-elf/esp-2020r1-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: d:\cmaketest\externalimport\build/../main/main.c:18: undefined reference to `test'
Re: creating custom library
With properly setup paths i get this (only part of logs):
Another thing is, that in your UART-test project you did not use test and prebuild_func, so they are not linked in library. You need at least minimal code like this:
at least i had to do this, when i built static library for esp32, but my static library also was built using esp32 toolchain.
Code: Select all
/home/chegewara/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /home/chegewara/demos/esp32s2/forks/UART-test/build/prebuilt/libprebuilt.a: error adding symbols: file format not recognized
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
ninja failed with exit code 1
Code: Select all
void app_main(void)
{
test();
prebuilt_func();
}
Re: creating custom library
Can you please to send me the two projects (UART_test, ExternalImport) in a zip file after update.
Who is online
Users browsing this forum: Majestic-12 [Bot] and 81 guests