Misc/python-config.in returns a bad library order when given the --ldflags or --libs arguments. A library should be listed *BEFORE* those libraries that it depends upon. The python library depends upon all the other libraries listed, but it is listed last -- it should be first. When linking with shared libraries, you can generally get away with the current behaviour. When linking with static libraries, it fails
It seems that this is still reproducible with Python 3.5 (dev) by running: $ gcc test.c `python3-config --includes --ldflags` cpython-install/lib/python3.5/config-3.5m/libpython3.5m.a(pytime.o): In function `_PyTime_ObjectToTime_t': cpython-build/../cpython/Python/pytime.c:371: undefined reference to `ceil' cpython-build/../cpython/Python/pytime.c:373: undefined reference to `floor' ... skipped ... I have slightly revised the patch to include Misc/python-config.sh.in as well. Please have a look. Thanks.