【问题标题】:Cross-compiled glibc causing build errors交叉编译的 glibc 导致构建错误
【发布时间】:2013-10-14 14:51:28
【问题描述】:

在 chroot 到 Ubuntu 后,我在 Chrome OS 上构建了 glibc 2.17(raring)。 Glibc 指定了 --with-headers 配置参数来提取 Chrome OS 内核头文件。

然后我使用DESTDIR 将结果安装到Chrome OS 的/usr/local 目录中。我还删除了与已经存在的 glibc 冲突的文件,并将当前的文件符号链接到我的新 /usr/local/ 目录中。它适用于 i686 内核,但现在我正在运行 x86_64(并在其下重建了所有内容),在尝试在 Chrome 操作系统上构建 openssl 时会发生这种情况:

    libcrypto.a(dso_dlfcn.o): In function `dlfcn_globallookup':
    dso_dlfcn.c:(.text+0x11): warning: Using 'dlopen' in statically linked applications  requires at runtime the shared libraries from the glibc version used for linking
    /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../x86_64-unknown-linux-gnu/bin/ld: /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../x86_64-unknown-linux-gnu/lib/../lib64/libdl.a(dlopen.o): relocation R_X86_64_PC32 against undefined symbol `__dlopen' can not be used when making a shared object; recompile with -fPIC
    /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../x86_64-unknown-linux-gnu/bin/ld: final link failed: Bad value
    collect2: error: ld returned 1 exit status
    make[4]: *** [link_a.gnu] Error 1

我尝试使用 -fPIC 重建 binutils,但仍然没有成功。

【问题讨论】:

    标签: linux gcc makefile glibc google-chrome-os


    【解决方案1】:

    错误指出libdl 需要用-fPIC 重新编译。这是libc 的一部分,而不是binutils,至少在 XUbuntu 13.04 上

    【讨论】:

    • -fPIC重新编译glibc是可行的(实际上,设置CFLAGS也需要你手动设置优化标志,所以最终结果是CFLAGS=-fPIC -O2。谢谢!
    猜你喜欢
    • 2017-02-11
    • 2021-07-08
    • 1970-01-01
    • 1970-01-01
    • 2011-05-20
    • 2014-07-03
    • 2015-08-09
    • 2017-06-06
    • 2019-05-26
    相关资源
    最近更新 更多