clang, i386 and SSE2

Jan Beich jbeich at FreeBSD.org
Sun Nov 11 12:18:25 UTC 2018


Palle Girgensohn <girgen at FreeBSD.org> writes:

>> 11 nov. 2018 kl. 12:21 skrev Jan Beich <jbeich at FreeBSD.org>:
>> 
>> Palle Girgensohn <girgen at FreeBSD.org> writes:
>> 
>> 
>>>> Log URL:        http://beefy10.nyi.freebsd.org/data/112i386-default/484565/logs/postgresql95-client-9.5.15_1.log
>> [...]
>>>> checking whether the C compiler still works... yes
>>>> configure: error: Compiling PostgreSQL with clang, on 32bit x86, requires SSE2 support. Use -msse2 or use gcc.
>>>> ===>  Script "configure" failed unexpectedly.
>>> 
>>> Can someone shed some light on this error. It can't be reproduced when
>>> cross compiling using poudriere on an amd64 hardware. "It just works"
>>> for me.
>> 
>> Can you share a poudriere build log for successful build? Maybe you have
>> CPUTYPE defined in make.conf e.g., CPUTYPE >= pentium4 implies SSE2.
>> 
>> 11.2 i386 jail on 13.0 amd64 host fails here as well: https://ptpb.pw/n8lF <https://ptpb.pw/n8lF>
>
> Enclosed is the build log for 11.2-i386 crossbuilt with an amd64 kernel and hardware.
[...]
> building for: FreeBSD 112-i386-default 11.2-RELEASE-p4 FreeBSD 11.2-RELEASE-p4 amd64
[...]
> ARCH=amd64
[...]
> checking build system type... amd64-portbld-freebsd11.2
> checking host system type... amd64-portbld-freebsd11.2

Looks like your 112-i386 jail actually targets amd64.

>>> How do I fix this without breaking for CPU's that don't support sse2
>> 
>> By researching upstream rationale: in code comment, upstream commit and
>> associated bug(s). If Clang on FreeBSD is not affected comment out the
>> configure error, otherwise switch to USES=compiler:gcc-c++11-lib.
>
> It seems at first that a simple fix would be to just add -msse2 to
> CFLAGS, but that seems deceptive since it would still fail on CPUs
> that don't support SSE2, rigth?

It's not a fix. When -msse2 is passed the compiler is allowed to inject
SSE2 code as part of auto-vectorization.

I'm not sure why you've dismissed using GCC as a workaround.


More information about the freebsd-ports mailing list