Building qt5-gui port?

Mark Millard marklmi at yahoo.com
Sun Feb 10 23:14:29 UTC 2019



On 2019-Feb-10, at 10:43, Steve Kargl <sgk at troutmask.apl.washington.edu> wrote:

> On Sun, Feb 10, 2019 at 10:32:50AM -0800, Steve Kargl wrote:
>> On Sun, Feb 10, 2019 at 10:24:43AM -0800, Mark Millard wrote:
>>> 
>>> My reference to building for armv7 not having a problem in
>>> my builds is an example of a 32-bit-target context for
>>> qt5-gui. So i386 specific or some other aspect of how its
>>> build was attempted might be involved in your context.
>>> 
>> 
>> Do you use -march=native -mtune=native with clang in
>> freebsd-current on all those architectures?
>> 
>> I can build qt5-gui with "-march=i486", "-march=i686"
>> "-march=i686 -mmmx", "-march=i686 -mmmx -msse".  I'll
>> be adding each of -msse2, -msse3, -mssse3, -mcx16,
>> -mfxsr, and -msahf to CFLAGS to see which one is causing
>> the problem.
>> 
>> If adding all of the -target-feature options turned on
>> by core2 work with i686, I'll then up i686 and repeat.
>> 
> 
> Well that was quick.  Adding -msse2 to CFLAGS causes
> qt5-gui to die.

I accidentally replied to the wrong (but releated?) message,
generating:

https://lists.freebsd.org/pipermail/freebsd-toolchain/2019-February/004323.html

with the following information (with a little added here at
the end):

/usr/ports/Mk/Uses/qt-dist.mk has:

.    if ${ARCH} == i386 && empty(MACHINE_CPU:Msse2)
CONFIGURE_ARGS+=        -no-sse2
.    endif

This traces back to:

/usr/src/share/mk/bsd.cpu.mk and its:

. elif ${MACHINE_CPUARCH} == "amd64"
MACHINE_CPU = amd64 sse2 sse mmx
. elif ${MACHINE_CPUARCH} == "arm"
MACHINE_CPU = arm
. elif ${MACHINE_CPUARCH} == "i386"
MACHINE_CPU = i486

and (I'll not list it all):

########## i386
. if ${MACHINE_CPUARCH} == "i386"
.  if ${CPUTYPE} == "znver1"
MACHINE_CPU = avx2 avx sse42 sse41 ssse3 sse4a sse3 sse2 sse mmx k6 k5 i586
.  elif ${CPUTYPE} == "bdver4"
MACHINE_CPU = xop avx2 avx sse42 sse41 ssse3 sse4a sse3 sse2 sse mmx k6 k5 i586
.  elif ${CPUTYPE} == "bdver3" || ${CPUTYPE} == "bdver2" || \
  ${CPUTYPE} == "bdver1"
MACHINE_CPU = xop avx sse42 sse41 ssse3 sse4a sse3 sse2 sse mmx k6 k5 i586
.  elif ${CPUTYPE} == "btver2"
MACHINE_CPU = avx sse42 sse41 ssse3 sse4a sse3 sse2 sse mmx k6 k5 i586
.  elif ${CPUTYPE} == "btver1"
MACHINE_CPU = ssse3 sse4a sse3 sse2 sse mmx k6 k5 i586
.  elif ${CPUTYPE} == "amdfam10"
MACHINE_CPU = athlon-xp athlon k7 3dnow sse4a sse3 sse2 sse mmx k6 k5 i586
.  elif ${CPUTYPE} == "opteron-sse3" || ${CPUTYPE} == "athlon64-sse3"
MACHINE_CPU = athlon-xp athlon k7 3dnow sse3 sse2 sse mmx k6 k5 i586
.  elif ${CPUTYPE} == "opteron" || ${CPUTYPE} == "athlon64" || \

. . .

and:

########## amd64
. elif ${MACHINE_CPUARCH} == "amd64"
.  if ${CPUTYPE} == "znver1"
MACHINE_CPU = avx2 avx sse42 sse41 ssse3 sse4a sse3
. . .
.  endif
MACHINE_CPU += amd64 sse2 sse mmx
########## Mips
. elif ${MACHINE_CPUARCH} == "mips"


So it looks like freeBSD expects CPUTYPE to be set for i368 in order
to enable sse2 in MACHINE_CPU . Other things have a similar status
for amd64 but amd64 always has sse2 .



Looks like when native works and clang is in use, and the context
is amd64 (or i386), CPUTYPE could be generated by the likes of
(example from my amd64 context):

# sh -c "clang -v -fsyntax-only -march=native -x c /dev/null 2>&1 | grep -e '-target-cpu' | sed -e 's|.*-target-cpu \([[:alnum:]]*\) .*|\1|'"
znver1

(I got that command from https://forums.freebsd.org/threads/make-conf-optimizations-optimizing-builds.63461/ .)

Trying such on a cortex-a57 (aarch64) got an empty-string result.
Same for cortex-a53 (aarch64) and cortex-a7 (armv7). (I do not have
a powerpc* available at the moment.)

Those result from results like:

# clang -v -fsyntax-only -march=native -x c /dev/null 2>&1
FreeBSD clang version 7.0.1 (tags/RELEASE_701/final 349250) (based on LLVM 7.0.1)
Target: aarch64-unknown-freebsd13.0
Thread model: posix
InstalledDir: /usr/bin
clang: error: the clang compiler does not support '-march=native'


===
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)



More information about the freebsd-ports mailing list