At http://hg.python.org/cpython/file/1043cc2cb0ff/Lib/distutils/command/build_ext.py#l247 build_ext.py compares sys.executable against sys.exec_prefix. When cross compiling cpython, it notices that the interpreter running the build is located at exec_prefix and concludes that it is building a third-party module. Thus, it passes '-L{HOST_LIBDIR}', instead of '-L.', which breaks the build. The attached patch reverses the logic, checking if sys.executable resides in ${PWD} and assuming a third-party module otherwise. This should also fix http://bugs.python.org/issue16326