Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Unsolved Problem compiling for Android from Windows

    Mobile and Embedded
    android qt 5.15 compilation
    1
    1
    198
    Loading More Posts
    • 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.
    • M
      mipr last edited by mipr

      Hi,

      I try to deploy my Windows Qt app on Android but I have problems that my colleagues don't have.

      First issue : we have custom plugins, we build them to have .so files and the compiler copy them inside a folder with other plugin/library files. On my PC, the .so files of my custom plugins are not copied to the dedicated folder during compilation, whereas on my colleagues' PCs this step works. I didn't see any differences between their project and mine.
      When I manually copy custom plugin files in the folder during compilation the APK works and doesn't crash.

      Second issue : after seeing and don't understanding the first issue, I tried to update my Qt Creator (version 6.x.x to 7.0.2) and it's worst. Now, I have errors like :

      error: relocation R_AARCH64_ADR_PREL_PG_HI21 cannot be used against symbol ff_cos_32; recompile with -fPIC
      ...
      error: can't create dynamic relocation R_AARCH64_ADD_ABS_LO12_NC against symbol: ff_cos_32 in readonly segment; recompile object files with -fPIC or pass '-WI, -z, notext' to allow text relocations in the output
      

      The complete list of errors :

      ld: error: relocation R_AARCH64_ADR_PREL_PG_HI21 cannot be used against symbol ff_cos_32; recompile with -fPIC
      >>> defined in D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a(fft_float.o)
      >>> referenced by asm.S:491 (./libavutil/aarch64\asm.S:491)
      >>>               fft_neon.o:(fft32_neon) in archive D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a
      
      ld: error: can't create dynamic relocation R_AARCH64_ADD_ABS_LO12_NC against symbol: ff_cos_32 in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
      >>> defined in D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a(fft_float.o)
      >>> referenced by asm.S:491 (./libavutil/aarch64\asm.S:491)
      >>>               fft_neon.o:(fft32_neon) in archive D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a
      
      ld: error: relocation R_AARCH64_ADR_PREL_PG_HI21 cannot be used against symbol ff_cos_64; recompile with -fPIC
      >>> defined in D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a(fft_float.o)
      >>> referenced by asm.S:492 (./libavutil/aarch64\asm.S:492)
      >>>               fft_neon.o:(fft64_neon) in archive D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a
      
      ld: error: can't create dynamic relocation R_AARCH64_ADD_ABS_LO12_NC against symbol: ff_cos_64 in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
      >>> defined in D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a(fft_float.o)
      >>> referenced by asm.S:492 (./libavutil/aarch64\asm.S:492)
      >>>               fft_neon.o:(fft64_neon) in archive D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a
      
      ld: error: relocation R_AARCH64_ADR_PREL_PG_HI21 cannot be used against symbol ff_cos_128; recompile with -fPIC
      >>> defined in D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a(fft_float.o)
      >>> referenced by asm.S:493 (./libavutil/aarch64\asm.S:493)
      >>>               fft_neon.o:(fft128_neon) in archive D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a
      
      ld: error: can't create dynamic relocation R_AARCH64_ADD_ABS_LO12_NC against symbol: ff_cos_128 in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
      >>> defined in D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a(fft_float.o)
      >>> referenced by asm.S:493 (./libavutil/aarch64\asm.S:493)
      >>>               fft_neon.o:(fft128_neon) in archive D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a
      
      ld: error: relocation R_AARCH64_ADR_PREL_PG_HI21 cannot be used against symbol ff_cos_256; recompile with -fPIC
      >>> defined in D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a(fft_float.o)
      >>> referenced by asm.S:494 (./libavutil/aarch64\asm.S:494)
      >>>               fft_neon.o:(fft256_neon) in archive D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a
      
      ld: error: can't create dynamic relocation R_AARCH64_ADD_ABS_LO12_NC against symbol: ff_cos_256 in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
      >>> defined in D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a(fft_float.o)
      >>> referenced by asm.S:494 (./libavutil/aarch64\asm.S:494)
      >>>               fft_neon.o:(fft256_neon) in archive D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a
      
      ld: error: relocation R_AARCH64_ADR_PREL_PG_HI21 cannot be used against symbol ff_cos_512; recompile with -fPIC
      >>> defined in D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a(fft_float.o)
      >>> referenced by asm.S:495 (./libavutil/aarch64\asm.S:495)
      >>>               fft_neon.o:(fft512_neon) in archive D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a
      
      ld: error: can't create dynamic relocation R_AARCH64_ADD_ABS_LO12_NC against symbol: ff_cos_512 in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
      >>> defined in D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a(fft_float.o)
      >>> referenced by asm.S:495 (./libavutil/aarch64\asm.S:495)
      >>>               fft_neon.o:(fft512_neon) in archive D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a
      
      ld: error: relocation R_AARCH64_ADR_PREL_PG_HI21 cannot be used against symbol ff_cos_1024; recompile with -fPIC
      >>> defined in D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a(fft_float.o)
      >>> referenced by asm.S:496 (./libavutil/aarch64\asm.S:496)
      >>>               fft_neon.o:(fft1024_neon) in archive D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a
      
      ld: error: can't create dynamic relocation R_AARCH64_ADD_ABS_LO12_NC against symbol: ff_cos_1024 in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
      >>> defined in D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a(fft_float.o)
      >>> referenced by asm.S:496 (./libavutil/aarch64\asm.S:496)
      >>>               fft_neon.o:(fft1024_neon) in archive D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a
      
      ld: error: relocation R_AARCH64_ADR_PREL_PG_HI21 cannot be used against symbol ff_cos_2048; recompile with -fPIC
      >>> defined in D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a(fft_float.o)
      >>> referenced by asm.S:497 (./libavutil/aarch64\asm.S:497)
      >>>               fft_neon.o:(fft2048_neon) in archive D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a
      
      ld: error: can't create dynamic relocation R_AARCH64_ADD_ABS_LO12_NC against symbol: ff_cos_2048 in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
      >>> defined in D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a(fft_float.o)
      >>> referenced by asm.S:497 (./libavutil/aarch64\asm.S:497)
      >>>               fft_neon.o:(fft2048_neon) in archive D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a
      
      ld: error: relocation R_AARCH64_ADR_PREL_PG_HI21 cannot be used against symbol ff_cos_4096; recompile with -fPIC
      >>> defined in D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a(fft_float.o)
      >>> referenced by asm.S:498 (./libavutil/aarch64\asm.S:498)
      >>>               fft_neon.o:(fft4096_neon) in archive D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a
      
      ld: error: can't create dynamic relocation R_AARCH64_ADD_ABS_LO12_NC against symbol: ff_cos_4096 in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
      >>> defined in D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a(fft_float.o)
      >>> referenced by asm.S:498 (./libavutil/aarch64\asm.S:498)
      >>>               fft_neon.o:(fft4096_neon) in archive D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a
      
      ld: error: relocation R_AARCH64_ADR_PREL_PG_HI21 cannot be used against symbol ff_cos_8192; recompile with -fPIC
      >>> defined in D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a(fft_float.o)
      >>> referenced by asm.S:499 (./libavutil/aarch64\asm.S:499)
      >>>               fft_neon.o:(fft8192_neon) in archive D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a
      
      ld: error: can't create dynamic relocation R_AARCH64_ADD_ABS_LO12_NC against symbol: ff_cos_8192 in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
      >>> defined in D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a(fft_float.o)
      >>> referenced by asm.S:499 (./libavutil/aarch64\asm.S:499)
      >>>               fft_neon.o:(fft8192_neon) in archive D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a
      
      ld: error: relocation R_AARCH64_ADR_PREL_PG_HI21 cannot be used against symbol ff_cos_16384; recompile with -fPIC
      >>> defined in D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a(fft_float.o)
      >>> referenced by asm.S:500 (./libavutil/aarch64\asm.S:500)
      >>>               fft_neon.o:(fft16384_neon) in archive D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a
      
      ld: error: can't create dynamic relocation R_AARCH64_ADD_ABS_LO12_NC against symbol: ff_cos_16384 in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
      >>> defined in D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a(fft_float.o)
      >>> referenced by asm.S:500 (./libavutil/aarch64\asm.S:500)
      >>>               fft_neon.o:(fft16384_neon) in archive D:\gstreamer\gstreamer-1.0-android-universal-1.20.1\arm64/lib\libavcodec.a
      
      ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
      

      I tried to put -fPIC argument inside each steps of my android build steps but the argument is never known, I don't know where to put it.

      My build steps are :

      • qmake: qmake.exe App.pro
      • Make: make.exe -j12 in D:\Qt_Projects\App
      • Make install: Copy App Files to D:\Qt_Projects\App\android-build
      • Build Android APK

      Qt Creator version : 7.0.2, Qt version : 5.15.9, OS : Windows 10.

      Do you have an idea ?

      Update :
      The second issue appears when I try to build a plugin. In the generated Makefile of this subproject, it is possible to see the -fPIC argument :

      CFLAGS        = -target aarch64-linux-android21 -fno-limit-debug-info -fPIC -fstack-protector-strong -DANDROID -g -fPIC -Wall -W -D_REENTRANT $(DEFINES)
      CXXFLAGS      = -target aarch64-linux-android21 -fno-limit-debug-info -fPIC -fstack-protector-strong -DANDROID -pthread -g -fPIC -std=gnu++2a -D_REENTRANT $(DEFINES)
      
      1 Reply Last reply Reply Quote 0
      • First post
        Last post