使用标志构建glibc _file_offset_bits = 64和_time_bits = 64失败
我想做的是在Y2038问题上为GLIBC提供解决方案。 我在Ubuntu 18.04 VM中使用BuildRoot 2022.02.2进行交叉编译,用于32位ARM CPU。 我读到添加额外的标志_file_offset_bits = 64和_time_bits = 64应该这样做,但是我会得到这样的构建错误
/tmp/cclzlgs6.s:soundationbler messages: /tmp/cclzlgs6.s:138:错误:符号`_____igtimedWait64'is 已经定义了
对2.34中Y2038发行的支持,还是在进行工作? 还是我做错了什么,例如错过一些旗帜?
谢谢你, 加泰罗尼亚
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以执行以下操作以获取Y2038安全的BuildRoot 32位ARM系统:
例如,将此补丁放在buildroot/potpack/libzlib/:
这是必需的,因为在glibc标头中有一个断言,当_time_bits为64时,错误出现
错误
了 Zlib的新版本1.3版本包括上面的补丁()。
我注意到的一件事是,可以从其网站下载的预编译的手臂工具链与内核v4.20.13的Linux内核标头捆绑在一起。这些旧标头与_time_bits = 64不兼容,在某些情况下,例如使用so_timestamp/scm_timestamp,因为这些旧标头定义了不正确的(旧的)整数。我通过看到损坏的时间戳来运行BTMON记录器时注意到了这一点。我决定使用针对我实际使用的Linux内核版本的更新的Linux内核标头构建自己的工具链。
幸运的是,由于自动构建脚本以及ARM的工具链释放提供的说明,可以通过单击相关下载部分底部的“释放注释”链接来找到,从头开始构建工具链。这些说明是在“使用Linaro的ABE来源构建Linux托管工具链”下找到的。该示例用于
Arm-gnu-toolchain-aarch64-none-felf
,但相应的说明适用于arm-gnu-gnu-toolchain-toolchain-arm-arm-arm-none-linux-linux-gnueaeabihf
。In the downloaded
用新的工具链替换预编译的工具链后,BTMON现在显示正确的时间戳。
再次更新:
BuildRoot终于正式添加了_time_bits = 64标志,您可以轻松地通过配置选项 br2_time_bits_64 。请注意,如上所述,您仍然应该确保拥有使用适当的Linux标头构建的工具链。
You can do the following to get a Y2038 safe buildroot 32-bit ARM system:
For example, put this patch as 0002-time-bits.patch in buildroot/package/libzlib/:
This is required because there is an assertion in the glibc headers that error out when _TIME_BITS is 64 but _FILE_OFFSET_BITS is not 64.
UPDATE:
The newly released version 1.3 of zlib includes the patch above (https://github.com/madler/zlib/commit/a566e156b3fa07b566ddbf6801b517a9dba04fa3).
One thing I noticed is that the pre-compiled ARM toolchain that can be downloaded from their website is bundled with Linux Kernel headers from kernel v4.20.13. These old headers are incompatible with _TIME_BITS=64 in some cases, for example the usage of SO_TIMESTAMP/SCM_TIMESTAMP, since these old headers define the incorrect (old) integers. I noticed this while running the btmon logger by seeing corrupt timestamps. I decided to build my own toolchain using updated Linux Kernel headers targeting the Linux Kernel version I'm actually using.
Fortunately, building the toolchain from scratch is relatively straightforward thanks to the automatic build script and the instructions supplied by every release of ARM's toolchain which can be found by clicking the "Release Note" link at the bottom of the relevant download section. The instructions are found under "Building Linux hosted toolchain from sources using Linaro's ABE". The example is for
arm-gnu-toolchain-aarch64-none-elf
but the corresponding instructions apply forarm-gnu-toolchain-arm-none-linux-gnueabihf
as well.In the downloaded manifest file, I changed
linux_revision=v4.20.13
tolinux_revision=v6.3
(which is my target kernel version) and removed thelinux_md5sum
line (I was too lazy to find out the checksum). For some very strange reason, thegcc_stage2_flags
are apparently different in the example manifest compared to the ones used in pre-compiled released binaries. Notably, libatomic is not included due to--disable-libatomic
in the example manifest file. But libatomic is required by many buildroot packages, e.g. ones that need to perform atomic operations on objects larger than 8 bytes, or packages that just happen to link to libatomic.so anyway. To better align with the binary release, I removed--disable-libatomic --without-cloog --without-isl --disable-libgomp --disable-libquadmath
fromgcc_stage2_flags
(but did not touchgcc_stage1_flags
).After replacing the pre-compiled toolchain with this new one, btmon now shows the correct timestamps.
UPDATE AGAIN:
Buildroot has finally officially added the _TIME_BITS=64 flag which you can easily enable through the config option BR2_TIME_BITS_64. Note that you should still make sure you have a toolchain built with the appropriate Linux headers, as mentioned above.