设置 | 登录 | 注册

作者共发了1篇帖子。

fedora42用gcc15编译host-m4-1.4.19出错,提示expected identifier or '(' before 'int'

1楼 巨大八爪鱼 2025-4-27 15:27

fedora42用gcc15编译host-m4-1.4.19出错,提示gl_oset.h:275:40: error: expected identifier or '(' before 'int'。
In file included from gl_avltree_oset.h:21,
                 from gl_avltree_oset.c:21:
gl_oset.h:275:1: warning: 'nodiscard' attribute ignored [-Wattributes]
  275 | GL_OSET_INLINE _GL_ATTRIBUTE_NODISCARD int
      | ^~~~~~~~~~~~~~
gl_oset.h:275:40: error: expected identifier or '(' before 'int'
  275 | GL_OSET_INLINE _GL_ATTRIBUTE_NODISCARD int
      |                                        ^~~
make[5]: *** [Makefile:2871: gl_avltree_oset.o] Error 1
make[5]: Leaving directory '/home/oct1158/Documents/Code/C/luckfox-pico/sysdrv/source/buildroot/buildroot-2023.02.6/output/build/host-m4-1.4.19/lib'
make[4]: *** [Makefile:2481: all] Error 2
make[4]: Leaving directory '/home/oct1158/Documents/Code/C/luckfox-pico/sysdrv/source/buildroot/buildroot-2023.02.6/output/build/host-m4-1.4.19/lib'
make[3]: *** [Makefile:2018: all-recursive] Error 1
make[3]: Leaving directory '/home/oct1158/Documents/Code/C/luckfox-pico/sysdrv/source/buildroot/buildroot-2023.02.6/output/build/host-m4-1.4.19'
make[2]: *** [Makefile:1974: all] Error 2
make[2]: Leaving directory '/home/oct1158/Documents/Code/C/luckfox-pico/sysdrv/source/buildroot/buildroot-2023.02.6/output/build/host-m4-1.4.19'
make[1]: *** [package/pkg-generic.mk:293: /home/oct1158/Documents/Code/C/luckfox-pico/sysdrv/source/buildroot/buildroot-2023.02.6/output/build/host-m4-1.4.19/.stamp_built] Error 2
make[1]: Leaving directory '/home/oct1158/Documents/Code/C/luckfox-pico/sysdrv/source/buildroot/buildroot-2023.02.6'
make: *** [Makefile:618: buildroot] Error 2
make: Leaving directory '/home/oct1158/Documents/Code/C/luckfox-pico/sysdrv'
[build.sh:error] Running build_rootfs failed!
[build.sh:error] exit code 2 from line 858:
[build.sh:info]     make rootfs -C ${SDK_SYSDRV_DIR}
[oct1158@fed41-bh8f7e0 luckfox-pico]$

 

解决方案:
修改sysdrv/source/buildroot/buildroot-2023.02.6/output/build/host-m4-1.4.19/lib/config.h文件,找到第2589-2595行。
注释掉前5行和最后一行,只留下倒数第二行。
//#if 201710L < __STDC_VERSION__
//# define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]]
//#elif _GL_HAS_ATTRIBUTE (warn_unused_result)
//# define _GL_ATTRIBUTE_NODISCARD __attribute__ ((__warn_unused_result__))
//#else
# define _GL_ATTRIBUTE_NODISCARD
//#endif

内容转换:

回复帖子
内容:
用户名: 您目前是匿名发表。
验证码:
看不清?换一张
©2010-2025 Purasbar Ver3.0 [手机版] [桌面版]
除非另有声明,本站采用知识共享署名-相同方式共享 3.0 Unported许可协议进行许可。