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

查看:1306
本文介绍了在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野牛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

  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

    进行安装

    我遇到以下错误在 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:全部]错误2

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

    如果我尝试添加-禁用份额d 标志,则不会发生其他错误。

    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-dev make 命令成功通过,但 make install 失败,并出现以下错误:

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


    执行gcc失败!

    Execution of gcc failed!

    脚本发现您的安装有问题!

    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

    onl y这样的链接(例如/ lib和/ usr / lib)

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

    在$ b之后,应从构建目录重新启动此脚本$ b解决了所有问题!

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

    Btw。如果您不是将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&g ; /etc/ld.so.conf<< EOF#开始/etc/ld.so.conf
      / usr / local / lib
      / opt / lib
      / usr / lib
      / usr / lib64
      / usr / libexec
      #结束/etc/ld.so.conf
      EOF

    11. make

    12. 进行安装

    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" # Begin /etc/ld.so.conf /usr/local/lib /opt/lib /usr/lib /usr/lib64 /usr/libexec # End /etc/ld.so.conf EOF
    11. make
    12. make install

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

    I hope these steps will work for everybody else also.

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

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