如何构建旧版本的 glibc?

How to build older version of glibc?

我正在为 Ubuntu Xenial 16.04 构建 arm 的 gcc-8.1.0 交叉编译器。 该软件包作为 debian 软件包存在,但仅适用于 Ubuntu 18.04 bionic,这就是我构建它的原因。 但是有一个问题 - 即,gcc-8.1.0 作为 x86_64 系统的软件包存在于 Ubuntu 16.04(对于本机架构)。它会下载所有依赖项,其中包括 glibc-2.23。 当我想根据此处给出的说明为 arm 架构构建 gcc 交叉编译器时:http://preshing.com/20141119/how-to-build-a-gcc-cross-compiler/ 在第 6 步,当制作标准 C 库 glibc 由于错误 /tmp/ccs9D1VT.s: Error: `loc1@GLIBC_2.17' can't be versioned to common symbol 'loc1' 而无法构建时。 根据 link 中给出的手册,我在前面的步骤中尝试使用旧版本的 gcc(4.9.3 和 5.4.0),但似乎 glibc 有这个错误。

所以,我想知道 - 如果这是 glibc-2.23 中的错误,它是如何构建的? 因为我已经将它与 x86_64 Ubuntu Xenial 的 debian 软件包一起安装了。

您需要向后移植此上游提交:

commit 388b4f1a02f3a801965028bbfcd48d905638b797
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Jun 23 14:38:46 2017 -0700

Avoid .symver on common symbols [BZ #21666]

The .symver directive on common symbol just creates a new common symbol, not an alias and the newer assembler with the bug fix for

https://sourceware.org/bugzilla/show_bug.cgi?id=21661

will issue an error. Before the fix, we got […]

这次提交是 already included on the release/2.23/master branch,所以你可以这样。