Re: Compile error while building postgresql 10.3

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Terry Phelps <tgphelps50(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: Compile error while building postgresql 10.3
Date: 2018-03-19 19:29:06
Message-ID: 13506.1521487746@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-hackers

Terry Phelps <tgphelps50(at)gmail(dot)com> writes:
> Just for fun, I am trying to build postgres from source on FreeBSD 11. Yes,
> I know I don't need to, and I have already installed the 10.3 server and
> client packages, and they run fine. I did a 'git clone' today, and have
> hours-old source code.

FWIW, development-code issues generally belong on -hackers, so forwarding
this there.

> So, I install the prereqs, and did a 'configure' and 'make', and expected
> it to 'just work'. However, I get this compile error:

> cc -I/usr/local/include -I../../src/port -DFRONTEND -I../../src/include
> -c -o pg_crc32c_sse42.o pg_crc32c_sse42.c
> pg_crc32c_sse42.c:37:18: error: always_inline function '_mm_crc32_u64'
> requires
> target feature 'ssse3', but would be inlined into function
> 'pg_comp_crc32c_sse42' that is compiled without support for 'ssse3'
> crc = (uint32) _mm_crc32_u64(crc, *((const uint64 *) p));
> ^
> pg_crc32c_sse42.c:44:9: error: always_inline function '_mm_crc32_u32'
> requires
> target feature 'ssse3', but would be inlined into function
> 'pg_comp_crc32c_sse42' that is compiled without support for 'ssse3'
> crc = _mm_crc32_u32(crc, *((const unsigned int *) p));
> ^
> pg_crc32c_sse42.c:63:9: error: always_inline function '_mm_crc32_u8'
> requires
> target feature 'ssse3', but would be inlined into function
> 'pg_comp_crc32c_sse42' that is compiled without support for 'ssse3'
> crc = _mm_crc32_u8(crc, *p);
> ^
> 3 errors generated.
>
> I googled, and search the archives, and don't see anything applicable. My C
> compiler is:
> $ cc --version
> FreeBSD clang version 4.0.0 (tags/RELEASE_400/final 297347) (based on LLVM
> 4.0.0)
> Target: x86_64-unknown-freebsd11.1
> Thread model: posix

Huh. Apparently that compiler is stricter about the use of "ssse3" than
anything we've tested this code on before.

It's interesting that your "cc" line for pg_crc32c_sse42.c shows no sign
of any added options for SSE4.2 compiler intrinsics, which seems to be
what's needed here. The configure script is supposed to detect whether
such options are needed, but it looks like it failed to do so correctly.
Can you look into config.log and see what happened corresponding to this
bit of configure.in?

# Check for Intel SSE 4.2 intrinsics to do CRC calculations.
#
# First check if the _mm_crc32_u8 and _mm_crc32_u64 intrinsics can be used
# with the default compiler flags. If not, check if adding the -msse4.2
# flag helps. CFLAGS_SSE42 is set to -msse4.2 if that's required.
PGAC_SSE42_CRC32_INTRINSICS([])
if test x"$pgac_sse42_crc32_intrinsics" != x"yes"; then
PGAC_SSE42_CRC32_INTRINSICS([-msse4.2])
fi
AC_SUBST(CFLAGS_SSE42)

regards, tom lane

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2018-03-19 19:50:10 Re: Compile error while building postgresql 10.3
Previous Message Terry Phelps 2018-03-19 19:10:35 Compile error while building postgresql 10.3

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeremy Finzel 2018-03-19 19:37:24 Re: found xmin from before relfrozenxid on pg_catalog.pg_authid
Previous Message Arthur Zakirov 2018-03-19 19:18:32 Re: [PROPOSAL] Shared Ispell dictionaries