在 Ubuntu 18.10 上,由于“请将 gnulib freadahead.c 移植到您的平台!”导致 m4 1.4.10 至 1.4.18 的编译失败

在 Ubuntu 18.10 上,由于“请将 gnulib freadahead.c 移植到您的平台!”导致 m4 1.4.10 至 1.4.18 的编译失败

./configure && make -j1使用gitgit存储库构建 GNU m4 1.4.10 至 1.4.18 的 tarball 版本(没有测试所有修补程序版本,但我认为错误在这个范围内是一致的)http://git.savannah.gnu.org/r/m4.git由于./bootstrap && ./configure && make -j1cvs-readonly-359-gd69fa528提交)HEAD失败master

freadahead.c: In function 'freadahead':
freadahead.c:92:3: error: #error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread, ungetc on your system, then report this to bug-gnulib."
  #error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread, ungetc on your system, then report this to bug-gnulib."
   ^~~~~
make[3]: *** [Makefile:1910: freadahead.o] Error 1
make[3]: Leaving directory '/mnt/data/sources/m4-1.4.18/lib'

我对这个错误感到非常困惑,根据谷歌的粗略搜索,这个问题是由于长期忽略上游更新造成的,例如https://bugzilla.redhat.com/show_bug.cgi?id=1573342带有修复的天才文档“感谢错误报告,已修复!” - 如果这没有帮助其他人......

我尝试从源代码构建 glibc,并将其安装到自定义前缀[1] 中。2.28 和 2.27 出现同样的问题,2.26 失败,原因是

make[2]: Verzeichnis „/mnt/data/sources/glibc-2.26/inet“ wird betreten
gcc ../sysdeps/unix/sysv/linux/if_index.c -c -std=gnu11 -fgnu89-inline  -O2 -Wall -Werror -Wundef -Wwrite-strings -fmerge-all-constants -fno-stack-protector -frounding-math -g -Wstrict-prototypes -Wold-style-definition     -ftls-model=initial-exec   -U_FORTIFY_SOURCE   -I../include -I/mnt/data/sources/glibc-2.26-build/inet  -I/mnt/data/sources/glibc-2.26-build  -I../sysdeps/unix/sysv/linux/x86_64/64  -I../sysdeps/unix/sysv/linux/x86_64  -I../sysdeps/unix/sysv/linux/x86  -I../sysdeps/x86/nptl  -I../sysdeps/unix/sysv/linux/wordsize-64  -I../sysdeps/x86_64/nptl  -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux  -I../sysdeps/nptl  -I../sysdeps/pthread  -I../sysdeps/gnu  -I../sysdeps/unix/inet  -I../sysdeps/unix/sysv  -I../sysdeps/unix/x86_64  -I../sysdeps/unix  -I../sysdeps/posix  -I../sysdeps/x86_64/64  -I../sysdeps/x86_64/fpu/multiarch  -I../sysdeps/x86_64/fpu  -I../sysdeps/x86/fpu/include -I../sysdeps/x86/fpu  -I../sysdeps/x86_64/multiarch  -I../sysdeps/x86_64  -I../sysdeps/x86  -I../sysdeps/ieee754/float128  -I../sysdeps/ieee754/ldbl-96/include -I../sysdeps/ieee754/ldbl-96  -I../sysdeps/ieee754/dbl-64/wordsize-64  -I../sysdeps/ieee754/dbl-64  -I../sysdeps/ieee754/flt-32  -I../sysdeps/wordsize-64  -I../sysdeps/ieee754  -I../sysdeps/generic  -I.. -I../libio -I.   -D_LIBC_REENTRANT -include /mnt/data/sources/glibc-2.26-build/libc-modules.h -DMODULE_NAME=libc -include ../include/libc-symbols.h  -DPIC     -DTOP_NAMESPACE=glibc -o /mnt/data/sources/glibc-2.26-build/inet/if_index.o -MD -MP -MF /mnt/data/sources/glibc-2.26-build/inet/if_index.o.dt -MT /mnt/data/sources/glibc-2.26-build/inet/if_index.o
../sysdeps/unix/sysv/linux/if_index.c: In function ‘__if_nametoindex’:
../sysdeps/unix/sysv/linux/if_index.c:46:3: error: ‘strncpy’ specified bound 16 equals destination size [-Werror=stringop-truncation]
   strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name));
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [/mnt/data/sources/glibc-2.26-build/sysd-rules:213: /mnt/data/sources/glibc-2.26-build/inet/if_index.o] Fehler 1
make[2]: Verzeichnis „/mnt/data/sources/glibc-2.26/inet“ wird verlassen
make[1]: *** [Makefile:215: inet/subdir_lib] Fehler 2
make[1]: Verzeichnis „/mnt/data/sources/glibc-2.26“ wird verlassen
make: *** [Makefile:9: all] Fehler 2

和 2.25 是由于

strftime_l.c: In function ‘__strftime_internal’:
strftime_l.c:719:4: error: macro expands to multiple statements [-Werror=multistatement-macros]
    digits = d > width ? d : width;          \
    ^~~~~~
strftime_l.c:1260:6: note: in expansion of macro ‘DO_NUMBER’
      DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE);
      ^~~~~~~~~
strftime_l.c:1259:4: note: some parts of macro expansion are not guarded by this ‘else’ clause
    else
    ^~~~
In file included from wcsftime_l.c:23:
strftime_l.c: In function ‘__strftime_internal’:
strftime_l.c:719:4: error: macro expands to multiple statements [-Werror=multistatement-macros]
    digits = d > width ? d : width;          \
    ^~~~~~
strftime_l.c:1260:6: note: in expansion of macro ‘DO_NUMBER’
      DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE);
      ^~~~~~~~~
strftime_l.c:1259:4: note: some parts of macro expansion are not guarded by this ‘else’ clause
    else
    ^~~~
cc1: all warnings being treated as errors
make[2]: *** [../o-iterator.mk:9: /mnt/data/sources/glibc-2.25-build/time/strftime_l.os] Fehler 1

这让我决定不再尝试后续版本。

[关于 findutils 中类似问题的报告讨论] 建议freadahead.{c,h}从最新的 gnulib 源根目录进行覆盖。这会导致一系列问题,这里无需记录这些问题,因为我不知道自己在做什么。

如何开始修复、报告和/或解决这个问题?

我正在从源代码构建 m4,用于引导脚本,适用于用户无权使用包管理器的系统。我真的只对从发布源代码 tarball 构建原始 GNU m4 感兴趣。

其他类似裸系统的构建结果概述如下:https://gitlab.com/krichter/m4/pipelines/36977411


[1] 如果你正在调查这个问题,请始终将 glibc 安装到自定义前缀中,因为默认前缀中的安装/usr/local肯定会破坏你的系统。请考虑使用checkinstall以确保万无一失。

答案1

尝试申请此补丁。它是 OpenEmbedded 生成的上游补丁的反向移植。

答案2

如果您想从源代码构建 m4,那么首先从存储库中获取其构建依赖项:

  1. 使能够源代码在里面软件与更新software-properties-gtk
  2. 安装所需的构建工具

    sudo apt-get install build-essential
    
  3. 获取当前m4二进制包必要的构建依赖项

    sudo apt-get build-dep m4
    
  4. 获取当前m4二进制包的源代码(包含 Debian 和/或 Ubuntu 提供的所有所需补丁):

    apt-get source m4
    cd m4-*
    
  5. 然后照常编译

相关内容