AnsweredAssumed Answered

openobex link with libusb fails: relocation R_ARM_MOVW_ABS_NC

Question asked by Lance Jump on Oct 8, 2013
Latest reply on Feb 26, 2014 by Yixing Kong

When building openobex for iMX6 in LTIB 9.1.1, it fails to link due to "relocation R_ARM_MOVW_ABS_NC" error. I modified the openobex build to include "-fPIC" as suggested in this thread:

Ltib libmpeg2 build failed

 

But I still get the error (see below). It was suggested that the library should be built with -fPIC:

[arm-gnu] Re:Re: [arm-gnu] R_ARM_MOVW_ABS_NC relocation error

 

In my case, it is libusb, but it appears that it is already being done that way.

 

Processing: openobex

======================

Build path taken because: directory build, build key set, no prebuilt rpm,

 

rpmbuild --dbpath /home/ljump/TST/iMX6/boundary/ltib/rootfs//var/lib/rpm --target arm --define '_unpackaged_files_terminate_build 0' --define '_target_cpu arm' --define '__strip strip' --define '_topdir /home/ljump/TST/iMX6/boundary/ltib/rpm' --define '_prefix /usr' --define '_tmppath /home/ljump/TST/iMX6/boundary/ltib/tmp' --define '_rpmdir /home/ljump/TST/iMX6/boundary/ltib/rpm/RPMS'  --define '_mandir /usr/share/man' --define '_sysconfdir /etc' --define '_localstatedir /var' -bc --short-circuit  /home/ljump/TST/iMX6/boundary/ltib/dist/lfs-5.1/openobex/openobex.spec

Building target platforms: arm

Building for target arm

Executing(%build): /bin/sh -e /home/ljump/TST/iMX6/boundary/ltib/tmp/rpm-tmp.63566

+ umask 022

+ cd /home/ljump/TST/iMX6/boundary/ltib/rpm/BUILD

+ cd openobex-1.2

+ '[' -z '' ']'

+ KERNELDIR=/home/ljump/TST/iMX6/boundary/ltib/rpm/BUILD/openobex-1.2/../linux

+ KBUILD_OUTPUT=/home/ljump/TST/iMX6/boundary/ltib/rpm/BUILD/openobex-1.2/../linux

+ ./configure --host=arm-linux --prefix=/usr --enable-apps -C --libdir=/home/ljump/TST/iMX6/boundary/ltib/rootfs//usr

configure: WARNING: If you wanted to set the --build type, don't use --host.

    If a cross compiler is detected then cross compile mode will be used.

configure: loading cache config.cache

checking for a BSD-compatible install... (cached) /usr/bin/install -c

checking whether build environment is sane... yes

checking for gawk... (cached) gawk

checking whether make sets $(MAKE)... (cached) yes

checking for arm-linux-strip... (cached) arm-linux-strip

checking whether to enable maintainer-specific portions of Makefiles... no

checking for arm-linux-gcc... (cached) gcc

checking for C compiler default output file name... a.out

checking whether the C compiler works... yes

checking whether we are cross compiling... yes

checking for suffix of executables...

checking for suffix of object files... (cached) o

checking whether we are using the GNU C compiler... (cached) yes

checking whether gcc accepts -g... (cached) yes

checking for gcc option to accept ANSI C... (cached) none needed

checking for style of include used by make... GNU

checking dependency style of gcc... (cached) gcc3

checking whether gcc accepts -fPIE... (cached) yes

checking for a BSD-compatible install... /usr/bin/install -c

checking build system type... (cached) i686-pc-linux-gnu

checking host system type... (cached) arm-unknown-linux-gnu

checking for a sed that does not truncate output... (cached) /bin/sed

checking for egrep... (cached) grep -E

checking for ld used by gcc... (cached) ld

checking if the linker (ld) is GNU ld... (cached) yes

checking for ld option to reload object files... (cached) -r

checking for BSD-compatible nm... (cached) /opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/arm-linux-nm -B

checking whether ln -s works... yes

checking how to recognise dependent libraries... (cached) pass_all

checking how to run the C preprocessor... (cached) gcc -E

checking for ANSI C header files... (cached) yes

checking for sys/types.h... (cached) yes

checking for sys/stat.h... (cached) yes

checking for stdlib.h... (cached) yes

checking for string.h... (cached) yes

checking for memory.h... (cached) yes

checking for strings.h... (cached) yes

checking for inttypes.h... (cached) yes

checking for stdint.h... (cached) yes

checking for unistd.h... (cached) yes

checking for dlfcn.h... (cached) yes

checking the maximum length of command line arguments... (cached) 32768

checking command to parse /opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/arm-linux-nm -B output from gcc object... (cached) ok

checking for objdir... (cached) .libs

checking for arm-linux-ar... (cached) ar

checking for arm-linux-ranlib... (cached) arm-linux-ranlib

checking for arm-linux-strip... (cached) arm-linux-strip

checking if gcc supports -fno-rtti -fno-exceptions... (cached) no

checking for gcc option to produce PIC... -fPIC

checking if gcc PIC flag -fPIC works... yes

checking if gcc static flag -static works... yes

checking if gcc supports -c -o file.o... (cached) yes

checking whether the gcc linker (ld) supports shared libraries... yes

checking whether -lc should be explicitly linked in... no

checking dynamic linker characteristics... GNU/Linux ld.so

checking how to hardcode library paths into programs... immediate

checking whether stripping libraries is possible... yes

checking if libtool supports shared libraries... yes

checking whether to build shared libraries... yes

checking whether to build static libraries... yes

configure: creating libtool

checking for IrDA support... yes

checking for bluetooth/bluetooth.h... (cached) yes

checking for hci_open_dev in -lbluetooth... (cached) yes

checking for sdp_connect in -lbluetooth... (cached) yes

checking for usb.h... (cached) yes

checking for usb_open in -lusb... (cached) yes

checking for usb_get_busses in -lusb... (cached) yes

checking for usb_interrupt_read in -lusb... (cached) yes

checking for /usr/lib/pkgconfig/libusb.pc... (cached) no

configure: creating ./config.status

config.status: creating Makefile

config.status: creating include/Makefile

config.status: creating lib/Makefile

config.status: creating apps/Makefile

config.status: creating ircp/Makefile

config.status: creating doc/Makefile

config.status: creating openobex.pc

config.status: creating config.h

config.status: config.h is unchanged

config.status: executing depfiles commands

+ '[' arm-none-linux-gnueabi- = arm-none-linux-gnueabi- ']'

+ sed -i 's,SUBDIRS = include lib apps ircp doc,SUBDIRS = include lib apps doc,' Makefile

+ sed -i 's,CFLAGS = -Wall -O2 -D_FORTIFY_SOURCE=2,CFLAGS = -Wall -O2 -fPIC -D_FORTIFY_SOURCE=2,' Makefile

+ sed -i 's,CFLAGS = -Wall -O2 -D_FORTIFY_SOURCE=2,CFLAGS = -Wall -O2 -fPIC -D_FORTIFY_SOURCE=2,' lib/Makefile

+ make

make  all-recursive

make[1]: Entering directory `/home/ljump/TST/iMX6/boundary/ltib/rpm/BUILD/openobex-1.2'

Making all in include

make[2]: Entering directory `/home/ljump/TST/iMX6/boundary/ltib/rpm/BUILD/openobex-1.2/include'

make[2]: Leaving directory `/home/ljump/TST/iMX6/boundary/ltib/rpm/BUILD/openobex-1.2/include'

Making all in lib

make[2]: Entering directory `/home/ljump/TST/iMX6/boundary/ltib/rpm/BUILD/openobex-1.2/lib'

if /bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include    -Wall -O2 -fPIC -D_FORTIFY_SOURCE=2 -MT obex.lo -MD -MP -MF ".deps/obex.Tpo" \

          -c -o obex.lo `test -f 'obex.c' || echo './'`obex.c; \

        then mv -f ".deps/obex.Tpo" ".deps/obex.Plo"; \

        else rm -f ".deps/obex.Tpo"; exit 1; \

        fi

if /bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include    -Wall -O2 -fPIC -D_FORTIFY_SOURCE=2 -MT obex_main.lo -MD -MP -MF ".deps/obex_main.Tpo" \

          -c -o obex_main.lo `test -f 'obex_main.c' || echo './'`obex_main.c; \

        then mv -f ".deps/obex_main.Tpo" ".deps/obex_main.Plo"; \

        else rm -f ".deps/obex_main.Tpo"; exit 1; \

        fi

if /bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include    -Wall -O2 -fPIC -D_FORTIFY_SOURCE=2 -MT obex_connect.lo -MD -MP -MF ".deps/obex_connect.Tpo" \

          -c -o obex_connect.lo `test -f 'obex_connect.c' || echo './'`obex_connect.c; \

        then mv -f ".deps/obex_connect.Tpo" ".deps/obex_connect.Plo"; \

        else rm -f ".deps/obex_connect.Tpo"; exit 1; \

        fi

if /bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include    -Wall -O2 -fPIC -D_FORTIFY_SOURCE=2 -MT obex_header.lo -MD -MP -MF ".deps/obex_header.Tpo" \

          -c -o obex_header.lo `test -f 'obex_header.c' || echo './'`obex_header.c; \

        then mv -f ".deps/obex_header.Tpo" ".deps/obex_header.Plo"; \

        else rm -f ".deps/obex_header.Tpo"; exit 1; \

        fi

if /bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include    -Wall -O2 -fPIC -D_FORTIFY_SOURCE=2 -MT obex_object.lo -MD -MP -MF ".deps/obex_object.Tpo" \

          -c -o obex_object.lo `test -f 'obex_object.c' || echo './'`obex_object.c; \

        then mv -f ".deps/obex_object.Tpo" ".deps/obex_object.Plo"; \

        else rm -f ".deps/obex_object.Tpo"; exit 1; \

        fi

if /bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include    -Wall -O2 -fPIC -D_FORTIFY_SOURCE=2 -MT obex_transport.lo -MD -MP -MF ".deps/obex_transport.Tpo" \

          -c -o obex_transport.lo `test -f 'obex_transport.c' || echo './'`obex_transport.c; \

        then mv -f ".deps/obex_transport.Tpo" ".deps/obex_transport.Plo"; \

        else rm -f ".deps/obex_transport.Tpo"; exit 1; \

        fi

if /bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include    -Wall -O2 -fPIC -D_FORTIFY_SOURCE=2 -MT obex_server.lo -MD -MP -MF ".deps/obex_server.Tpo" \

          -c -o obex_server.lo `test -f 'obex_server.c' || echo './'`obex_server.c; \

        then mv -f ".deps/obex_server.Tpo" ".deps/obex_server.Plo"; \

        else rm -f ".deps/obex_server.Tpo"; exit 1; \

        fi

if /bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include    -Wall -O2 -fPIC -D_FORTIFY_SOURCE=2 -MT obex_client.lo -MD -MP -MF ".deps/obex_client.Tpo" \

          -c -o obex_client.lo `test -f 'obex_client.c' || echo './'`obex_client.c; \

        then mv -f ".deps/obex_client.Tpo" ".deps/obex_client.Plo"; \

        else rm -f ".deps/obex_client.Tpo"; exit 1; \

        fi

gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -Wall -O2 -fPIC -D_FORTIFY_SOURCE=2 -MT obex.lo -MD -MP -MF .deps/obex.Tpo -c obex.c  -fPIC -DPIC -o .libs/obex.o

gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -Wall -O2 -fPIC -D_FORTIFY_SOURCE=2 -MT obex_main.lo -MD -MP -MF .deps/obex_main.Tpo -c obex_main.c  -fPIC -DPIC -o .libs/obex_main.o

gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -Wall -O2 -fPIC -D_FORTIFY_SOURCE=2 -MT obex_server.lo -MD -MP -MF .deps/obex_server.Tpo -c obex_server.c  -fPIC -DPIC -o .libs/obex_server.o

gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -Wall -O2 -fPIC -D_FORTIFY_SOURCE=2 -MT obex_connect.lo -MD -MP -MF .deps/obex_connect.Tpo -c obex_connect.c  -fPIC -DPIC -o .libs/obex_connect.o

gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -Wall -O2 -fPIC -D_FORTIFY_SOURCE=2 -MT obex_object.lo -MD -MP -MF .deps/obex_object.Tpo -c obex_object.c  -fPIC -DPIC -o .libs/obex_object.o

gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -Wall -O2 -fPIC -D_FORTIFY_SOURCE=2 -MT obex_header.lo -MD -MP -MF .deps/obex_header.Tpo -c obex_header.c  -fPIC -DPIC -o .libs/obex_header.o

gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -Wall -O2 -fPIC -D_FORTIFY_SOURCE=2 -MT obex_main.lo -MD -MP -MF .deps/obex_main.Tpo -c obex_main.c -o obex_main.o >/dev/null 2>&1

gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -Wall -O2 -fPIC -D_FORTIFY_SOURCE=2 -MT obex.lo -MD -MP -MF .deps/obex.Tpo -c obex.c -o obex.o >/dev/null 2>&1

gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -Wall -O2 -fPIC -D_FORTIFY_SOURCE=2 -MT obex_client.lo -MD -MP -MF .deps/obex_client.Tpo -c obex_client.c  -fPIC -DPIC -o .libs/obex_client.o

gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -Wall -O2 -fPIC -D_FORTIFY_SOURCE=2 -MT obex_transport.lo -MD -MP -MF .deps/obex_transport.Tpo -c obex_transport.c  -fPIC -DPIC -o .libs/obex_transport.o

gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -Wall -O2 -fPIC -D_FORTIFY_SOURCE=2 -MT obex_server.lo -MD -MP -MF .deps/obex_server.Tpo -c obex_server.c -o obex_server.o >/dev/null 2>&1

obex_connect.c: In function 'obex_parse_connect_header':

obex_connect.c:82:11: warning: variable 'length' set but not used [-Wunused-but-set-variable]

obex_connect.c:79:6: warning: variable 'flags' set but not used [-Wunused-but-set-variable]

obex_connect.c:78:10: warning: variable 'version' set but not used [-Wunused-but-set-variable]

gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -Wall -O2 -fPIC -D_FORTIFY_SOURCE=2 -MT obex_connect.lo -MD -MP -MF .deps/obex_connect.Tpo -c obex_connect.c -o obex_connect.o >/dev/null 2>&1

gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -Wall -O2 -fPIC -D_FORTIFY_SOURCE=2 -MT obex_header.lo -MD -MP -MF .deps/obex_header.Tpo -c obex_header.c -o obex_header.o >/dev/null 2>&1

gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -Wall -O2 -fPIC -D_FORTIFY_SOURCE=2 -MT obex_object.lo -MD -MP -MF .deps/obex_object.Tpo -c obex_object.c -o obex_object.o >/dev/null 2>&1

if /bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include    -Wall -O2 -fPIC -D_FORTIFY_SOURCE=2 -MT irobex.lo -MD -MP -MF ".deps/irobex.Tpo" \

          -c -o irobex.lo `test -f 'irobex.c' || echo './'`irobex.c; \

        then mv -f ".deps/irobex.Tpo" ".deps/irobex.Plo"; \

        else rm -f ".deps/irobex.Tpo"; exit 1; \

        fi

if /bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include    -Wall -O2 -fPIC -D_FORTIFY_SOURCE=2 -MT inobex.lo -MD -MP -MF ".deps/inobex.Tpo" \

          -c -o inobex.lo `test -f 'inobex.c' || echo './'`inobex.c; \

        then mv -f ".deps/inobex.Tpo" ".deps/inobex.Plo"; \

        else rm -f ".deps/inobex.Tpo"; exit 1; \

        fi

gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -Wall -O2 -fPIC -D_FORTIFY_SOURCE=2 -MT obex_transport.lo -MD -MP -MF .deps/obex_transport.Tpo -c obex_transport.c -o obex_transport.o >/dev/null 2>&1

gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -Wall -O2 -fPIC -D_FORTIFY_SOURCE=2 -MT obex_client.lo -MD -MP -MF .deps/obex_client.Tpo -c obex_client.c -o obex_client.o >/dev/null 2>&1

if /bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include    -Wall -O2 -fPIC -D_FORTIFY_SOURCE=2 -MT btobex.lo -MD -MP -MF ".deps/btobex.Tpo" \

          -c -o btobex.lo `test -f 'btobex.c' || echo './'`btobex.c; \

        then mv -f ".deps/btobex.Tpo" ".deps/btobex.Plo"; \

        else rm -f ".deps/btobex.Tpo"; exit 1; \

        fi

if /bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include    -Wall -O2 -fPIC -D_FORTIFY_SOURCE=2 -MT usbobex.lo -MD -MP -MF ".deps/usbobex.Tpo" \

          -c -o usbobex.lo `test -f 'usbobex.c' || echo './'`usbobex.c; \

        then mv -f ".deps/usbobex.Tpo" ".deps/usbobex.Plo"; \

        else rm -f ".deps/usbobex.Tpo"; exit 1; \

        fi

gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -Wall -O2 -fPIC -D_FORTIFY_SOURCE=2 -MT inobex.lo -MD -MP -MF .deps/inobex.Tpo -c inobex.c  -fPIC -DPIC -o .libs/inobex.o

gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -Wall -O2 -fPIC -D_FORTIFY_SOURCE=2 -MT irobex.lo -MD -MP -MF .deps/irobex.Tpo -c irobex.c  -fPIC -DPIC -o .libs/irobex.o

inobex.c: In function 'inobex_connect_request':

inobex.c:145:17: warning: variable 'addr' set but not used [-Wunused-but-set-variable]

gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -Wall -O2 -fPIC -D_FORTIFY_SOURCE=2 -MT inobex.lo -MD -MP -MF .deps/inobex.Tpo -c inobex.c -o inobex.o >/dev/null 2>&1

gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -Wall -O2 -fPIC -D_FORTIFY_SOURCE=2 -MT btobex.lo -MD -MP -MF .deps/btobex.Tpo -c btobex.c  -fPIC -DPIC -o .libs/btobex.o

gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -Wall -O2 -fPIC -D_FORTIFY_SOURCE=2 -MT irobex.lo -MD -MP -MF .deps/irobex.Tpo -c irobex.c -o irobex.o >/dev/null 2>&1

gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -Wall -O2 -fPIC -D_FORTIFY_SOURCE=2 -MT usbobex.lo -MD -MP -MF .deps/usbobex.Tpo -c usbobex.c  -fPIC -DPIC -o .libs/usbobex.o

gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -Wall -O2 -fPIC -D_FORTIFY_SOURCE=2 -MT btobex.lo -MD -MP -MF .deps/btobex.Tpo -c btobex.c -o btobex.o >/dev/null 2>&1

gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -Wall -O2 -fPIC -D_FORTIFY_SOURCE=2 -MT usbobex.lo -MD -MP -MF .deps/usbobex.Tpo -c usbobex.c -o usbobex.o >/dev/null 2>&1

/bin/sh ../libtool --mode=link gcc  -Wall -O2 -fPIC -D_FORTIFY_SOURCE=2   -o libopenobex.la -rpath /home/ljump/TST/iMX6/boundary/ltib/rootfs//usr -version-info 3:0:2 -export-symbols ../lib/obex.sym obex.lo obex_main.lo obex_connect.lo obex_header.lo obex_object.lo obex_transport.lo obex_server.lo obex_client.lo irobex.lo inobex.lo btobex.lo netbuf.lo usbobex.lo -lusb

rm -fr  .libs/libopenobex.ver

echo "{ global:" > .libs/libopenobex.ver

cat ../lib/obex.sym | sed -e "s/\(.*\)/\1;/" >> .libs/libopenobex.ver

echo "local: *; };" >> .libs/libopenobex.ver

gcc -shared  .libs/obex.o .libs/obex_main.o .libs/obex_connect.o .libs/obex_header.o .libs/obex_object.o .libs/obex_transport.o .libs/obex_server.o .libs/obex_client.o .libs/irobex.o .libs/inobex.o .libs/btobex.o .libs/netbuf.o .libs/usbobex.o  -lusb  -Wl,-soname -Wl,libopenobex.so.1 -Wl,-version-script -Wl,.libs/libopenobex.ver -o .libs/libopenobex.so.1.2.0

/opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.6.2/../../../../arm-fsl-linux-gnueabi/bin/ld: /home/ljump/TST/iMX6/boundary/ltib/rootfs/usr/lib//libusb.a(usb.o): relocation R_ARM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC

/home/ljump/TST/iMX6/boundary/ltib/rootfs/usr/lib//libusb.a: could not read symbols: Bad value

collect2: ld returned 1 exit status

make[2]: *** [libopenobex.la] Error 1

make[2]: Leaving directory `/home/ljump/TST/iMX6/boundary/ltib/rpm/BUILD/openobex-1.2/lib'

make[1]: *** [all-recursive] Error 1

make[1]: Leaving directory `/home/ljump/TST/iMX6/boundary/ltib/rpm/BUILD/openobex-1.2'

make: *** [all] Error 2

error: Bad exit status from /home/ljump/TST/iMX6/boundary/ltib/tmp/rpm-tmp.63566 (%build)

 

 

Has anyone gotten this to build?

Outcomes