I am trying to compile a simple little hello world example to get a feel for Cython. It works, but the compilation is littered with flags that I do not want. Following the example here I was able to clean up most of the unwanted flags, but a few persist in spite of my best efforts to control the environment variables. The last comment in the linked question indicates that the extra flags might be bakes into the compiler by the vendor, but I have verified that this is unlikely by using several different compilers, all of which default to the same extra flags.
My call to setup.py looks like this:
CC="gcc" CXX="g++" OPT="" CFLAGS="-O3 -D_GNU_SOURCE" BASECFLAGS="" LDFLAGS="" CCSHARED="" LDSHARED="gcc -shared" PY_CORE_FLAGS="" PY_CFLAGS="" AR="" ARFLAGS="" CPPFLAGS="" CPP="" SHLIB_SUFFIX="" python3 setup.py build_ext --inplace
setup.py is very simple:
from setuptools import Extension, setup
from Cython.Build import cythonize
setup(
ext_modules = cythonize([Extension("hellotest", ["hellotest.pyx"])], language_level="3")
)
And finally, the output of gcc during the compilation, with the unwanted flags enclosed in square brackets:
gcc [-DNDEBUG -g -fwrapv -O2 -Wall] -O3 -D_GNU_SOURCE -fPIC -I./ -I. -I/usr/include/python3.6m -c hellotest.c -o build/temp.linux-x86_64-3.6/hellotest.o
gcc [-DNDEBUG -g -fwrapv -O2 -Wall] -O3 -D_GNU_SOURCE -fPIC -I./ -I. -I/usr/include/python3.6m -c ./funcs.c -o build/temp.linux-x86_64-3.6/./funcs.o
gcc -shared -O3 -D_GNU_SOURCE build/temp.linux-x86_64-3.6/hellotest.o build/temp.linux-x86_64-3.6/./funcs.o -o build/lib.linux-x86_64-3.6/hellotest.cpython-36m-x86_64-linux-gnu.so
Does anyone have any idea where they are finding their way into the compiler options?