[Bug] smart版本启用RT_USING_PTHREADS配置后,无法通过编译,类型冲突
維護者通常 2 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 45/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 冷清
- 技術堆疊
- c
研究方向
從 components/libc/posix/pthreads/pthread.h 和 pthread.c 開始,接著檢查經過 rttypes.h 以及 bits/alltypes.h 中 musl 標頭檔的 include 鏈。使用 arm-linux-musleabi-gcc 7.3.0 重現 RT_USING_PTHREADS 建置,並比較互相衝突的型別宣告。當 smart 設定能在沒有 pthread 型別衝突的情況下完成建置時,即表示完成。
由索引模型根據 Issue 內容生成。
描述
RT-Thread Version
v5.2.2 Release
Hardware Type/Architectures
arm
Develop Toolchain
GCC
Describe the bug
编译器类型是arm-linux-musleabi-gcc,版本信息如下:
arm-linux-musleabi-gcc (GCC) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
build date: Jan 6 2023 18:24:13
musl sha: 3536b4bc84df4672ac3b3747e36e3fa1332efc9b
build sha: 3536b4bc84df4672ac3b3747e36e3fa1332efc9b
build job: 434371
启用RT_USING_PTHREADS配置后,components/libc/posix/pthreads组件就无法通过编译:
/home/Tiimmi/codes/rtthread/rtthread/components/libc/posix/pthreads/pthread.h:37:14: error: conflicting types for 'pthread_t'
typedef long pthread_t;
^~~~~~~~~
In file included from /home/Tiimmi/codes/rtthread/env/arm-linux-musleabi-linux-gnu/arm-linux-musleabi/include/sys/types.h:57:0,
from /home/Tiimmi/codes/rtthread/rtthread/include/rttypes.h:20,
from /home/Tiimmi/codes/rtthread/rtthread/include/rtsched.h:14,
from /home/Tiimmi/codes/rtthread/rtthread/include/rtdef.h:68,
from /home/Tiimmi/codes/rtthread/rtthread/include/rthw.h:23,
from /home/Tiimmi/codes/rtthread/rtthread/components/libc/posix/pthreads/pthread.c:16:
/home/Tiimmi/codes/rtthread/env/arm-linux-musleabi-linux-gnu/arm-linux-musleabi/include/bits/alltypes.h:301:28: note: previous declaration of 'pthread_t' was here
typedef struct __pthread * pthread_t;
^~~~~~~~~
In file included from /home/Tiimmi/codes/rtthread/rtthread/components/libc/posix/pthreads/pthread.c:17:0:
/home/Tiimmi/codes/rtthread/rtthread/components/libc/posix/pthreads/pthread.h:38:14: error: conflicting types for 'pthread_condattr_t'
typedef long pthread_condattr_t;
^~~~~~~~~~~~~~~~~~
In file included from /home/Tiimmi/codes/rtthread/env/arm-linux-musleabi-linux-gnu/arm-linux-musleabi/include/sys/types.h:57:0,
from /home/Tiimmi/codes/rtthread/rtthread/include/rttypes.h:20,
from /home/Tiimmi/codes/rtthread/rtthread/include/rtsched.h:14,
from /home/Tiimmi/codes/rtthread/rtthread/include/rtdef.h:68,
from /home/Tiimmi/codes/rtthread/rtthread/include/rthw.h:23,
from /home/Tiimmi/codes/rtthread/rtthread/components/libc/posix/pthreads/pthread.c:16:
/home/Tiimmi/codes/rtthread/env/arm-linux-musleabi-linux-gnu/arm-linux-musleabi/include/bits/alltypes.h:327:37: note: previous declaration of 'pthread_condattr_t' was here
typedef struct { unsigned __attr; } pthread_condattr_t;
^~~~~~~~~~~~~~~~~~
In file included from /home/Tiimmi/codes/rtthread/rtthread/components/libc/posix/pthreads/pthread.c:17:0:
/home/Tiimmi/codes/rtthread/rtthread/components/libc/posix/pthreads/pthread.h:39:14: error: conflicting types for 'pthread_rwlockattr_t'
typedef long pthread_rwlockattr_t;
^~~~~~~~~~~~~~~~~~~~
In file included from /home/Tiimmi/codes/rtthread/env/arm-linux-musleabi-linux-gnu/arm-linux-musleabi/include/sys/types.h:57:0,
from /home/Tiimmi/codes/rtthread/rtthread/include/rttypes.h:20,
from /home/Tiimmi/codes/rtthread/rtthread/include/rtsched.h:14,
from /home/Tiimmi/codes/rtthread/rtthread/include/rtdef.h:68,
from /home/Tiimmi/codes/rtthread/rtthread/include/rthw.h:23,
from /home/Tiimmi/codes/rtthread/rtthread/components/libc/posix/pthreads/pthread.c:16:
/home/Tiimmi/codes/rtthread/env/arm-linux-musleabi-linux-gnu/arm-linux-musleabi/include/bits/alltypes.h:337:40: note: previous declaration of 'pthread_rwlockattr_t' was here
typedef struct { unsigned __attr[2]; } pthread_rwlockattr_t;
节选了部分报错信息,剩余的报错基本都是rtthread中定义的类型与编译器头文件中定义的类型冲突了。
在网上搜索好像都没看到有人说过这个问题,只有一个2019年的issue:#3070
但是也没说解决方法。
smart版本的lwp组件强制要求musllibc,更换其他类型编译器会报:“No compatible lwp set status provided for this libc”
但是musl编译器的头文件定义的pthread类型和rtthread里的pthread.h头文件里定义的类型冲突。如何能够仍smart版本也能启用RT_USING_PTHREADS配置?
还是smart版本上使用pthread不需要启用这个配置?或者smart版本的pthread就是有问题的?
Other additional context
No response
- 主要語言
- C
- 星號
- 12.4k
- 分支
- 5.5k
- 平均合併
- 3 天 7 小時
- 30 天內合併 PR
- 79
環境準備
在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
RT-Thread/rt-thread 的其他 Issue
-
Arch: ARM/AArch64 Doc
難度 1/5 1 小時以內 新手友好度 90/100
RT-Thread/rt-thread#12082 · 1 則留言 ·
維護者通常 2 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 67/100
RT-Thread/rt-thread#11951 · 2 則留言 ·
維護者通常 2 天內回覆
-
[Bug] [libc] timer_gettime 拆秒前将总纳秒截断为 uint32_t,剩余时间查询错误可能重新可做 @Yunlk 於 28 天前認領,目前沒有進行中的 PR。 未關閉in progress
難度 2/5 1-3 小時 新手友好度 68/100
RT-Thread/rt-thread#11924 · 7 則留言 · 已指派 1 人 ·
維護者通常 2 天內回覆
-
[Bug] dfs_v2 tmpfs: ftruncate(fd, 0) frees the file buffer but reports success — use-after-free read/write and double free from a legal POSIX call可能已有人在做 @remukisama 於 33 天前認領。 未關閉in progress
難度 2/5 1-3 小時 新手友好度 78/100
RT-Thread/rt-thread#11902 · 4 則留言 · 已指派 1 人 ·
維護者通常 2 天內回覆
-
[bsp][stm32][bluepill] README「快速上手」缺少重新生成 MDK 工程这一步,按文档操作无法编译通过可能重新可做 @moment-NEW 於 50 天前認領,目前沒有進行中的 PR。 未關閉in progress
難度 2/5 1-3 小時 新手友好度 75/100
RT-Thread/rt-thread#11818 · 4 則留言 · 已指派 1 人 ·
維護者通常 2 天內回覆
查看 RT-Thread/rt-thread 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 80/100
ESPresense/ESPresense#2680 · 2 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 74/100
ImageMagick/ImageMagick#9134 ·
維護者通常 1 天內回覆
-
Builder: a structure opened without calculation data shows the Diffraction (fibre) view by default未關閉bug
難度 2/5 1-3 小時 新手友好度 65/100
FriendsofECCE/ECCE#1245 · 1 則留言 ·
-
難度 2/5 1-3 小時 新手友好度 72/100
apache/nuttx-apps#4108 · 4 則留言 ·
維護者通常 1 天內回覆
-
bug
難度 1/5 1 小時以內 新手友好度 84/100
VirtualBox/virtualbox#996 ·
維護者通常 6 天內回覆