fix: fix build errors with newer GCC and resolve const qualifier mism… - #13
Open
Dirinkbottle wants to merge 2 commits into
Open
fix: fix build errors with newer GCC and resolve const qualifier mism…#13Dirinkbottle wants to merge 2 commits into
Dirinkbottle wants to merge 2 commits into
Conversation
…atch with newer GCC
|
我遇到了同样的问题,拉取这个 PR 后 我的交叉编译依赖 newlib。newlib 的 部分报错: 把对 #ifdef __ISA_NATIVE__
#include <sys/types.h>
/* posix remaps ... */
#else
typedef long suseconds_t;
typedef unsigned long useconds_t;
#endif |
…atch with newer GCC
Author
ISA: riscv32 PLATFORM: nemu
- CC /home/inkbottle/othersrc/ysyx/ysyx-workbench/ics-pa/rt-thread-am/components/dfs/dfs_v1/filesystems/devfs/devfs.c
- CC /home/inkbottle/othersrc/ysyx/ysyx-workbench/ics-pa/rt-thread-am/components/dfs/dfs_v1/filesystems/elmfat/dfs_elm.c
- CC /home/inkbottle/othersrc/ysyx/ysyx-workbench/ics-pa/rt-thread-am/components/dfs/dfs_v1/filesystems/elmfat/ff.c
- CC /home/inkbottle/othersrc/ysyx/ysyx-workbench/ics-pa/rt-thread-am/components/dfs/dfs_v1/filesystems/elmfat/ffunicode.c
- CC /home/inkbottle/othersrc/ysyx/ysyx-workbench/ics-pa/rt-thread-am/components/dfs/dfs_v1/filesystems/romfs/dfs_romfs.c
In file included from /home/inkbottle/othersrc/ysyx/ysyx-workbench/ics-pa/rt-thread-am/components/libc/compilers/common/include/sys/time.h:18,
from /home/inkbottle/othersrc/ysyx/ysyx-workbench/ics-pa/rt-thread-am/components/libc/compilers/common/include/sys/select.h:17,
from /opt/riscv-multilib-all/riscv64-unknown-elf/include/sys/types.h:50,
from /opt/riscv-multilib-all/riscv64-unknown-elf/include/sys/_default_fcntl.h:217,
from /opt/riscv-multilib-all/riscv64-unknown-elf/include/sys/fcntl.h:3,
from /opt/riscv-multilib-all/riscv64-unknown-elf/include/fcntl.h:1,
from /home/inkbottle/othersrc/ysyx/ysyx-workbench/ics-pa/rt-thread-am/components/dfs/dfs_v1/include/dfs.h:18,
from /home/inkbottle/othersrc/ysyx/ysyx-workbench/ics-pa/rt-thread-am/components/dfs/dfs_v1/filesystems/romfs/dfs_romfs.c:11:
/opt/riscv-multilib-all/riscv64-unknown-elf/include/time.h:56:1: error: unknown type name 'clock_t'
56 | clock_t clock (void);
| ^~~~~~~
/opt/riscv-multilib-all/riscv64-unknown-elf/include/time.h:30:1: note: 'clock_t' is defined in header '<time.h>'; this is probably fixable by adding '#include <time.h>'
29 | #include <sys/timespec.h>
+++ |+#include <time.h>
30 | 尝试了一下,我这里最后又会回到sys/time.h去找struct timeval. 所以这次我手动补了struct timeval; 不包括完整定义. 并且修改了cstdlib在前面包含完整的stddef.h即可.后面需要完整的timeval再包含sys/time.h 此时time.h需要的类型已经被stddef.h补齐 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…atch with newer GCC #12
修复在 x86_64 GCC 16.2.1 20260810 下编译
ARCH=native时出现的兼容性问题。修复
cstring.c中字符串函数返回值的 const qualifier mismatch,避免新版 GCC 在严格类型检查下触发-Werror=discarded-qualifiers。修复项目兼容层与宿主 libc 头文件之间的类型/声明不一致,以及新版 GCC 更严格检查所暴露出的相关编译错误,使
bsp/abstract-machine下的make ARCH=native能正常通过编译。