Qt5.7 QtWebEngine and ARMv8 (RPi3)



  • QtWebEngine (and Chromium) seem to be slightly challenging to compile with ARMv8 (32-bit) settings.

    Raspberry Pi3 mkspecs define the processor flags as:

    QMAKE_CFLAGS            = -march=armv8-a -mtune=cortex-a53 -mfpu=crypto-neon-fp-armv8
    

    This seems to be the correct combination for the specific SoC. Compiling QtCore gives no complaints, but there are at least three different problems with QtWebEngine (two of them fatal from the build point of view).

    • specifying arm-version="8" will crash the compilation due to unknown architecture errors
    • the build system does not recognize crypto-neon-fp-armv8 as a NEON capable architecture (this will crash the linking complaining the lack of sk_cpu_arm_has_neon(), see SkUtilsArm.h in skia).
    • there are a lot of warnings about deprecated IT blocks in ARMv8

    I was able to compile QtWebEngine by patching qtwebengine/src/core/gyp_run.pro, but my patches are very ugly and do not really address the underlying problems.

    1. arm_version="8"

    The first problem is fixed by:

    lessThan(MARMV, 6): error("$$MARCH architecture is not supported")
    else: equals(MARMV, 7): GYP_CONFIG += arm_version=\"$$MARMV\"
    else: GYP_CONFIG += arm_version=\"7\"
    

    Now ARMv8 and higher will set arm_version="7", whereas the original code did set arm_version="8". (This should really be solved deeper down.)

    2. NEON support not detected

    The NEON problem is caused by the NEON detection in gyp_run.pro. The code can be patched by changing the detection conditions:

    contains(MFPU, "neon")|contains(MFPU, "neon-vfpv4")|contains(MFPU, "crypto-neon-fp-armv8")
    

    Now even the crypto-neon-fp-armv8 is recognized as a NEON capable processor. However, the detection method is still a bit flaky, as there are a number of other strings which should qualify here (as per the compiler ARM-specific flag descriptions).

    However, this could and possibly should be fixed in some other places, as well. ARMv8 processors are always NEON-capable, and thus the following lines in skia_common.gypi seem to be wrong:

        [ 'target_arch == "arm" and arm_version >= 7 and arm_neon == 0 and arm_neon_optional == 1', {
          'defines': [
            'SK_ARM_HAS_OPTIONAL_NEON',
          ],
        }],
      ],
    
    

    It does not seem to be completely clear where the problem should really be solved.

    3. Deprecated IT block warnings

    ARMv8 (in 32-bit mode) will accept any binary which is acceptable by ARMv7, so there cannot be any instructions which would not work. The warnings are about deprecated (not eliminated) machine code instructions. However, there are hundreds (thousands?) of these warnings during compilation, and possibly something should be done. The deprecated code is most probably inline assembly code, as the C compiler should not emit deprecated code.

    Questions

    Now we come to the tricky part. Everything compiles, but only with ugly tricks. So:

    • Is there anything Qt can or should do about this? Or should these just be reported to the Chromum people?
    • Should the architecture be set to ARMv7 even with RPi3 until the Chromium code is fixed?
    • If yes, is there a way to do it only for QtWebEngine (instead of the complete Qt distribution)
    • Or should we just decide that all RPi3 code is better compiled with RPi2 settings (this will leave some optimizations aside) and change the mkspec file accordingly?

  • Lifetime Qt Champion

    Hi,

    I'd recommend posting that question to the the QtWebEngine mailing list. You'll find there QtWebEngine's developers/maintainers. This forum is more user oriented.



Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.