--- In file included from psycopg/psycopgmodule.c:27: In file included from ./psycopg/psycopg.h:37: ./psycopg/config.h:164:15: error: static declaration of 'round' follows non-static declaration static double round(double num) ^ /usr/include/math.h:312:8: note: previous declaration is here double round(double); ^ 1 error generated. --- Full log: cc -DNDEBUG -O2 -pipe -fstack-protector -fno-strict-aliasing -I/usr/local/include -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION=2.7.5 (dt dec pq3 ext lo64) -DPG_VERSION_NUM=90513 -DHAVE_LO64=1 -I/usr/local/include/python3.7m -I. -I/usr/local/include -I/usr/local/include/postgresql/server -c psycopg/psycopgmodule.c -o build/temp.freebsd-11.2-RELEASE-amd64-3.7/psycopg/psycopgmodule.o This is easily fixed by removing the named round redefinition.
Created attachment 195483 [details] Patch
Thanks for this, it's nice to see that someone is seeing the same issue as me. But this looks like it should be the kind of thing changed in the upstream code? I install this in a virtualenv with python3.7 -m venv venv && venv/bin/pip install psycopg2. This worked fine with python 3.6 but fails with this error with python 3.7. Your patch will fix the port, but won't solve my own issue because I'll still be using the original upstream.
(In reply to Dmitry Marakasov from comment #1) The real reason behind this issue is that sys/param.h is not included, so __FreeBSD_version is undefined and the check passes by default.
A commit references this bug: Author: sunpoet Date: Sun Aug 26 18:42:33 UTC 2018 New revision: 478156 URL: https://svnweb.freebsd.org/changeset/ports/478156 Log: Fix build with Python 3.7 PR: 230064 Submitted by: amdmi3, Kamigishi Rei <spambox@haruhiism.net> Changes: head/databases/py-psycopg2/files/ head/databases/py-psycopg2/files/patch-psycopg-config.h
Committed. Thanks!
This has gone upstream now. https://github.com/psycopg/psycopg2/commit/0bea06f51375e9781b27d67436a0b42b69a62e02
(In reply to Matt Smith from comment #6) That's great. The local patch can be removed when new release lands.