I’m trying to build an esp32 project which links a static library I do not own. The lib has definition of cJSON functions which seems to be in conflict with libjson from the framework tools.
This is my platfomio.ini file:
[env:az-delivery-devkit-v4]
platform = espressif32
board = az-delivery-devkit-v4
framework = arduino
platform_packages =
toolchain-xtensa32 @ ~2.80200.0
framework-arduinoespressif32 @ https://hub.fastgit.org/espressif/arduino-esp32.git#idf-release/v4.2
lib_deps =
joylink
pal
TFT_espi
SPI
MD_AD9833
monitor_speed = 115200
monitor_filters = esp32_exception_decoder
build_flags =
-I ./example
-I ./lib/joylink/inc
-I ./lib/pal/inc
-L ./lib/joylink/lib
-l libjoylink
-DuECC_PLATFORM=uECC_arch_other -mlongcalls -Wshadow -Wpointer-arith -Waggregate-return -Winline -Wunreachable-code -D __LINUX_PAL__
-Wl,-Map,output.map
-DCORE_DEBUG_LEVEL=5
These are the error outputs:
Linking .pio\build\az-delivery-devkit-v4\firmware.elf
c:/users/gordon/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Gordon\.platformio\packages\framework-arduinoespressif32@src-af5e7a20b06459e6156a1629ec8e660c\tools\sdk\esp32\lib\libjson.a(cJSON.c.obj): in function `cJSON_GetErrorPtr':
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/json/cJSON/cJSON.c:78: multiple definition of `cJSON_GetErrorPtr'; lib\joylink\lib\libjoylink.a(cJSON.o):cJSON.c:(.text+0x0): first defined here
c:/users/gordon/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Gordon\.platformio\packages\framework-arduinoespressif32@src-af5e7a20b06459e6156a1629ec8e660c\tools\sdk\esp32\lib\libjson.a(cJSON.c.obj): in function `cJSON_InitHooks':
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/json/cJSON/cJSON.c:181: multiple definition of `cJSON_InitHooks'; lib\joylink\lib\libjoylink.a(cJSON.o):cJSON.c:(.text+0x144): first defined here
c:/users/gordon/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Gordon\.platformio\packages\framework-arduinoespressif32@src-af5e7a20b06459e6156a1629ec8e660c\tools\sdk\esp32\lib\libjson.a(cJSON.c.obj): in function `cJSON_Delete':
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/json/cJSON/cJSON.c:225: multiple definition of `cJSON_Delete'; lib\joylink\lib\libjoylink.a(cJSON.o):cJSON.c:(.text+0x1b8): first defined here
c:/users/gordon/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Gordon\.platformio\packages\framework-arduinoespressif32@src-af5e7a20b06459e6156a1629ec8e660c\tools\sdk\esp32\lib\libjson.a(cJSON.c.obj): in function `cJSON_ParseWithOpts':
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/json/cJSON/cJSON.c:1011: multiple definition of `cJSON_ParseWithOpts'; lib\joylink\lib\libjoylink.a(cJSON.o):cJSON.c:(.text+0x1070): first defined here
c:/users/gordon/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Gordon\.platformio\packages\framework-arduinoespressif32@src-af5e7a20b06459e6156a1629ec8e660c\tools\sdk\esp32\lib\libjson.a(cJSON.c.obj): in function `cJSON_Parse':
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/json/cJSON/cJSON.c:1091: multiple definition of `cJSON_Parse'; lib\joylink\lib\libjoylink.a(cJSON.o):cJSON.c:(.text+0x10ec): first defined here
c:/users/gordon/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Gordon\.platformio\packages\framework-arduinoespressif32@src-af5e7a20b06459e6156a1629ec8e660c\tools\sdk\esp32\lib\libjson.a(cJSON.c.obj): in function `cJSON_Print':
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/json/cJSON/cJSON.c:1163: multiple definition of `cJSON_Print'; lib\joylink\lib\libjoylink.a(cJSON.o):cJSON.c:(.text+0x1104): first defined here
c:/users/gordon/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Gordon\.platformio\packages\framework-arduinoespressif32@src-af5e7a20b06459e6156a1629ec8e660c\tools\sdk\esp32\lib\libjson.a(cJSON.c.obj): in function `cJSON_PrintUnformatted':
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/json/cJSON/cJSON.c:1168: multiple definition of `cJSON_PrintUnformatted'; lib\joylink\lib\libjoylink.a(cJSON.o):cJSON.c:(.text+0x111c): first defined here
c:/users/gordon/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Gordon\.platformio\packages\framework-arduinoespressif32@src-af5e7a20b06459e6156a1629ec8e660c\tools\sdk\esp32\lib\libjson.a(cJSON.c.obj): in function `cJSON_PrintBuffered':
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/json/cJSON/cJSON.c:1173: multiple definition of `cJSON_PrintBuffered'; lib\joylink\lib\libjoylink.a(cJSON.o):cJSON.c:(.text+0x1134): first defined here
c:/users/gordon/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Gordon\.platformio\packages\framework-arduinoespressif32@src-af5e7a20b06459e6156a1629ec8e660c\tools\sdk\esp32\lib\libjson.a(cJSON.c.obj): in function `cJSON_GetArraySize':
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/json/cJSON/cJSON.c:1731: multiple definition of `cJSON_GetArraySize'; lib\joylink\lib\libjoylink.a(cJSON.o):cJSON.c:(.text+0x1fe4): first defined here
c:/users/gordon/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Gordon\.platformio\packages\framework-arduinoespressif32@src-af5e7a20b06459e6156a1629ec8e660c\tools\sdk\esp32\lib\libjson.a(cJSON.c.obj): in function `cJSON_GetArrayItem':
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/json/cJSON/cJSON.c:1773: multiple definition of `cJSON_GetArrayItem'; lib\joylink\lib\libjoylink.a(cJSON.o):cJSON.c:(.text+0x2010): first defined here
c:/users/gordon/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Gordon\.platformio\packages\framework-arduinoespressif32@src-af5e7a20b06459e6156a1629ec8e660c\tools\sdk\esp32\lib\libjson.a(cJSON.c.obj): in function `cJSON_GetObjectItem':
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/json/cJSON/cJSON.c:1815: multiple definition of `cJSON_GetObjectItem'; lib\joylink\lib\libjoylink.a(cJSON.o):cJSON.c:(.text+0x203c): first defined here
c:/users/gordon/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Gordon\.platformio\packages\framework-arduinoespressif32@src-af5e7a20b06459e6156a1629ec8e660c\tools\sdk\esp32\lib\libjson.a(cJSON.c.obj): in function `cJSON_AddItemToArray':
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/json/cJSON/cJSON.c:1889: multiple definition of `cJSON_AddItemToArray'; lib\joylink\lib\libjoylink.a(cJSON.o):cJSON.c:(.text+0x20d4): first defined here
c:/users/gordon/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Gordon\.platformio\packages\framework-arduinoespressif32@src-af5e7a20b06459e6156a1629ec8e660c\tools\sdk\esp32\lib\libjson.a(cJSON.c.obj): in function `cJSON_AddItemToObject':
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/json/cJSON/cJSON.c:1947: multiple definition of `cJSON_AddItemToObject'; lib\joylink\lib\libjoylink.a(cJSON.o):cJSON.c:(.text+0x2114): first defined here
c:/users/gordon/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Gordon\.platformio\packages\framework-arduinoespressif32@src-af5e7a20b06459e6156a1629ec8e660c\tools\sdk\esp32\lib\libjson.a(cJSON.c.obj): in function `cJSON_AddItemToObjectCS':
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/json/cJSON/cJSON.c:1953: multiple definition of `cJSON_AddItemToObjectCS'; lib\joylink\lib\libjoylink.a(cJSON.o):cJSON.c:(.text+0x2154): first defined here
c:/users/gordon/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Gordon\.platformio\packages\framework-arduinoespressif32@src-af5e7a20b06459e6156a1629ec8e660c\tools\sdk\esp32\lib\libjson.a(cJSON.c.obj): in function `cJSON_AddItemReferenceToArray':
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/json/cJSON/cJSON.c:1958: multiple definition of `cJSON_AddItemReferenceToArray'; lib\joylink\lib\libjoylink.a(cJSON.o):cJSON.c:(.text+0x21ac): first defined here
c:/users/gordon/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Gordon\.platformio\packages\framework-arduinoespressif32@src-af5e7a20b06459e6156a1629ec8e660c\tools\sdk\esp32\lib\libjson.a(cJSON.c.obj): in function `cJSON_AddItemReferenceToObject':
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/json/cJSON/cJSON.c:1968: multiple definition of `cJSON_AddItemReferenceToObject'; lib\joylink\lib\libjoylink.a(cJSON.o):cJSON.c:(.text+0x21cc): first defined here
c:/users/gordon/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Gordon\.platformio\packages\framework-arduinoespressif32@src-af5e7a20b06459e6156a1629ec8e660c\tools\sdk\esp32\lib\libjson.a(cJSON.c.obj): in function `cJSON_DetachItemFromArray':
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/json/cJSON/cJSON.c:2116: multiple definition of `cJSON_DetachItemFromArray'; lib\joylink\lib\libjoylink.a(cJSON.o):cJSON.c:(.text+0x21f0): first defined here
c:/users/gordon/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Gordon\.platformio\packages\framework-arduinoespressif32@src-af5e7a20b06459e6156a1629ec8e660c\tools\sdk\esp32\lib\libjson.a(cJSON.c.obj): in function `cJSON_DeleteItemFromArray':
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/json/cJSON/cJSON.c:2126: multiple definition of `cJSON_DeleteItemFromArray'; lib\joylink\lib\libjoylink.a(cJSON.o):cJSON.c:(.text+0x2264): first defined here
c:/users/gordon/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Gordon\.platformio\packages\framework-arduinoespressif32@src-af5e7a20b06459e6156a1629ec8e660c\tools\sdk\esp32\lib\libjson.a(cJSON.c.obj): in function `cJSON_DetachItemFromObject':
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/json/cJSON/cJSON.c:2131: multiple definition of `cJSON_DetachItemFromObject'; lib\joylink\lib\libjoylink.a(cJSON.o):cJSON.c:(.text+0x2288): first defined here
c:/users/gordon/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Gordon\.platformio\packages\framework-arduinoespressif32@src-af5e7a20b06459e6156a1629ec8e660c\tools\sdk\esp32\lib\libjson.a(cJSON.c.obj): in function `cJSON_DeleteItemFromObject':
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/json/cJSON/cJSON.c:2145: multiple definition of `cJSON_DeleteItemFromObject'; lib\joylink\lib\libjoylink.a(cJSON.o):cJSON.c:(.text+0x22d8): first defined here
c:/users/gordon/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Gordon\.platformio\packages\framework-arduinoespressif32@src-af5e7a20b06459e6156a1629ec8e660c\tools\sdk\esp32\lib\libjson.a(cJSON.c.obj): in function `cJSON_InsertItemInArray':
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/json/cJSON/cJSON.c:2156: multiple definition of `cJSON_InsertItemInArray'; lib\joylink\lib\libjoylink.a(cJSON.o):cJSON.c:(.text+0x22fc): first defined here
c:/users/gordon/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Gordon\.platformio\packages\framework-arduinoespressif32@src-af5e7a20b06459e6156a1629ec8e660c\tools\sdk\esp32\lib\libjson.a(cJSON.c.obj): in function `cJSON_ReplaceItemInArray':
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/json/cJSON/cJSON.c:2220: multiple definition of `cJSON_ReplaceItemInArray'; lib\joylink\lib\libjoylink.a(cJSON.o):cJSON.c:(.text+0x2368): first defined here
c:/users/gordon/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Gordon\.platformio\packages\framework-arduinoespressif32@src-af5e7a20b06459e6156a1629ec8e660c\tools\sdk\esp32\lib\libjson.a(cJSON.c.obj): in function `cJSON_ReplaceItemInObject':
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/json/cJSON/cJSON.c:2250: multiple definition of `cJSON_ReplaceItemInObject'; lib\joylink\lib\libjoylink.a(cJSON.o):cJSON.c:(.text+0x23ec): first defined here
c:/users/gordon/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Gordon\.platformio\packages\framework-arduinoespressif32@src-af5e7a20b06459e6156a1629ec8e660c\tools\sdk\esp32\lib\libjson.a(cJSON.c.obj): in function `cJSON_CreateNull':
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/json/cJSON/cJSON.c:2261: multiple definition of `cJSON_CreateNull'; lib\joylink\lib\libjoylink.a(cJSON.o):cJSON.c:(.text+0x2444): first defined here
c:/users/gordon/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Gordon\.platformio\packages\framework-arduinoespressif32@src-af5e7a20b06459e6156a1629ec8e660c\tools\sdk\esp32\lib\libjson.a(cJSON.c.obj): in function `cJSON_CreateTrue':
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/json/cJSON/cJSON.c:2272: multiple definition of `cJSON_CreateTrue'; lib\joylink\lib\libjoylink.a(cJSON.o):cJSON.c:(.text+0x245c): first defined here
c:/users/gordon/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Gordon\.platformio\packages\framework-arduinoespressif32@src-af5e7a20b06459e6156a1629ec8e660c\tools\sdk\esp32\lib\libjson.a(cJSON.c.obj): in function `cJSON_CreateFalse':
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/json/cJSON/cJSON.c:2283: multiple definition of `cJSON_CreateFalse'; lib\joylink\lib\libjoylink.a(cJSON.o):cJSON.c:(.text+0x2474): first defined here
c:/users/gordon/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Gordon\.platformio\packages\framework-arduinoespressif32@src-af5e7a20b06459e6156a1629ec8e660c\tools\sdk\esp32\lib\libjson.a(cJSON.c.obj): in function `cJSON_CreateBool':
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/json/cJSON/cJSON.c:2294: multiple definition of `cJSON_CreateBool'; lib\joylink\lib\libjoylink.a(cJSON.o):cJSON.c:(.text+0x248c): first defined here
c:/users/gordon/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Gordon\.platformio\packages\framework-arduinoespressif32@src-af5e7a20b06459e6156a1629ec8e660c\tools\sdk\esp32\lib\libjson.a(cJSON.c.obj): in function `cJSON_CreateNumber':
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/json/cJSON/cJSON.c:2305: multiple definition of `cJSON_CreateNumber'; lib\joylink\lib\libjoylink.a(cJSON.o):cJSON.c:(.text+0x24b4): first defined here
c:/users/gordon/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Gordon\.platformio\packages\framework-arduinoespressif32@src-af5e7a20b06459e6156a1629ec8e660c\tools\sdk\esp32\lib\libjson.a(cJSON.c.obj): in function `cJSON_CreateString':
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/json/cJSON/cJSON.c:2331: multiple definition of `cJSON_CreateString'; lib\joylink\lib\libjoylink.a(cJSON.o):cJSON.c:(.text+0x24ec): first defined here
c:/users/gordon/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Gordon\.platformio\packages\framework-arduinoespressif32@src-af5e7a20b06459e6156a1629ec8e660c\tools\sdk\esp32\lib\libjson.a(cJSON.c.obj): in function `cJSON_CreateArray':
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/json/cJSON/cJSON.c:2398: multiple definition of `cJSON_CreateArray'; lib\joylink\lib\libjoylink.a(cJSON.o):cJSON.c:(.text+0x2514): first defined here
c:/users/gordon/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Gordon\.platformio\packages\framework-arduinoespressif32@src-af5e7a20b06459e6156a1629ec8e660c\tools\sdk\esp32\lib\libjson.a(cJSON.c.obj): in function `cJSON_CreateObject':
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/json/cJSON/cJSON.c:2409: multiple definition of `cJSON_CreateObject'; lib\joylink\lib\libjoylink.a(cJSON.o):cJSON.c:(.text+0x252c): first defined here
c:/users/gordon/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Gordon\.platformio\packages\framework-arduinoespressif32@src-af5e7a20b06459e6156a1629ec8e660c\tools\sdk\esp32\lib\libjson.a(cJSON.c.obj): in function `cJSON_CreateIntArray':
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/json/cJSON/cJSON.c:2421: multiple definition of `cJSON_CreateIntArray'; lib\joylink\lib\libjoylink.a(cJSON.o):cJSON.c:(.text+0x2544): first defined here
c:/users/gordon/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Gordon\.platformio\packages\framework-arduinoespressif32@src-af5e7a20b06459e6156a1629ec8e660c\tools\sdk\esp32\lib\libjson.a(cJSON.c.obj): in function `cJSON_CreateFloatArray':
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/json/cJSON/cJSON.c:2456: multiple definition of `cJSON_CreateFloatArray'; lib\joylink\lib\libjoylink.a(cJSON.o):cJSON.c:(.text+0x25b8): first defined here
c:/users/gordon/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Gordon\.platformio\packages\framework-arduinoespressif32@src-af5e7a20b06459e6156a1629ec8e660c\tools\sdk\esp32\lib\libjson.a(cJSON.c.obj): in function `cJSON_CreateDoubleArray':
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/json/cJSON/cJSON.c:2492: multiple definition of `cJSON_CreateDoubleArray'; lib\joylink\lib\libjoylink.a(cJSON.o):cJSON.c:(.text+0x2630): first defined here
c:/users/gordon/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Gordon\.platformio\packages\framework-arduinoespressif32@src-af5e7a20b06459e6156a1629ec8e660c\tools\sdk\esp32\lib\libjson.a(cJSON.c.obj): in function `cJSON_CreateStringArray':
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/json/cJSON/cJSON.c:2528: multiple definition of `cJSON_CreateStringArray'; lib\joylink\lib\libjoylink.a(cJSON.o):cJSON.c:(.text+0x269c): first defined here
c:/users/gordon/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Gordon\.platformio\packages\framework-arduinoespressif32@src-af5e7a20b06459e6156a1629ec8e660c\tools\sdk\esp32\lib\libjson.a(cJSON.c.obj): in function `cJSON_Duplicate':
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/json/cJSON/cJSON.c:2565: multiple definition of `cJSON_Duplicate'; lib\joylink\lib\libjoylink.a(cJSON.o):cJSON.c:(.text+0x2704): first defined here
c:/users/gordon/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\Gordon\.platformio\packages\framework-arduinoespressif32@src-af5e7a20b06459e6156a1629ec8e660c\tools\sdk\esp32\lib\libjson.a(cJSON.c.obj): in function `cJSON_Minify':
/Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/json/cJSON/cJSON.c:2693: multiple definition of `cJSON_Minify'; lib\joylink\lib\libjoylink.a(cJSON.o):cJSON.c:(.text+0x27fc): first defined here
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\az-delivery-devkit-v4\firmware.elf] Error 1
========================= [FAILED] Took 53.55 seconds =========================
CMakeFiles\Production.dir\build.make:76: recipe for target 'CMakeFiles/Production' failed
CMakeFiles\Makefile2:98: recipe for target 'CMakeFiles/Production.dir/all' failed
CMakeFiles\Makefile2:105: recipe for target 'CMakeFiles/Production.dir/rule' failed
Makefile:137: recipe for target 'Production' failed
mingw32-make.exe[3]: *** [CMakeFiles/Production] Error 1
mingw32-make.exe[2]: *** [CMakeFiles/Production.dir/all] Error 2
mingw32-make.exe[1]: *** [CMakeFiles/Production.dir/rule] Error 2
mingw32-make.exe: *** [Production] Error 2
In idf4.2 the linker throws multiple definition error (not if I use 4.0).
What I have tried so far
- Move project cJSON.h into a folder named cJSON under ./lib
- Add cJSON to lib-ignore
- Add path to libjson to lib-ignore
- Delete the include_directories line targeting cJSON
None of the above works.
My question is how to resolve such conflicts under platformio. Any help will be much appreciated.