目前共有1篇帖子。 字體大小:較小 - 100% (默認)▼  內容轉換:不轉換▼
 
點擊 回復
31 0
fedora42用gcc15编译host-gettext-gnu-0.20.1出错,提示conflicting types for 'getcwd'
一派掌門 二十級
1樓 發表于:2025-4-27 15:48

fedora42用gcc15编译host-gettext-gnu-0.20.1出错,提示../../gettext-runtime/intl/dcigettext.c:147:7: error: conflicting types for 'getcwd'; have 'char *(void)'。
In file included from ../../gettext-runtime/intl/dcigettext.c:92:
../../gettext-runtime/intl/gettextP.h: In function 'SWAP':
../../gettext-runtime/intl/gettextP.h:119:1: warning: old-style function definition [-Wold-style-definition]
  119 | SWAP (i)
      | ^~~~
../../gettext-runtime/intl/dcigettext.c: At top level:
../../gettext-runtime/intl/dcigettext.c:147:7: error: conflicting types for 'getcwd'; have 'char *(void)'
  147 | char *getcwd ();
      |       ^~~~~~
In file included from ../../gettext-runtime/intl/dcigettext.c:65:
/usr/include/unistd.h:531:14: note: previous declaration of 'getcwd' with type 'char *(char *, size_t)' {aka 'char *(char *, long unsigned int)'}
  531 | extern char *getcwd (char *__buf, size_t __size) __THROW __wur;
      |              ^~~~~~
../../gettext-runtime/intl/dcigettext.c: In function 'libintl_dcigettext':
../../gettext-runtime/intl/dcigettext.c:640:21: error: too many arguments to function 'getcwd'; expected 0, have 2
  640 |               ret = getcwd (resolved_dirname, path_max);
      |                     ^~~~~~  ~~~~~~~~~~~~~~~~
../../gettext-runtime/intl/dcigettext.c:147:7: note: declared here
  147 | char *getcwd ();
      |       ^~~~~~
make[5]: *** [Makefile:2554: dcigettext.lo] Error 1
make[5]: Leaving directory '/home/oct1158/Documents/Code/C/luckfox-pico/sysdrv/source/buildroot/buildroot-2023.02.6/output/build/host-gettext-gnu-0.20.1/gettext-tools/intl'
make[4]: *** [Makefile:2142: all] Error 2
make[4]: Leaving directory '/home/oct1158/Documents/Code/C/luckfox-pico/sysdrv/source/buildroot/buildroot-2023.02.6/output/build/host-gettext-gnu-0.20.1/gettext-tools/intl'
make[3]: *** [Makefile:2177: 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-gettext-gnu-0.20.1/gettext-tools'
make[2]: *** [Makefile:2045: all] Error 2
make[2]: Leaving directory '/home/oct1158/Documents/Code/C/luckfox-pico/sysdrv/source/buildroot/buildroot-2023.02.6/output/build/host-gettext-gnu-0.20.1/gettext-tools'
make[1]: *** [package/pkg-generic.mk:293: /home/oct1158/Documents/Code/C/luckfox-pico/sysdrv/source/buildroot/buildroot-2023.02.6/output/build/host-gettext-gnu-0.20.1/.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-gettext-gnu-0.20.1/gettext-runtime/intl/dcigettext.c文件,注释掉第147行的char *getcwd ();。(看清楚是6个字符的getcwd,不是上面5个字符的getwd)
(项目中一共有三个dcigettext.c文件,只需要改一个文件,就是host-gettext-gnu-0.20.1里面那个文件,其他两个文件没用到,不用改)

回復帖子

內容:
用戶名: 您目前是匿名發表
驗證碼:
(快捷鍵:Ctrl+Enter)
 

本帖信息

點擊數:31 回複數:0
評論數: ?
作者:巨大八爪鱼
最後回復:巨大八爪鱼
最後回復時間:2025-4-27 15:48
 
©2010-2025 Purasbar Ver2.0
除非另有聲明,本站採用創用CC姓名標示-相同方式分享 3.0 Unported許可協議進行許可。