Bug 231293 - devel/qt5-core: fails to build on armv7 after 5.11 update
Summary: devel/qt5-core: fails to build on armv7 after 5.11 update
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: arm Any
: --- Affects Only Me
Assignee: Jan Beich
URL:
Keywords: needs-patch, regression
Depends on:
Blocks: 230884
  Show dependency treegraph
 
Reported: 2018-09-10 20:38 UTC by Jan Beich
Modified: 2018-10-11 05:30 UTC (History)
4 users (show)

See Also:
bugzilla: maintainer-feedback? (kde)


Attachments
v0 (748 bytes, patch)
2018-09-10 21:16 UTC, Jan Beich
jbeich: maintainer-approval? (kde)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer 2018-09-10 20:38:11 UTC
$ poudriere jail -cj head-armv7 -x -a arm.armv7 -v head -m svn+https
$ poudriere testport -j head-armv7 devel/qt5-core
[...]
global/qfloat16.cpp:149:31: error: use of undeclared identifier 'vcvt_f16_f32'
        vst1_f16(out_f16 + i, vcvt_f16_f32(vld1q_f32(in + i)));
                              ^
global/qfloat16.cpp:159:28: error: use of undeclared identifier 'vcvt_f32_f16'
        vst1q_f32(out + i, vcvt_f32_f16(vld1_f16(in_f16 + i)));
                           ^
2 errors generated.

5.11.1 build log: https://ptpb.pw/Od03 (failure)
5.10.1 build log: https://ptpb.pw/XBSU (success)

My jail is a few months old running on amd64 host updated a few days ago:
$ c++ -v
FreeBSD clang version 6.0.1 (tags/RELEASE_601/final 335540) (based on LLVM 6.0.1)
Target: armv7-unknown-freebsd12.0-gnueabihf
Thread model: posix
InstalledDir: /nxb-bin/usr/bin
Comment 1 Jan Beich freebsd_committer 2018-09-10 21:16:59 UTC
Created attachment 197016 [details]
v0

Clang hides vcvt_f16_f32() and vcvt_f32_f16() behind (__ARM_FP & 2) where 2 refers to -mfpu=fp-armv8. However, GCC would only build this code if -march=armv8.2-a+fp16 is passed as well.

  $ clang60 -dM -E -</dev/null | fgrep __ARM_FP
  #define __ARM_FP 0xc
  #define __ARM_FP16_ARGS 1
  #define __ARM_FP16_FORMAT_IEEE 1

  $ clang60 -mfpu=fp-armv8 -dM -E -</dev/null | fgrep __ARM_FP
  #define __ARM_FP 0xe
  #define __ARM_FP16_ARGS 1
  #define __ARM_FP16_FORMAT_IEEE 1
  #define __ARM_FPV5__ 1

  $ gcc7 -dM -E -</dev/null | fgrep __ARM_FP
  #define __ARM_FP 12

  $ gcc7 -mfpu=fp-armv8 -dM -E -</dev/null | fgrep __ARM_FP
  #define __ARM_FP 14

  $ gcc7 -march=armv8.2-a+fp16 -mfpu=fp-armv8 -dM -E -</dev/null | fgrep __ARM_FP
  #define __ARM_FP 14
  #define __ARM_FP16_FORMAT_IEEE 1
  #define __ARM_FP16_ARGS 1

build log: https://ptpb.pw/MxS9
Comment 2 Jan Beich freebsd_committer 2018-09-10 21:45:17 UTC
(In reply to Jan Beich from comment #1)
> -mfpu=fp-armv8

Or -mfpu=neon-vfpv4 or -mfpu=neon-fp16.

> -march=armv8.2-a+fp16

Or -mfp16-format=ieee (GCC-only)
Comment 3 mikael.urankar 2018-09-11 10:04:06 UTC
(In reply to Jan Beich from comment #1)

(__ARM_FP & 2) refers to half precision support [1]


gcc6 and gcc7 doesn't define __ARM_FP16_FORMAT_IEEE
gcc7 -dM -E - < /dev/null | grep __ARM_FP16_FORMAT_IEEE

but clang does:
cc -dM -E - < /dev/null | grep __ARM_FP16_FORMAT_IEEE
#define __ARM_FP16_FORMAT_IEEE 1


from [2]:
The __fp16 type denotes half-precision (16-bit) floating-point.
The recommended way to test for this hardware support is to test bit 1 in __ARM_FP
and
If 16-bit floating-point is available, one of __ARM_FP16_FORMAT_IEEE and
__ARM_FP16_FORMAT_ALTERNATIVE will be defined to indicate the format in use

could it be a clang bug?


[1] http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0774g/chr1383660321827.html
[2] http://infocenter.arm.com/help/topic/com.arm.doc.ihi0053c/IHI0053C_acle_2_0.pdf
Comment 4 Jan Beich freebsd_committer 2018-09-11 10:57:27 UTC
What platforms upstream tests on? Looking at https://codereview.qt-project.org/208522 someone has tested on Linux/armv7/GCC where the conditional expands to #else branch.
Comment 5 commit-hook freebsd_committer 2018-10-10 21:59:43 UTC
A commit references this bug:

Author: jbeich
Date: Wed Oct 10 21:58:42 UTC 2018
New revision: 481772
URL: https://svnweb.freebsd.org/changeset/ports/481772

Log:
  devel/qt5-core: unbreak on armv7 after r479286

  global/qfloat16.cpp:149:31: error: use of undeclared identifier 'vcvt_f16_f32'
          vst1_f16(out_f16 + i, vcvt_f16_f32(vld1q_f32(in + i)));
                                ^
  global/qfloat16.cpp:159:28: error: use of undeclared identifier 'vcvt_f32_f16'
          vst1q_f32(out + i, vcvt_f32_f16(vld1_f16(in_f16 + i)));
                             ^

  PR:		231293
  Approved by:	maintainer timeout (1 month)

Changes:
  head/devel/qt5-core/files/patch-src_corelib_global_qfloat16.cpp
Comment 6 commit-hook freebsd_committer 2018-10-10 22:00:46 UTC
A commit references this bug:

Author: jbeich
Date: Wed Oct 10 22:00:25 UTC 2018
New revision: 481773
URL: https://svnweb.freebsd.org/changeset/ports/481773

Log:
  MFH: r481772

  devel/qt5-core: unbreak on armv7 after r479286

  global/qfloat16.cpp:149:31: error: use of undeclared identifier 'vcvt_f16_f32'
          vst1_f16(out_f16 + i, vcvt_f16_f32(vld1q_f32(in + i)));
                                ^
  global/qfloat16.cpp:159:28: error: use of undeclared identifier 'vcvt_f32_f16'
          vst1q_f32(out + i, vcvt_f32_f16(vld1_f16(in_f16 + i)));
                             ^

  PR:		231293
  Approved by:	maintainer timeout (1 month)
  Approved by:	ports-secteam blanket

Changes:
_U  branches/2018Q4/
  branches/2018Q4/devel/qt5-core/files/patch-src_corelib_global_qfloat16.cpp
Comment 7 Jan Beich freebsd_committer 2018-10-10 22:02:50 UTC
We can't just wait on maintainer forever. FreeBSD 12.0-RELEASE will have binary packages for armv7 from 2018Q4 snapshot. And this port blocks many others.
Comment 8 Tobias C. Berner freebsd_committer 2018-10-11 05:30:18 UTC
Thanks