I have just been painfully discovering that gcc apparently generates -fpic code by default and links with -fPIE by default (On ubuntu 17.04). This completely screws up thousands of tests I run with scripts and makefiles used by lots of different linux distros. Is there any global or per-user way to turn off these defaults and make the compiler backward compatible with the behavior it has had for decades? I'm not interested in tracking down every compilation in thousands of scripts that knows the default is not -fpic, etc. An environment variable or two perhaps?
I had the same problem and just solved it thanks to this post on Stack Overflow.
You should add
-no-pie
option to compilation command linewithout:
with: