Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Linking issues with Qt 5.2.1 when building for ARM
Forum Updated to NodeBB v4.3 + New Features

Linking issues with Qt 5.2.1 when building for ARM

Scheduled Pinned Locked Moved Installation and Deployment
4 Posts 2 Posters 4.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    filippo.sironi
    wrote on last edited by
    #1

    Hi everyone,

    I'm building Qt 5.2.1 for ARM/Linux/X11.
    My target platform is Nvidia Tegra 2 and I configured Qt with the following command (sorry, it's pretty long):

    @./configure -prefix /opt/QtTegra2 -opensource -confirm-license -mtdev -no-sql-db2 -no-sql-ibase -no-sql-mysql -no-sql-oci -no-sql-odbc -no-sql-psql -no-sql-sqlite -no-sql-sqlite2 -no-sql-tds -no-glib -make libs -nomake examples -no-cups -no-pch -no-dbus -device tegra2 -device-option CROSS_COMPILE=/opt/local/bin/arm-linux-gnueabihf- -no-eglfs -no-directfb -no-linuxfb -no-kms -qpa xcb -sysroot /home/siro/ubuntu/rootfs -opengl es2 2>&1 | tee configure.log@

    After compiling the components of libQt5Core.so comes the linking issue.
    The resulting error follows:

    @/opt/local/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: /home/siro/ubuntu/rootfs/usr/lib/arm-linux-gnueabihf/libz.a(compress.o): relocation R_ARM_THM_MOVW_ABS_NC against a local symbol can not be used when making a shared object; recompile with -fPIC
    /home/siro/ubuntu/rootfs/usr/lib/arm-linux-gnueabihf/libz.a: error adding symbols: Bad value
    collect2: error: ld returned 1 exit status@

    I'm kind of lost since I couldn't find any solution to this issue.

    Any help?

    PS: -fPIC is among the options employed to compile objects since I'm not using the -static option of the configure script and the pkgconfig of libz inside usr/lib/arm-linux-gnueabihf/pkgconfig seems correct.

    1 Reply Last reply
    0
    • F Offline
      F Offline
      filippo.sironi
      wrote on last edited by
      #2

      Adding -static to the configuration option (after a make clean) brings up other issues...

      1 Reply Last reply
      0
      • F Offline
        F Offline
        filippo.sironi
        wrote on last edited by
        #3

        I've done some additional testing, with the same flags except for -device, -device-option, -no-neon, and -sysroot I can safely compile for x86.

        1 Reply Last reply
        0
        • K Offline
          K Offline
          kDohmen
          wrote on last edited by kDohmen
          #4

          A litte late but i found the problem/solution:

          The problem is the sysroot. Normally gcc links to shared libraries. But when it cant find it, gcc uses the static libraries (.a). When you look in [sysroot]/usr/lib/arm-linux-gnueabihf the shared libraries are not in this place. There are only symlinks to /lib/arm-linux-gnueabihf. So gcc looks for the shared libraries on you host-pc, where it can not find them.

          Solution:
          Create just the right symlink. (here an example for your libz, the X is the version number)
          ln -s [sysroot]/lib/arm-linux-gnueabihf/libz.so.X [sysroot]/usr/lib/arm-linux-gnueabihf/libz.so
          (Dont forget to remove the old symlink and create it after compiling successfully; i just mv the symlink from "file.so" to "file.so.backup" befor compiling)

          Another solution:
          Relativ symlink.
          ln -s ../../../lib/arm-linux-gnueabihf/libz.so.X [sysroot]/usr/lib/arm-linux-gnueabihf/libz.so

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved