Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Cannot build basic Android project
Forum Updated to NodeBB v4.3 + New Features

Cannot build basic Android project

Scheduled Pinned Locked Moved Solved Mobile and Embedded
5 Posts 2 Posters 1.6k 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.
  • C Offline
    C Offline
    CarVac
    wrote on last edited by
    #1

    I just started a new project from the Qt Quick Application - Swipe preset, using Cmake as my build system, and for Android builds it fails to link with the error

    /home/carvac/Qt/5.12.0/android_arm64_v8a/lib/libQt5Quick.so: error adding symbols: File in wrong format
    

    This happens for both arm64_v8a and armeabi_v7a.

    I haven't made any modifications to the project at all.

    I'm on Ubuntu 18.04. Qt Creator says Java Settings are OK (I have it set to use OpenJDK 8), the Android SDK and NDK are okay (SDK version 26.1.1, NDK version 18.1.5063045).

    Can anyone assist?

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      Welcome to the group.
      File in wrong format indicates the compiler mismatch for library & your app. Can you check it ?Anything worked before ?

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      0
      • C Offline
        C Offline
        CarVac
        wrote on last edited by
        #3

        I've compiled desktop x86 apps just fine before, but this is my first time doing Android development.

        The Qt library that it's trying to link is clearly the Arm version.

        In the build settings for the project, the CMAKE_C_COMPILER it uses is by default ~/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang.

        I also tried forcing it to be ~/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-gcc and that didn't work either.

        Is that what you need to know, or is there something else?

        1 Reply Last reply
        0
        • C Offline
          C Offline
          CarVac
          wrote on last edited by
          #4

          I tried increasing the verbosity of the makefile, and it reveals that it calls the clang++ without specifying what the target architecture should be.

          When I run that particular clang++ executable, it reveals that it defaults to building for x86-64.

          What can I add to CMakeLists to add the -target flag for the compiler?

          1 Reply Last reply
          0
          • C Offline
            C Offline
            CarVac
            wrote on last edited by
            #5

            In the end I couldn't get cmake to do the job, but qmake managed. I had to change an environment variable though.

            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