【问题标题】:requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC需要不支持的动态重定位 R_ARM_REL32;使用 -fPIC 重新编译
【发布时间】:2017-06-19 14:35:36
【问题描述】:

我正在通过 yocto 1.6 构建一个 gst 插件。我有 32 位和 64 位的 linaro 4.9 交叉工具链。 当我使用 64 位工具链构建插件时,它是成功的(我得到了插件 .so 文件),而如果我使用 32 位工具链构建相同的源,我得到了以下错误

/home/build-directory/tmp/sysroots/x86_64-linux/usr/libexec/cortexa8hf-vfp-neon-rdk-linux-gnueabi/gccgcc/arm-rdk-linux-gnueabi/4.9.4/ld: error: .libs/libgstpluginxxx_la-gstpluginxxx.o: requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC

这里是整个错误

./arm-rdk-linux-gnueabi-libtool  --tag=CC --tag=disable-static  --mode=link arm-rdk-linux-gnueabi-gcc  -march=armv7-a -mthumb-interwork -mfloat-abi=hard -mfpu=neon -mtune=cortex-a8 -fno-omit-frame-pointer -fno-optimize-sibling-calls --sysroot=/home/sysroots/path -pthread -I/home/sysroots/path/usr/include/gstreamer-1.0 -I/home/sysroots/path/usr/include/glib-2.0 -I/home/sysroots/path/usr/lib/glib-2.0/include  -O2 -pipe -g -feliminate-unused-debug-types  -fPIC  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o libgstpluginxxx.la -rpath /usr/lib/gstreamer-1.0 libgstpluginxxx_la-gstpluginxxx.lo -lgstreamer-1.0 -lgobject-2.0 -lglib-2.0
arm-rdk-linux-gnueabi-libtool: link: arm-rdk-linux-gnueabi-gcc -march=armv7-a -mthumb-interwork -enable-shared -mfloat-abi=hard -mfpu=neon -mtune=cortex-a8 -fno-omit-frame-pointer -fno-optimize-sibling-calls --sysroot=/home/sysroots/path -shared  -fPIC -DPIC  .libs/libgstpluginxxx_la-gstpluginxxx.o   /home/sysroots/path/usr/lib/libgstreamer-1.0.so -L/home/sysroots/path/usr/lib /home/sysroots/path/usr/lib/libgmodule-2.0.so -lm -ldl /home/sysroots/path/usr/lib/libgobject-2.0.so /home/sysroots/path/usr/lib/libffi.so /home/sysroots/path/usr/lib/libglib-2.0.so -lpthread  -march=armv7-a -mthumb-interwork -mfloat-abi=hard -mfpu=neon -mtune=cortex-a8 --sysroot=/home/sysroots/path -pthread -O2 -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed   -pthread -Wl,-soname -Wl,libgstpluginxxx.so.0 -o .libs/libgstpluginxxx.so.0.0.0
/home/build-directory/tmp/sysroots/x86_64-linux/usr/libexec/cortexa8hf-vfp-neon-rdk-linux-gnueabi/gcc/arm-rdk-linux-gnueabi/4.9.4/ld: error: .libs/libgstpluginxxx_la-gstpluginxxx.o: requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC

我很困惑,为什么在链接命令中提到了 -fPIC 却无法重新编译构建?我在 Makefile 和 libtool 脚本的任何地方都手动尝试了 -fPIC 选项,但没有用:(

在不修改源文件和配方文件的情况下,在 32 位工具链中成功,而在 64 位工具链中失败,并告诉使用 -fPIC 选项重新编译

以下是构建机器信息。

BB_VERSION        = "1.28.0"
BUILD_SYS         = "i686-linux"
NATIVELSBSTRING   = "Ubuntu-14.04"

【问题讨论】:

  • 你找到解决办法了吗?
  • 在更改构建的 glibc 配方后,我遇到了同样的问题。对我来说,bitbake <recipe> -c cleanall 解决了这个问题。所以也许您也应该尝试一下,或者将您的 32 位和 64 位工具链拆分为两个单独的构建文件夹?
  • 符号类型R_ARM_REL32 应该没有问题,除非运行时链接加载器目前无法处理它。另请参阅arm: module: add support for R_ARM_REL32 relocations,这是当时未应用于内核的补丁。我不清楚它是否已被应用。我还发现-fPIC 没有解决问题;请参阅 Crypto++ 第 846 期,ARM and "unexpected reloc type 0x03" loading shared object)。

标签: plugins gstreamer yocto fpic


【解决方案1】:

这可能是黄金链接器中的一个错误。类似于

https://sourceware.org/ml/binutils/2010-12/msg00473.html

您似乎正在使用黄金链接器作为默认 ld。所以请通过

  LDFLAGS += "-fuse-ld=bfd"

在这个包的配方中。看看是否有帮助。这将强制 GNU BFD 链接器用于此包。

【讨论】:

  • 这个 bug 似乎有点老了,要在 2017 年浮出水面。
【解决方案2】:

我很困惑,为什么在链接命令中提到了 -fPIC 却无法重新编译构建?我在 Makefile 和 libtool 脚本的任何地方都手动尝试了 -fPIC 选项,但没有用:(

关于这些声明...

make distclean 应该清理所有工件,以便重建所有内容。您还需要重新配置。

在重新配置之前,打开您的 configure.ac 并确保您有一个包含 pic-onlyLT_INIT

AC_INIT([Crypto++], [8.3], ...)
LT_INIT([pic-only,enable-shared,enable-static])
AM_INIT_AUTOMAKE
...

【讨论】:

    猜你喜欢
    • 2013-08-25
    • 2011-11-30
    • 2016-09-12
    • 1970-01-01
    • 1970-01-01
    • 2012-11-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多