espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.19k stars 7.17k forks source link

How use posix func like mutex and cond? (IDFGH-10982) #12171

Closed Shaco-Ma closed 11 months ago

Shaco-Ma commented 11 months ago

Answers checklist.

General issue report

use idf v5.1-dirty chip:esp32c6 when I use pthread.h func,like pthread_mutex_lock and pthread_cond_broadcast and so on, also include #include ,use idf4.4.4 is complie ok,but when use idf5.1, it's had wrong in ld fail and multiple definition: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: esp-idf/pthread/libpthread.a(pthread_rwlock.c.obj): in function pthread_rwlock_unlock': /home/MyData/esp/esp-idf-5.1/components/pthread/pthread_rwlock.c:244: warning: pthread_cond_broadcast is not implemented and will always fail /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: esp-idf/pthread/libpthread.a(pthread_rwlock.c.obj): in functionpthread_rwlock_destroy': /home/MyData/esp/esp-idf-5.1/components/pthread/pthread_rwlock.c:130: warning: pthread_cond_destroy is not implemented and will always fail /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: esp-idf/pthread/libpthread.a(pthread_cond_var.c.obj): in function s_check_and_init_if_static': /home/MyData/esp/esp-idf-5.1/components/pthread/pthread_cond_var.c:45: warning: pthread_cond_init is not implemented and will always fail /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: esp-idf/pthread/libpthread.a(pthread_cond_var.c.obj): in functionpthread_cond_wait': /home/MyData/esp/esp-idf-5.1/components/pthread/pthread_cond_var.c:94: warning: pthread_cond_timedwait is not implemented and will always fail /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: esp-idf/pthread/libpthread.a(pthread_rwlock.c.obj): in function pthread_rwlock_rdlock': /home/MyData/esp/esp-idf-5.1/components/pthread/pthread_rwlock.c:181: warning: pthread_cond_wait is not implemented and will always fail /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: esp-idf/main/libmain.a(libbuf.c.obj): in functionlibBuf_free': /home/shaco/Work/Code/hs28p_rk3328_v02/main/libbuf/libbuf.c:87: warning: pthread_condattr_destroy is not implemented and will always fail /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: esp-idf/main/libmain.a(libbuf.c.obj): in function libBuf_init': /home/shaco/Work/Code/hs28p_rk3328_v02/main/libbuf/libbuf.c:57: warning: pthread_condattr_init is not implemented and will always fail /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: esp-idf/pthread/libpthread.a(pthread.c.obj): in functionesp_pthread_set_cfg': /home/MyData/esp/esp-idf-5.1/components/pthread/pthread.c:135: warning: pthread_getspecific is not implemented and will always fail /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: esp-idf/pthread/libpthread.a(pthread.c.obj): in function esp_pthread_init': /home/MyData/esp/esp-idf-5.1/components/pthread/pthread.c:72: warning: pthread_key_create is not implemented and will always fail /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/MyData/esp/esp-idf-5.1/components/pthread/pthread.c:77: warning: pthread_key_delete is not implemented and will always fail /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: esp-idf/pthread/libpthread.a(pthread_rwlock.c.obj): in functionpthread_rwlock_init': /home/MyData/esp/esp-idf-5.1/components/pthread/pthread_rwlock.c:75: warning: pthread_mutex_destroy is not implemented and will always fail /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: esp-idf/pthread/libpthread.a(pthread.c.obj): in function pthread_mutex_init_if_static': /home/MyData/esp/esp-idf-5.1/components/pthread/pthread.c:628: warning: pthread_mutex_init is not implemented and will always fail /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: esp-idf/pthread/libpthread.a(pthread_rwlock.c.obj): in functionpthread_rwlock_destroy': /home/MyData/esp/esp-idf-5.1/components/pthread/pthread_rwlock.c:122: warning: pthread_mutex_lock is not implemented and will always fail /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/MyData/esp/esp-idf-5.1/components/pthread/pthread_rwlock.c:131: warning: pthread_mutex_unlock is not implemented and will always fail /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libstdc++.a(locale.o): in function .L0 ': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/build/build-cc-gcc-final/riscv32-esp-elf/rv32imac_zicsr_zifencei/ilp32/no-rtti/libstdc++-v3/include/riscv32-esp-elf/bits/gthr-default.h:700: warning: pthread_once is not implemented and will always fail /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libc.a(lib_a-fclose.o): in function_fclose_r': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/newlib/libc/stdio/fclose.c:73: warning: pthread_setcancelstate is not implemented and will always fail /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: esp-idf/pthread/libpthread.a(pthread.c.obj): in function esp_pthread_set_cfg': /home/MyData/esp/esp-idf-5.1/components/pthread/pthread.c:143: warning: pthread_setspecific is not implemented and will always fail /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_attr_destroy': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:33: multiple definition of pthread_attr_destroy'; esp-idf/pthread/libpthread.a(pthread.c.obj):/home/MyData/esp/esp-idf-5.1/components/pthread/pthread.c:767: first defined here /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_attr_getdetachstate': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:41: multiple definition of pthread_attr_getdetachstate'; esp-idf/pthread/libpthread.a(pthread.c.obj):/home/MyData/esp/esp-idf-5.1/components/pthread/pthread.c:792: first defined here /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_attr_getstacksize': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:94: multiple definition of pthread_attr_getstacksize'; esp-idf/pthread/libpthread.a(pthread.c.obj):/home/MyData/esp/esp-idf-5.1/components/pthread/pthread.c:774: first defined here /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_attr_init': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:102: multiple definition of pthread_attr_init'; esp-idf/pthread/libpthread.a(pthread.c.obj):/home/MyData/esp/esp-idf-5.1/components/pthread/pthread.c:756: first defined here /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_attr_setdetachstate': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:113: multiple definition of pthread_attr_setdetachstate'; esp-idf/pthread/libpthread.a(pthread.c.obj):/home/MyData/esp/esp-idf-5.1/components/pthread/pthread.c:801: first defined here /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_attr_setstacksize': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:166: multiple definition of pthread_attr_setstacksize'; esp-idf/pthread/libpthread.a(pthread.c.obj):/home/MyData/esp/esp-idf-5.1/components/pthread/pthread.c:783: first defined here /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_cancel': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:177: multiple definition of pthread_cancel'; esp-idf/pthread/libpthread.a(pthread.c.obj):/home/MyData/esp/esp-idf-5.1/components/pthread/pthread.c:463: first defined here /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_cond_broadcast': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:198: multiple definition of pthread_cond_broadcast'; esp-idf/pthread/libpthread.a(pthread_cond_var.c.obj):/home/MyData/esp/esp-idf-5.1/components/pthread/pthread_cond_var.c:74: first defined here /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_cond_destroy': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:206: multiple definition of pthread_cond_destroy'; esp-idf/pthread/libpthread.a(pthread_cond_var.c.obj):/home/MyData/esp/esp-idf-5.1/components/pthread/pthread_cond_var.c:205: first defined here /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_cond_init': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:214: multiple definition of pthread_cond_init'; esp-idf/pthread/libpthread.a(pthread_cond_var.c.obj):/home/MyData/esp/esp-idf-5.1/components/pthread/pthread_cond_var.c:188: first defined here /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_cond_signal': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:222: multiple definition of pthread_cond_signal'; esp-idf/pthread/libpthread.a(pthread_cond_var.c.obj):/home/MyData/esp/esp-idf-5.1/components/pthread/pthread_cond_var.c:54: first defined here /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_cond_timedwait': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:233: multiple definition of pthread_cond_timedwait'; esp-idf/pthread/libpthread.a(pthread_cond_var.c.obj):/home/MyData/esp/esp-idf-5.1/components/pthread/pthread_cond_var.c:98: first defined here /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_cond_wait': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:238: multiple definition of pthread_cond_wait'; esp-idf/pthread/libpthread.a(pthread_cond_var.c.obj):/home/MyData/esp/esp-idf-5.1/components/pthread/pthread_cond_var.c:93: first defined here /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_condattr_init': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:262: multiple definition of pthread_condattr_init'; esp-idf/pthread/libpthread.a(pthread_cond_var.c.obj):/home/MyData/esp/esp-idf-5.1/components/pthread/pthread_cond_var.c:182: first defined here /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_create': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:281: multiple definition of pthread_create'; esp-idf/pthread/libpthread.a(pthread.c.obj):/home/MyData/esp/esp-idf-5.1/components/pthread/pthread.c:206: first defined here /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_detach': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:286: multiple definition of pthread_detach'; esp-idf/pthread/libpthread.a(pthread.c.obj):/home/MyData/esp/esp-idf-5.1/components/pthread/pthread.c:382: first defined here /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_equal': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:297: multiple definition of pthread_equal'; esp-idf/pthread/libpthread.a(pthread.c.obj):/home/MyData/esp/esp-idf-5.1/components/pthread/pthread.c:489: first defined here /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_exit': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:305: multiple definition of pthread_exit'; esp-idf/pthread/libpthread.a(pthread.c.obj):/home/MyData/esp/esp-idf-5.1/components/pthread/pthread.c:414: first defined here /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_getspecific': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:329: multiple definition of pthread_getspecific'; esp-idf/pthread/libpthread.a(pthread_local_storage.c.obj):/home/MyData/esp/esp-idf-5.1/components/pthread/pthread_local_storage.c:182: first defined here /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_join': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:337: multiple definition of pthread_join'; esp-idf/pthread/libpthread.a(pthread.c.obj):/home/MyData/esp/esp-idf-5.1/components/pthread/pthread.c:316: first defined here /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_key_create': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:345: multiple definition of pthread_key_create'; esp-idf/pthread/libpthread.a(pthread_local_storage.c.obj):/home/MyData/esp/esp-idf-5.1/components/pthread/pthread_local_storage.c:56: first defined here /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_key_delete': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:350: multiple definition of pthread_key_delete'; esp-idf/pthread/libpthread.a(pthread_local_storage.c.obj):/home/MyData/esp/esp-idf-5.1/components/pthread/pthread_local_storage.c:89: first defined here /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_mutex_destroy': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:358: multiple definition of pthread_mutex_destroy'; esp-idf/pthread/libpthread.a(pthread.c.obj):/home/MyData/esp/esp-idf-5.1/components/pthread/pthread.c:566: first defined here /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_mutex_init': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:374: multiple definition of pthread_mutex_init'; esp-idf/pthread/libpthread.a(pthread.c.obj):/home/MyData/esp/esp-idf-5.1/components/pthread/pthread.c:524: first defined here /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_mutex_lock': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:382: multiple definition of pthread_mutex_lock'; esp-idf/pthread/libpthread.a(pthread.c.obj):/home/MyData/esp/esp-idf-5.1/components/pthread/pthread.c:637: first defined here /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_mutex_trylock': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:398: multiple definition of pthread_mutex_trylock'; esp-idf/pthread/libpthread.a(pthread.c.obj):/home/MyData/esp/esp-idf-5.1/components/pthread/pthread.c:671: first defined here /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_mutex_unlock': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:406: multiple definition of pthread_mutex_unlock'; esp-idf/pthread/libpthread.a(pthread.c.obj):/home/MyData/esp/esp-idf-5.1/components/pthread/pthread.c:685: first defined here /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_mutexattr_destroy': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:414: multiple definition of pthread_mutexattr_destroy'; esp-idf/pthread/libpthread.a(pthread.c.obj):/home/MyData/esp/esp-idf-5.1/components/pthread/pthread.c:724: first defined here /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_mutexattr_gettype': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:446: multiple definition of pthread_mutexattr_gettype'; esp-idf/pthread/libpthread.a(pthread.c.obj):/home/MyData/esp/esp-idf-5.1/components/pthread/pthread.c:733: first defined here /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_mutexattr_init': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:454: multiple definition of pthread_mutexattr_init'; esp-idf/pthread/libpthread.a(pthread.c.obj):/home/MyData/esp/esp-idf-5.1/components/pthread/pthread.c:713: first defined here /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_mutexattr_settype': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:486: multiple definition of pthread_mutexattr_settype'; esp-idf/pthread/libpthread.a(pthread.c.obj):/home/MyData/esp/esp-idf-5.1/components/pthread/pthread.c:742: first defined here /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_once': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:494: multiple definition of pthread_once'; esp-idf/pthread/libpthread.a(pthread.c.obj):/home/MyData/esp/esp-idf-5.1/components/pthread/pthread.c:494: first defined here /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_rwlock_destroy': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:502: multiple definition of pthread_rwlock_destroy'; esp-idf/pthread/libpthread.a(pthread_rwlock.c.obj):/home/MyData/esp/esp-idf-5.1/components/pthread/pthread_rwlock.c:108: first defined here /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_rwlock_init': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:510: multiple definition of pthread_rwlock_init'; esp-idf/pthread/libpthread.a(pthread_rwlock.c.obj):/home/MyData/esp/esp-idf-5.1/components/pthread/pthread_rwlock.c:53: first defined here /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_rwlock_rdlock': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:518: multiple definition of pthread_rwlock_rdlock'; esp-idf/pthread/libpthread.a(pthread_rwlock.c.obj):/home/MyData/esp/esp-idf-5.1/components/pthread/pthread_rwlock.c:162: first defined here /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_rwlock_unlock': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:542: multiple definition of pthread_rwlock_unlock'; esp-idf/pthread/libpthread.a(pthread_rwlock.c.obj):/home/MyData/esp/esp-idf-5.1/components/pthread/pthread_rwlock.c:223: first defined here /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_rwlock_wrlock': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:550: multiple definition of pthread_rwlock_wrlock'; esp-idf/pthread/libpthread.a(pthread_rwlock.c.obj):/home/MyData/esp/esp-idf-5.1/components/pthread/pthread_rwlock.c:195: first defined here /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_self': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:593: multiple definition of pthread_self'; esp-idf/pthread/libpthread.a(pthread.c.obj):/home/MyData/esp/esp-idf-5.1/components/pthread/pthread.c:475: first defined here /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_setcancelstate': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:601: multiple definition of pthread_setcancelstate'; esp-idf/newlib/libnewlib.a(pthread.c.obj):/home/MyData/esp/esp-idf-5.1/components/newlib/pthread.c:20: first defined here /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /home/shaco/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/lib/rv32imac_zicsr_zifencei/ilp32/no-rtti/libnosys.a(pthread.o): in functionpthread_setspecific': /builds/idf/crosstool-NG/.build/riscv32-esp-elf/src/newlib/libgloss/libnosys/pthread.c:630: multiple definition of `pthread_setspecific'; esp-idf/pthread/libpthread.a(pthread_local_storage.c.obj):/home/MyData/esp/esp-idf-5.1/components/pthread/pthread_local_storage.c:196: first defined here How To fix This? who can help me?

ESP-Marius commented 11 months ago

https://github.com/espressif/esp-idf/tree/master/examples/system/pthread seems to compile fine for me on C5 on v5.1, so I'm unable to reproduce your issue.

I suggest you try with that example first and see if that works. You can also try to clean your build, idf.py fullclean. Maybe you switched between 4.4 and 5.1 without properly setting everything up again and something got stuck?

Shaco-Ma commented 11 months ago

https://github.com/espressif/esp-idf/tree/master/examples/system/pthread seems to compile fine for me on C5 on v5.1, so I'm unable to reproduce your issue.

I suggest you try with that example first and see if that works. You can also try to clean your build, idf.py fullclean. Maybe you switched between 4.4 and 5.1 without properly setting everything up again and something got stuck?

I had idf.py fullclean and rm build dir, just build is same wrong, it's had some in .git or sdkconfig?

ESP-Marius commented 11 months ago

Do you have the same issue if you build the example I linked to?

Shaco-Ma commented 11 months ago

@ESP-Marius No,I use the example and example/system/pthread is also ok,just my project had this issue only the code,I had add components with websocket in esp-protocols And I had rm sdkconfig, sdkconfig.old and build,but do idf.py menuconfig,but it had the same issue...

ESP-Marius commented 11 months ago

if you give me a minimal example that reproduces it then I can take a look.

You can also try to add REQUIRES pthread to your cmakelist requires and see if that helps.

Shaco-Ma commented 11 months ago

if you give me a minimal example that reproduces it then I can take a look.

You can also try to add REQUIRES pthread to your cmakelist requires and see if that helps.

@ESP-Marius Sorry,I get the question why,because I use the function : pthread_condattr_init(&attr); pthread_condattr_setclock(&attr, CLOCK_MONOTONIC); pthread_cond_init(&cond, &attr); when I remove the cond attribute set function,It's OK alos when pthread_condattr_init and pthread_condattr_setclock will be support?

ESP-Marius commented 11 months ago

Supporting more posix functions are on our roadmap, but I cannot give you a timeline at the moment unfortunately.