6

I'm building a gst-plugin through yocto 1.6. I've linaro 4.9 cross toolchain of 32 and 64-bit. When I'm building the plugin using 64-bit toolchain, it was success ( I got the plugin .so file) whereas if I build the same source using 32-bit toolchain I got the below error

/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

here the whole error

./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

I was confused, why the build was failed to recompile with -fPIC though it was mentioned in the linking command? I tried -fPIC option manually everywhere in the Makefile and libtool script, but no use :(

and

without modifying the source and recipe file, it was success in 32-bit toolchain whereas failed in 64-bit toolchain and telling to recompile with -fPIC option

Below are the build machine info.

BB_VERSION        = "1.28.0"
BUILD_SYS         = "i686-linux"
NATIVELSBSTRING   = "Ubuntu-14.04"
Moorthy B S
  • 81
  • 1
  • 6
  • 1
    Have you found a solution to this? –  Apr 05 '17 at 07:03
  • I had the same problem after I changed the glibc recipe for a build. For me a `bitbake -c cleanall` solved the problem. So maybe you should try that too, or split your 32 and 64 bit toolchain in two separate build folders? – g0hl1n Jul 18 '17 at 08:29
  • The symbol type `R_ARM_REL32` should not be a problem, except the runtime link-loader cannot handle it at the moment. Also see [arm: module: add support for R_ARM_REL32 relocations](https://patchwork.kernel.org/patch/9527003/), which is a patch that was not applied to the kernel at the time. It is not clear to me if it has since been applied. I've also found `-fPIC` does not solve the problem; see Crypto++ Issue 846, [ARM and "unexpected reloc type 0x03" loading shared object](https://github.com/weidai11/cryptopp/issues/846)). – jww May 23 '19 at 10:03

2 Answers2

0

This is likely a bug in gold linker. similar to

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

It seems you are using gold linker as default ld. So please pass

  LDFLAGS += "-fuse-ld=bfd"

in recipe for this package. and see if that helps. This will force GNU BFD linker to be used for this package.

Khem
  • 1,162
  • 8
  • 8
0

I was confused, why the build was failed to recompile with -fPIC though it was mentioned in the linking command? I tried -fPIC option manually everywhere in the Makefile and libtool script, but no use :(

Regarding these statements...

make distclean should clean all artifacts so everything gets rebuilt. You will also need to reconfigure.

Before you reconfigure, open your configure.ac and be sure you have a LT_INIT that includes pic-only:

AC_INIT([Crypto++], [8.3], ...)
LT_INIT([pic-only,enable-shared,enable-static])
AM_INIT_AUTOMAKE
...
jww
  • 97,681
  • 90
  • 411
  • 885