This project is archived and is in readonly mode.

#127 ✓resolved
Psycopg website

psycopg2 extension fails to compile with clang

Reported by Psycopg website | September 19th, 2012 @ 03:57 PM

Submitted by: Bradley Saulteaux

building 'psycopg2._psycopg' extension

clang -march=corei7-avx -O3 -ffast-math -fPIC -Wimplicit -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.5 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090200 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/local/include/pypy1.9 -I. -I/usr/local/include -I/usr/local/include/postgresql/server -c psycopg/psycopgmodule.c -o build/temp.freebsd-9.0-RELEASE-amd64-2.7/psycopg/psycopgmodule.o

In file included from psycopg/psycopgmodule.c:27:

In file included from ./psycopg/psycopg.h:33:

./psycopg/config.h:146:15: error: static declaration of 'round' follows non-static declaration

static double round(double num)


/usr/include/math.h:273:8: note: previous declaration is here

double round(double);


psycopg/psycopgmodule.c:544:37: warning: incompatible pointer types passing 'PyTypeObject ' (aka 'struct _typeobject ') to parameter of type 'PyObject ' (aka 'struct _object ') [-Wincompatible-pointer-types]

if (!(descr = PyDescr_NewMethod((PyTypeObject *)Error,


/usr/local/include/pypy1.9/pypy_decl.h:70:52: note: passing argument to parameter 'arg0' here

PyAPI_FUNC(PyObject ) PyDescr_NewMethod(PyObject arg0, PyMethodDef *arg1);


1 warning and 1 error generated.

error: command 'clang' failed with exit status 1

Comments and changes to this ticket

  • Daniele Varrazzo

    Daniele Varrazzo September 19th, 2012 @ 05:48 PM

    • State changed from “new” to “open”

    Provide a patch then. You are the clang user.

  • Daniele Varrazzo

    Daniele Varrazzo September 19th, 2012 @ 11:15 PM

    I've tried installing clang on ubuntu and compiling psycopg and found no problem (I was signaled a warning unrelated to what you have reported here, and I'm working on fixing that).

    It must be something related to your platform, not strictly to clang. As it is now we cannot debug it. Either you will have to fix yourself or provide us an ssh access to a box to test it.

  • Daniele Varrazzo

    Daniele Varrazzo October 9th, 2012 @ 12:05 AM

    • State changed from “open” to “hold”
    • Tag changed from rel-2.4.5 to clang, rel-2.4.5

    We have had other people compiling psycopg2 on clang and they have reported success. Putting the issue on hold until further details are provided.

  • Andy Hooper

    Andy Hooper December 16th, 2012 @ 04:51 PM

    I got this error when building with pkgsrc gcc on Solaris. Modifying the #if to omit defining round got me a successful build.

  • Daniele Varrazzo

    Daniele Varrazzo May 6th, 2013 @ 09:23 AM

    • State changed from “hold” to “resolved”

    This must have gone with the last solaris patches in master.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

<b>WARNING:</b> the informations in this tracker are archived. Please submit new tickets or comments to <a href="">the new tracker</a>.
Psycopg is the most used PostgreSQL adapter for the Python programming language. At the core it fully implements the Python DB API 2.0 specifications. Several extensions allow access to many of the features offered by PostgreSQL.

Shared Ticket Bins