[issue21122] CPython fails to build modules with LLVM LTO on Mac OS

Jonas Wagner report at bugs.python.org
Tue Apr 1 14:11:00 CEST 2014


New submission from Jonas Wagner:

CPython fails to build with LLVM's link-time optimization (LTO) in Mac OS. Very similar commands work on Linux.

I'm currently configuring CPython as follows:

on Linux:
RANLIB="ar -s --plugin=/path/to/llvm/lib/LLVMgold.so" CC=/path/to/llvm/bin/clang CXX=/path/to/llvm/bin/clang++ CFLAGS="-g -flto" LDFLAGS="-flto" ./configure

on Mac OS:
CC=/path/to/llvm/bin/clang CXX=/path/to/llvm/bin/clang++ CFLAGS="-g -flto" LDFLAGS="-flto" ./configure

The RANLIB variable should not be needed on Mac, because its toolchain does not need a GOLD plugin.

On Linux, the above builds correctly and passes most of the test suite. On Mac, I receive the following error (similar for other extensions):

building '_scproxy' extension
/usr/bin/clang -Wno-unused-result -Werror=declaration-after-statement -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -g -flto -I../cpython/Include -I. -I/usr/local/include -I../cpython/Include -I../cpython-lto-build -c ../cpython/Modules/_scproxy.c -o build/temp.macosx-10.9-x86_64-3.5/path/to/cpython/Modules/_scproxy.o
/usr/bin/clang -bundle -undefined dynamic_lookup -flto build/temp.macosx-10.9-x86_64-3.5/path/to/cpython/Modules/_scproxy.o -L/usr/local/lib -o build/lib.macosx-10.9-x86_64-3.5/_scproxy.so -framework SystemConfiguration -framework CoreFoundation
*** WARNING: renaming "_scproxy" since importing it failed: dlopen(build/lib.macosx-10.9-x86_64-3.5/_scproxy.so, 2): Symbol not found: __Py_NoneStruct
  Referenced from: build/lib.macosx-10.9-x86_64-3.5/_scproxy.so
  Expected in: flat namespace
 in build/lib.macosx-10.9-x86_64-3.5/_scproxy.so

----------
components: Extension Modules
messages: 215307
nosy: Sjlver
priority: normal
severity: normal
status: open
title: CPython fails to build modules with LLVM LTO on Mac OS
type: compile error
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21122>
_______________________________________


More information about the Python-bugs-list mailing list