Before the change to add arm to the --disable-spinlocks list the postgres build on arm would error with:
gmake[4]: Entering directory '/usr/pobj/postgresql-9.6.1/postgresql-9.6.1/src/backend/access/brin' cc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -O2 -pipe -I../../../../src/include -I/usr/local/include -I/usr/local/include/libxml2 -I/usr/local/include -c -o brin.o brin.c In file included from ../../../../src/include/storage/lwlock.h:22, from ../../../../src/include/storage/lock.h:23, from ../../../../src/include/access/heapam.h:22, from ../../../../src/include/nodes/execnodes.h:18, from ../../../../src/include/access/brin.h:14, from brin.c:18: ../../../../src/include/storage/s_lock.h:922:2: error: #error PostgreSQL does not have native spinlock support on this platform. To continue the compilation, rerun configure using --disable-spinlocks. However, performance will be poor. Please report this to pgsql-b...@postgresql.org. In file included from ../../../../src/include/storage/lwlock.h:22, from ../../../../src/include/storage/lock.h:23, from ../../../../src/include/access/heapam.h:22, from ../../../../src/include/nodes/execnodes.h:18, from ../../../../src/include/access/brin.h:14, from brin.c:18: ../../../../src/include/storage/s_lock.h:994: warning: type defaults to 'int' in declaration of 'slock_t' ../../../../src/include/storage/s_lock.h:994: error: expected ';', ',' or ')' before '*' token ../../../../src/include/storage/s_lock.h:1004: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'dummy_spinlock' ../../../../src/include/storage/s_lock.h:1009: warning: type defaults to 'int' in declaration of 'slock_t' ../../../../src/include/storage/s_lock.h:1009: error: expected ';', ',' or ')' before '*' token In file included from brin.c:23: ../../../../src/include/access/relscan.h:37: error: expected specifier-qualifier-list before 'slock_t' gmake[4]: *** [<builtin>: brin.o] Error 1 /* * On ARM and ARM64, we use __sync_lock_test_and_set(int *, int) if available. * * We use the int-width variant of the builtin because it works on more chips * than other widths. */ #if defined(__arm__) || defined(__arm) || defined(__aarch64__) || defined(__aarch64) #ifdef HAVE_GCC__SYNC_INT32_TAS #define HAS_TEST_AND_SET #define TAS(lock) tas(lock) typedef int slock_t; static __inline__ int tas(volatile slock_t *lock) { return __sync_lock_test_and_set(lock, 1); } #define S_UNLOCK(lock) __sync_lock_release(lock) #endif /* HAVE_GCC__SYNC_INT32_TAS */ #endif /* __arm__ || __arm || __aarch64__ || __aarch64 */ The arm specific path in the header isn't used as base gcc does not provide the atomic sync builtins on arm. Switch to ports gcc (which currently targets mpcore/armv6k) to get the armv6+ atomic builtins. ports llvm doesn't build on arm currently so that isn't an option. Index: Makefile =================================================================== RCS file: /cvs/ports/databases/postgresql/Makefile,v retrieving revision 1.220 diff -u -p -r1.220 Makefile --- Makefile 21 Dec 2016 07:43:57 -0000 1.220 +++ Makefile 21 Dec 2016 13:14:02 -0000 @@ -11,6 +11,7 @@ COMMENT-pg_upgrade=Support for upgrading # in case a dump before / restore after pkg_add -u is required! VERSION= 9.6.1 +REVISION= 0 DISTNAME= postgresql-${VERSION} PKGNAME-main= postgresql-client-${VERSION} PKGNAME-server= postgresql-server-${VERSION} @@ -48,9 +49,12 @@ USE_GROFF= Yes CONFIGURE_STYLE=gnu -MODULES= lang/python +MODULES= lang/python gcc4 MODPY_RUNDEP= No +# for __sync_lock_test_and_set +MODGCC4_ARCHS= arm + CONFIGURE_ENV= ac_cv_path_PYTHON=${MODPY_BIN} \ CPPFLAGS="-I${LOCALBASE}/include" \ LDFLAGS="-L${LOCALBASE}/lib" @@ -76,7 +80,7 @@ CONFIGURE_ARGS= --disable-rpath --with-o # a system to get this working, disable them for now. There is # (apparently) a serious performance hit doing this. -.if ${MACHINE_ARCH} == "hppa" || ${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH} == "arm" +.if ${MACHINE_ARCH} == "hppa" || ${MACHINE_ARCH} == "alpha" CONFIGURE_ARGS+=--disable-spinlocks .endif