linker cannot find external library
Posted: Wed Apr 06, 2022 12:31 am
I am trying to use the jsoncpp library (https://github.com/open-source-parsers/jsoncpp)
I have followed the example found in https://github.com/espressif/esp-idf/tr ... import_lib to add third party libraries.
I have edited my CMakeLists.txt in the same way and made sure to set specific build options after reading cmakelist.txt of jsoncpp library as followed:
cmake configures just fine and the build process proceeds until it reaches the linker part where i get the following error
i can confirm that there is a jsoncpp.a in build/lib directory but the linker cant find anything.
i have tried to fix this for an hour but found nothing really specific to this in the internet. My knowledge with cmake and building in general is limited so i really appreciate if anyone can help
I have followed the example found in https://github.com/espressif/esp-idf/tr ... import_lib to add third party libraries.
I have edited my CMakeLists.txt in the same way and made sure to set specific build options after reading cmakelist.txt of jsoncpp library as followed:
Code: Select all
idf_component_register(SRCS "main.cpp"
INCLUDE_DIRS "."
EMBED_TXTFILES gtsr1.pem)
option(BUILD_SHARED_LIBS OFF)
option(BUILD_TESTING OFF)
option(BUILD_OBJECT_LIBS OFF)
option(APPLE OFF)
option(JSONCPP_WITH_TESTS OFF)
function(install)
endfunction()
function(export)
endfunction()
add_subdirectory(jsoncpp)
target_link_libraries(${COMPONENT_LIB} PUBLIC jsoncpp)
Code: Select all
[3/4] Linking CXX executable bin/firebase-esp-idf.elf
FAILED: bin/firebase-esp-idf.elf
: && /home/madjid/.espressif/tools/xtensa-esp32-elf/esp-2021r2-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++ -mlongcalls -Wno-frame-address CMakeFiles/firebase-esp-idf.elf.dir/project_elf_src_esp32.c.obj -o bin/firebase-esp-idf.elf esp-idf/esp_pm/libesp_pm.a. ...............etc.......................... -u newlib_include_syscalls_impl -u newlib_include_pthread_impl -u newlib_include_assert_impl -u __cxa_guard_dummy -lstdc++ esp-idf/pthread/libpthread.a -lgcc esp-idf/cxx/libcxx.a -ljsoncpp && :
.espressif/../../../../xtensa-esp32-elf/bin/ld: cannot find -ljsoncpp
i have tried to fix this for an hour but found nothing really specific to this in the internet. My knowledge with cmake and building in general is limited so i really appreciate if anyone can help