autoconf failes to find libsodium even when present due to implicit function declaration

未关闭 适合新手
#22,102 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 13 天内回复

@coderjoe 已经在做这个了。

开始于 2026年12月1日。

  • #22103 来自 @coderjoe —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
68/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
c
领域
build-system

调研方向

报告指出了 Vim 的 configure 对 libsodium 的检查,该检查会编译一个包含 sodium.h 并调用 sodium_init() 的探测程序。先在 configure 源码中找到该探测程序,并检查它如何包含标准头文件。修复该探测程序,使报告中的 printf 隐式声明不再导致检查失败,然后确认使用 --enable-libsodium 配置时能够检测到已安装的库。

由索引模型根据 Issue 内容生成。

描述

bug
Steps to reproduce
  1. Build with --enable-libsodium in an environment where implicit function declarations are considered errors.
  2. Note that the libsodium check fails due to a compliation error from the implicit use of printf
  3. Check the resulting vim build and note that it has -sodium
Expected behaviour

vim should build with +sodium

Version of Vim

9.2.1252

Environment

Operating system: NixOS 26.05
Terminal: Konsole
Value of $TERM: xterm-256color
Shell: zsh

Logs and stack traces
Relevant Log from config.log:


configure:15105: checking for libsodium
configure:15127: gcc -o conftest -g -O2   -I/nix/store/jkl1i8x08ldv5cpll3z6qqzh88fdzxik-libsodium-1.0.22-unstable-2026-11-07-dev/include  conftest.c -ltinfo   -L/nix/store/yzidbd0cj3lkfjy7v5ivipmsq7fya4c3-libsodium-1.0.22-unstable-2026-11-07/lib -lsodium >&5
conftest.c: In function 'main':
conftest.c:156:6: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
  156 |      printf("%d", sodium_init());
      |      ^~~~~~
conftest.c:151:1: note: include '<stdio.h>' or provide a declaration of 'printf'
  150 |   # include <sodium.h>
  151 | 
conftest.c:156:6: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
  156 |      printf("%d", sodium_init());
      |      ^~~~~~
conftest.c:156:6: note: include '<stdio.h>' or provide a declaration of 'printf'
configure:15127: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define UNIX 1
| #define HAVE_SYS_WAIT_H 1
| #define BUILD_DATE "Jan 01 1980 00:00:00"
| #define HAVE_STDIO_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_SYS_TIME_H 1
| #define HAVE_SYS_SELECT_H 1
| #define HAVE_SYS_SOCKET_H 1
| #define STDC_HEADERS 1
| #define HAVE_XATTR 1
| #define FEAT_HUGE 1
| #define FEAT_DIFF 1
| #define FEAT_LUA 1
| #define FEAT_PYTHON3 1
| #define FEAT_RUBY 1
| #define ENABLE_CSCOPE 1
| #define FEAT_IPV6 1
| #define HAVE_INET_NTOP 1
| #define FEAT_NETBEANS_INTG 1
| #define FEAT_JOB_CHANNEL 1
| #define FEAT_TERMINAL 1
| #define HAVE_WAYLAND 1
| #define HAVE_PIXMAN 1
| #define HAVE_X11 1
| #define SIZEOF_WCHAR_T 4
| #define USE_GTK3 1
| #define USE_GRESOURCE 1
| #define FEAT_PRINT_PANGO 1
| #define HAVE_X11_XPM_H 1
| #define HAVE_X11_SUNKEYSYM_H 1
| #define FEAT_XIM 1
| #define PROC_EXE_LINK "/proc/self/exe"
| #define HAVE_DATE_TIME 1
| #define HAVE_ATTRIBUTE_UNUSED 1
| #define HAVE_DIRENT_H 1
| #define HAVE_SYS_WAIT_H 1
| #define HAVE_WAITPID 1
| #define HAVE_STDINT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_SYS_SELECT_H 1
| #define HAVE_SYS_UTSNAME_H 1
| #define HAVE_TERMCAP_H 1
| #define HAVE_FCNTL_H 1
| #define HAVE_SGTTY_H 1
| #define HAVE_SYS_IOCTL_H 1
| #define HAVE_SYS_TIME_H 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_ICONV_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_LANGINFO_H 1
| #define HAVE_MATH_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_ERRNO_H 1
| #define HAVE_SYS_RESOURCE_H 1
| #define HAVE_LOCALE_H 1
| #define HAVE_TERMIOS_H 1
| #define HAVE_SYS_STATFS_H 1
| #define HAVE_POLL_H 1
| #define HAVE_SYS_POLL_H 1
| #define HAVE_PWD_H 1
| #define HAVE_UTIME_H 1
| #define HAVE_SYS_PARAM_H 1
| #define HAVE_LIBINTL_H 1
| #define HAVE_LIBGEN_H 1
| #define HAVE_SYS_SYSINFO_H 1
| #define HAVE_WCHAR_H 1
| #define HAVE_WCTYPE_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_LIBTINFO 1
| #define TERMINFO 1
| #define TGETENT_ZERO_ERR 0
| #define HAVE_OSPEED 1
| #define HAVE_UP_BC_PC 1
| #define HAVE_DEL_CURTERM 1
| #define SYS_SELECT_WITH_SYS_TIME 1
| #define HAVE_SVR4_PTYS 1
| #define HAVE_SIGCONTEXT 1
| #define HAVE_FCHDIR 1
| #define HAVE_FCHOWN 1
| #define HAVE_FCHMOD 1
| #define HAVE_FSYNC 1
| #define HAVE_GETCWD 1
| #define HAVE_GETPWENT 1
| #define HAVE_GETPWNAM 1
| #define HAVE_GETPWUID 1
| #define HAVE_GETRLIMIT 1
| #define HAVE_GETTIMEOFDAY 1
| #define HAVE_LOCALTIME_R 1
| #define HAVE_LSTAT 1
| #define HAVE_MEMSET 1
| #define HAVE_MKDTEMP 1
| #define HAVE_NANOSLEEP 1
| #define HAVE_OPENDIR 1
| #define HAVE_PUTENV 1
| #define HAVE_QSORT 1
| #define HAVE_READLINK 1
| #define HAVE_SELECT 1
| #define HAVE_SETENV 1
| #define HAVE_GETPGID 1
| #define HAVE_SETPGID 1
| #define HAVE_SETSID 1
| #define HAVE_SIGALTSTACK 1
| #define HAVE_SIGSTACK 1
| #define HAVE_SIGSET 1
| #define HAVE_SIGACTION 1
| #define HAVE_SIGPROCMASK 1
| #define HAVE_STRCASECMP 1
| #define HAVE_STRCOLL 1
| #define HAVE_STRERROR 1
| #define HAVE_STRFTIME 1
| #define HAVE_STRNCASECMP 1
| #define HAVE_STRPBRK 1
| #define HAVE_STRPTIME 1
| #define HAVE_STRTOL 1
| #define HAVE_TGETENT 1
| #define HAVE_TOWLOWER 1
| #define HAVE_TOWUPPER 1
| #define HAVE_ISWUPPER 1
| #define HAVE_TZSET 1
| #define HAVE_USLEEP 1
| #define HAVE_UTIME 1
| #define HAVE_UTIMES 1
| #define HAVE_MBLEN 1
| #define HAVE_FTRUNCATE 1
| #define HAVE_UNSETENV 1
| #define HAVE_POSIX_OPENPT 1
| #define HAVE_CLOCK_GETTIME 1
| #define HAVE_SYNC 1
| #define SELECT_TYPE_ARG1 int
| #define SELECT_TYPE_ARG234 (fd_set *)
| #define SELECT_TYPE_ARG5 (struct timeval *)
| #define HAVE_FSEEKO 1
| /* end confdefs.h.  */
| 
|   # include <sodium.h>
| 
| int
| main (void)
| {
| 
|      printf("%d", sodium_init());
|   ;
|   return 0;
| }
configure:15133: result: no; try installing libsodium-dev
主要语言
Vim Script
星标
41.4k
派生
6.2k
PR 合并指标
30 天内没有已合并 PR

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

vim/vim 的其他 Issue

查看 vim/vim 的全部 Issue

相似的 Issue

更多 Build System Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。