1

While trying to create a new Heroku Python (Django) app on Linux Mint I encounter following error when pip tries to install psycopg2

 x86_64-linux-gnu-gcc: error: unrecognized command line option ‘-fstack-protector-strong’
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

All dependencies are met (as explained in this question) so I don't see the problem here..

Community
  • 1
  • 1
DeBaze
  • 383
  • 1
  • 15

2 Answers2

8

I have found the solution. It might be helpful for others as I didn't really find the answer online..

1) The error originates from an outdated gcc version (4.8) on my system. This verion does not support the '-fstack-protector-...' command line option.

2) I installed a newer version (4.9) as follows:

$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test
$ sudo apt-get update
$ sudo apt-get install gcc-4.9

3) I removed the symlink x86_64-linux-gnu-gcc which was located in /usr/bin and replaced it with a symlink to the newly installed gcc-4.9 version

$ sudo rm x86_64-linux-gnu-gcc
$ sudo ln -s gcc-4.9 x86_64-linux-gnu-gcc

It took me a while to figure this out, I hope it helps others

DeBaze
  • 383
  • 1
  • 15
2

Can't upvote DeBaze's answer (not enough rep). I'm using Ubuntu 16.02.

I only needed to install the latest gcc and create the symlink ...

sudo apt-get install gcc-4.9
sudo ln -s gcc-4.9 x86_64-linux-gnu-gcc
user1738005
  • 131
  • 1
  • 1
  • 5