Bug 230064 - databases/py-psycopg2: does not build with python 3.7
Summary: databases/py-psycopg2: does not build with python 3.7
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Po-Chuan Hsieh
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-26 17:10 UTC by Dmitry Marakasov
Modified: 2018-09-06 22:07 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (sunpoet)


Attachments
Patch (684 bytes, patch)
2018-07-26 17:11 UTC, Dmitry Marakasov
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry Marakasov freebsd_committer freebsd_triage 2018-07-26 17:10:25 UTC
---
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.
Comment 1 Dmitry Marakasov freebsd_committer freebsd_triage 2018-07-26 17:11:24 UTC
Created attachment 195483 [details]
Patch
Comment 2 Matt Smith 2018-08-02 21:59:14 UTC
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.
Comment 3 Kamigishi Rei 2018-08-15 12:40:35 UTC
(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.
Comment 4 commit-hook freebsd_committer freebsd_triage 2018-08-26 18:42:46 UTC
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
Comment 5 Po-Chuan Hsieh freebsd_committer freebsd_triage 2018-08-26 18:43:11 UTC
Committed. Thanks!
Comment 6 Matt Smith 2018-09-06 20:20:55 UTC
This has gone upstream now. https://github.com/psycopg/psycopg2/commit/0bea06f51375e9781b27d67436a0b42b69a62e02
Comment 7 Po-Chuan Hsieh freebsd_committer freebsd_triage 2018-09-06 22:07:03 UTC
(In reply to Matt Smith from comment #6)

That's great. The local patch can be removed when new release lands.