Skip to content
This repository has been archived by the owner on Oct 27, 2022. It is now read-only.

Ubuntu 20: undefined reference to `pthread_create' #209

Open
losingrose opened this issue Jun 9, 2021 · 2 comments
Open

Ubuntu 20: undefined reference to `pthread_create' #209

losingrose opened this issue Jun 9, 2021 · 2 comments

Comments

@losingrose
Copy link

1. 开发环境

Ubuntu 20

  • 模组或开发板:ESP8266
  • esp-aliyun 版本(git rev-parse --short HEAD 来获取 commit id):1259029
  • ESP8266_RTOS_SDK 版本(git rev-parse --short HEAD 来获取 commit id):6c438bce
  • ESP-IDF 版本(git rev-parse --short HEAD 来获取 commit id):
    Toolchain version: crosstool-ng-1.22.0-100-ge567ec7

2. 问题描述

make编译失败。最后报错找不到pthread_create

Generating esp8266.project.ld
LD build/smart_light.elf
/home/losingrose/esp/esp-aliyun/examples/solutions/smart_light/build/esp-aliyun/libesp-aliyun.a(wrapper_os.o):(.literal.HAL_ThreadCreate+0x4): undefined reference to pthread_create' /home/losingrose/esp/esp-aliyun/examples/solutions/smart_light/build/esp-aliyun/libesp-aliyun.a(wrapper_os.o):(.literal.HAL_ThreadDelete+0x0): undefined reference to pthread_exit'
/home/losingrose/esp/esp-aliyun/examples/solutions/smart_light/build/esp-aliyun/libesp-aliyun.a(wrapper_os.o):(.literal.HAL_ThreadDelete+0x4): undefined reference to pthread_cancel' /home/losingrose/esp/esp-aliyun/examples/solutions/smart_light/build/esp-aliyun/libesp-aliyun.a(wrapper_os.o):(.literal.HAL_ThreadDelete+0x8): undefined reference to pthread_join'
/home/losingrose/esp/esp-aliyun/examples/solutions/smart_light/build/esp-aliyun/libesp-aliyun.a(wrapper_os.o): In function HAL_ThreadCreate': /home/losingrose/esp/esp-aliyun/wrappers/wrapper_os.c:267: undefined reference to pthread_create'
/home/losingrose/esp/esp-aliyun/wrappers/wrapper_os.c:267: undefined reference to pthread_create' /home/losingrose/esp/esp-aliyun/examples/solutions/smart_light/build/esp-aliyun/libesp-aliyun.a(wrapper_os.o): In function HAL_ThreadDelete':
/home/losingrose/esp/esp-aliyun/wrappers/wrapper_os.c:267: undefined reference to pthread_exit' /home/losingrose/esp/esp-aliyun/wrappers/wrapper_os.c:267: undefined reference to pthread_cancel'
/home/losingrose/esp/esp-aliyun/wrappers/wrapper_os.c:267: undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status
make: *** [/home/losingrose/esp/ESP8266_RTOS_SDK/make/project.mk:510:/home/losingrose/esp/esp-aliyun/examples/solutions/smart_light/build/smart_light.elf] 错误 1

@ESP-YJM
Copy link
Contributor

ESP-YJM commented Jun 10, 2021

有没有先执行make chip=esp8266 defconfig, 执行这个会打开 CONFIG_ENABLE_PTHREAD。https://github.com/espressif/esp-aliyun/blob/master/examples/solutions/smart_light/sdkconfig_esp8266.defaults#L2

@losingrose
Copy link
Author

losingrose commented Jun 10, 2021

执行后OK了,感谢你的回复。
开始被SDK和工具链的版本对应折腾了好几天,都快放弃了,使用make aliyun搞懂版本对应以后,感觉就快成功了,心急了。
希望能在文档中加一个 代码版本-SDK版本-工具链版本 的对应说明,对于新手来说很难能找到对应关系。

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants