Opened 4 years ago

Closed 3 years ago

#62051 closed defect (fixed)

qt5*-qtbase: error: redefinition of '__bsrd' as different kind of symbol

Reported by: chrstphrchvz (Christopher Chavez) Owned by: MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)
Priority: Normal Milestone:
Component: ports Version: 2.6.4
Keywords: Cc:
Port: phantomjs-qt-qtbase qt57-qtbase qt56-qtbase qt55-qtbase

Description

The fix for #59364 does not also work for Xcode 11.4 and newer (example error log):

In file included from /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_aqua_qt57/qt57-qtbase/work/qtbase-opensource-src-5.7.1/src/corelib/codecs/qutfcodec.cpp:46:
In file included from /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_aqua_qt57/qt57-qtbase/work/qtbase-opensource-src-5.7.1/include/QtCore/5.7.1/QtCore/private/qsimd_p.h:1:
/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_aqua_qt57/qt57-qtbase/work/qtbase-opensource-src-5.7.1/include/QtCore/5.7.1/QtCore/private/../../../../../src/corelib/tools/qsimd_p.h:469:33: error: redefinition of '__bsrd' as different kind of symbol
static Q_ALWAYS_INLINE unsigned _bit_scan_reverse(unsigned val)
                                ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.3/include/ia32intrin.h:73:30: note: expanded from macro '_bit_scan_reverse'
#define _bit_scan_reverse(A) __bsrd((A))
                             ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.3/include/ia32intrin.h:47:1: note: previous definition is here
__bsrd(int __A) {
^

The fix tried to use Q_CC_CLANG to detect clang 9.0 and newer, but qcompilerdetection.h lacks mapping of more recent Xcode versions to upstream clang, so Q_CC_CLANG is defined too low of a value. It should be possible to update qcompilerdetection.h with the needed mapping (i.e. that Xcode 11.4 and newer are based on LLVM clang 9.0 and newer). Alternatives might be to test for intrinsics directly with #if defined(); or backport qtbase commit e70324f8dd, as done by fink for Qt 5.7.

(I personally do not need older Qt5 versions, but allowing them to build on more recent OSes may help with fixing build problems affecting all OSes, e.g. #60889.)

Change History (7)

comment:1 Changed 4 years ago by chrstphrchvz (Christopher Chavez)

Port: phantomjs-qt-qtbase added

comment:2 Changed 4 years ago by chrstphrchvz (Christopher Chavez)

Port: qt53-qtbase removed

qt53-qtbase is not affected as it does not build on macOS 10.15 or later, but for consistency I would still apply the fix for this issue to it.

comment:3 Changed 4 years ago by chrstphrchvz (Christopher Chavez)

PR opened using macro check approach: https://github.com/macports/macports-ports/pull/9695 (closed due to lack of testing) (reopened)

Last edited 3 years ago by chrstphrchvz (Christopher Chavez) (previous) (diff)

comment:4 Changed 4 years ago by kencu (Ken)

as building the older versions of qt5 is mainly relevant to the systems that need them, we'll have to confirm this patch works on the oldest and newest systems affected, and then we can infer the rest.

Please let us know if you need any help with that.

comment:5 in reply to:  3 Changed 3 years ago by chrstphrchvz (Christopher Chavez)

Replying to chrstphrchvz:

PR opened using macro check approach: https://github.com/macports/macports-ports/pull/9695 (closed due to lack of testing)

I have reopened the PR; at least two users have since reported needing the proposed patch. I had hoped that the approach used was sufficiently obvious/straightforward, so I leave it to others/those who insist to test on older macOS versions. If that remains an obstacle, then I will apply the patch only on the recent macOS versions that are affected by this issue.

comment:6 Changed 3 years ago by chrstphrchvz (Christopher Chavez)

This ticket may technically be a duplicate of #60985.

comment:7 Changed 3 years ago by chrstphrchvz (Christopher Chavez)

Resolution: fixed
Status: assignedclosed

In 8cebbb3b6ca2aee2e76119aa59bc3a7b9b0d786d/macports-ports (master):

qt5*-qtbase: fix build for Xcode 11.4 and later

Outdated Xcode-LLVM clang version mapping in qcompilerdetection.h
defines Q_CC_CLANG too low; check for _bit_scan_reverse() macro instead.
Due to lack of testing on older macOS versions, apply alternative patch
only on affected macOS versions (10.15 and later).
Fixes: #62051

Revise comment and reference to upstream clang commit to better reflect
why this problem appeared with clang 9.0 and not sooner.

Note: See TracTickets for help on using tickets.