設置 | 登錄 | 註冊

目前共有1篇帖子。

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裏面那個文件,其他兩個文件沒用到,不用改)

內容轉換:

回覆帖子
內容:
用戶名: 您目前是匿名發表。
驗證碼:
看不清?換一張
©2010-2025 Purasbar Ver3.0 [手機版] [桌面版]
除非另有聲明,本站採用知識共享署名-相同方式共享 3.0 Unported許可協議進行許可。