在 Alpine Linux 上构建 glibc 时出错 [英] Errors when building glibc on Alpine Linux

查看:58
本文介绍了在 Alpine Linux 上构建 glibc 时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Alpine Linux 上安装 glibc.我在 Docker 中运行 Alpine Linux.以下是我正在使用的步骤:

I am trying to install glibc on Alpine Linux. I am running Alpine Linux in the Docker. Here are the steps I am using:

  1. docker pull alpine
  2. docker run -it alpine/bin/sh
  3. apk add --no-cache make gcc linux-headers bsd-compat-headers gawk bison binutils coreutils diffutils gettext bash grep sed texinfo perl
  4. wget https://ftp.gnu.org/gnu/glibc/glibc-2.28.tar.gz
  5. tar -xzf glibc-2.28.tar.gz
  6. cd glibc-2.28
  7. mkdir glibc-build
  8. cd glibc-build
  9. ../configure --prefix=/usr --disable-profile --enable-add-ons --libexecdir=/usr/bin --with-headers=/usr/include --enable-static-pie
  10. cat >/etc/ld.so.conf <<EOF"

# Begin /etc/ld.so.conf

/usr/local/lib
/opt/lib

# End /etc/ld.so.conf
EOF

  • 制作

    make install

    我在 11th 步骤中遇到以下错误:

    I am getting following error on 11th step:

    /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/ld: 找不到 -lssp_nonshared

    /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find -lssp_nonshared

    collect2:错误:ld 返回 1 个退出状态

    collect2: error: ld returned 1 exit status

    make[2]: *** [Makefile:129:/glibc-2.28/glibc-build/elf/sotruss-lib.so] 错误 1

    make[2]: *** [Makefile:129: /glibc-2.28/glibc-build/elf/sotruss-lib.so] Error 1

    make[2]: 离开目录'/glibc-2.28/elf'

    make[2]: Leaving directory '/glibc-2.28/elf'

    make[1]: *** [Makefile:258: elf/subdir_lib] 错误 2

    make[1]: *** [Makefile:258: elf/subdir_lib] Error 2

    make[1]: 离开目录 '/glibc-2.28'

    make[1]: Leaving directory '/glibc-2.28'

    make: *** [Makefile:9: all] 错误 2

    make: *** [Makefile:9: all] Error 2

    如果我尝试添加 --disable-shared 标志,则会发生另一个错误.

    If I try to add --disable-shared flag than another errors occur.

    该错误可以通过使用以下命令添加 libc-dev 来解决:apk add --no-cache libc-dev.但是这样我会有两个 C 库,但我需要我的应用程序专门使用 glibc.

    The error could be solved by adding libc-dev with the following command: apk add --no-cache libc-dev. But this way I would have two C libraries but I need my application to use glibc specifically.

    更新

    如果我运行 apk add --no-cache libc-devmake 命令成功通过但 make install 失败并出现以下错误:

    If I run apk add --no-cache libc-dev, make command passes successfully but make install fails with the following error:

    gcc 执行失败!

    脚本发现您的安装存在一些问题!

    The script has found some problems with your installation!

    请阅读常见问题解答和自述文件并检查以下内容:

    Please read the FAQ and the README file and check the following:

    • 您是否更改了 gcc 规范文件(从Linux libc5)?

    • Did you change the gcc specs file (necessary after upgrading from Linux libc5)?

    是否有任何形式为 libXXX.so 的符号链接到旧库?

    Are there any symbolic links of the form libXXX.so to old libraries?

    像 libm.so -> libm.so.5(其中 libm.so.5 是旧库)这样的链接是错误的,

    Links like libm.so -> libm.so.5 (where libm.so.5 is an old library) are wrong,

    libm.so 应该指向新安装的 glibc 文件 - 应该有

    libm.so should point to the newly installed glibc file - and there should be

    只有一个这样的链接(检查例如/lib 和/usr/lib)

    only one such link (check e.g. /lib and /usr/lib)

    你应该在你的构建目录中重新启动这个脚本解决了所有问题!

    You should restart this script from your build directory after you've fixed all problems!

    顺便说一句.如果您安装的不是 GNU libc,脚本将不起作用主要图书馆!

    Btw. the script doesn't work if you're installing GNU libc not as your primary library!

    推荐答案

    最终,为了在 Alpine Linux 上构建 glibc,我更改了几个步骤.

    Eventually, I changed few steps in order to build glibc on Alpine Linux.

    以下是对我有用的步骤:

    Here are the steps that worked for me:

    1. docker pull alpine
    2. docker run -it alpine/bin/sh
    3. wget https://ftp.gnu.org/gnu/glibc/glibc-2.28.tar.gz
    4. tar -xzf glibc-2.28.tar.gz
    5. cd glibc-2.28
    6. mkdir glibc-build
    7. cd glibc-build
    8. apk add --no-cache make gcc gawk bison linux-headers libc-dev
    9. ../configure --prefix=/usr --disable-profile --enable-add-ons --libexecdir=/usr/lib --with-headers=/usr/include --without-cvs --enable-static-pie
    10. cat >/etc/ld.so.conf <<"EOF" # 开始/etc/ld.so.conf/usr/本地/lib/选择/库/usr/lib/usr/lib64/usr/libexec# 结束/etc/ld.so.confEOF
    11. 制作
    12. 进行安装

    我希望这些步骤也适用于其他所有人.

    I hope these steps will work for everybody else also.

    这篇关于在 Alpine Linux 上构建 glibc 时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆