0

I'm on a shared hosting provider, trying to install psycopg2 in order to get Django up and running with psql.

I ran $ pip install psycopg2

and got following error

gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -O3 -Wall -Wstrict-prototypes 
-fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.5 (dt dec pq3 ext)" 
-DPG_VERSION_HEX=0x080205 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 
-DHAVE_PQFREEMEM=1 -I/home3/n/norcal/python/include/python2.7 -I. 
-I/usr/local/pgsql-8.2/include -I/usr/local/pgsql-8.2/include/server 
-c psycopg/psycopgmodule.c -o build/temp.linux-i686-2.7/psycopg/psycopgmodule.o 
-Wdeclaration-after-statement

cc1: error: unrecognized option `-Wdeclaration-after-statement'

error: command 'gcc' failed with exit status 1

I did some googling and found that I might be missing python-dev and libpq-dev, but I'm unable to find instructions on how to install those without aptitude - which I don't have access to on my shared hosting provider.

Any ideas?

Thanks a million in advance!

1 Answer 1

0

Problem is, that -Wdeclaration-after-statement isn't supported by your version of gcc.

A hacky solution is, to remove this unsupported option from the compile command. A better solution would be, to upgrade you gcc.

After you get this error, grep to find where declaration-after-statement is used:

$ grep -r "declaration-after-statement" ./virtual_env_dir
virtual_env_dir/build/psycopg2/setup.py: '-Wdeclaration-after-statement')

Edit the setup.py and comment the corresponding code-block:

''''
for extension in self.extensions: 
    extension.extra_compile_args.append(
        '-Wdeclaration-after-statement')
''''

Re-run the build via $ pip install psycopg2.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.