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

Kar*_*ter 8 compiling gnu glibc

GNU m4 1.4.10 到 1.4.18 tarball 版本的构建(没有测试所有修补程序版本,但我认为错误在这个范围内是一致的)./configure && make -j1和 gitgit存储库http://git.savannah.gnu.org /r/m4.git with ./bootstrap && ./configure && make -j1(commit cvs-readonly-359-gd69fa528ie HEADof 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'
Run Code Online (Sandbox Code Playgroud)

我对这个错误感到非常困惑,根据肤浅的谷歌搜索,问题是上游更新时间过长被忽略的结果,参见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
Run Code Online (Sandbox Code Playgroud)

和 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
Run Code Online (Sandbox Code Playgroud)

这让我决定不再尝试其他版本。

[关于 findutils 中类似问题的报告的讨论] 建议freadahead.{c,h}从最新的 gnulib 源根进行覆盖。这会导致一连串的问题,因为我不知道我在做什么,所以这里没有必要记录这些问题。

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

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

https://gitlab.com/krichter/m4/pipelines/36977411提供了其他类似裸系统的构建结果概览。


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

小智 5

尝试应用此补丁。它是一个 OpenEmbedded 生成的上游补丁的反向移植。


N0r*_*ert 4

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

  1. 软件和更新中启用源代码( )software-properties-gtk
  2. 安装所需的构建工具

    sudo apt-get install build-essential
    
    Run Code Online (Sandbox Code Playgroud)
  3. 获取当前m4二进制包所需的构建依赖项

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

    apt-get source m4
    cd m4-*
    
    Run Code Online (Sandbox Code Playgroud)
  5. 然后照常编译