[issue28015] configure --with-lto builds fail when CC=clang on Linux, requires gold linker

Gregory P. Smith report at bugs.python.org
Thu Sep 8 03:45:09 EDT 2016


New submission from Gregory P. Smith:

The error message you will see when building may look something like:

clang -pthread -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes  -fprofile-instr-generate -flto Parser/acceler.o Parser/grammar1.o Parser/listnode.o Parser/node.o Parser/parser.o Parser/bitset.o Parser/metagrammar.o Parser/firstsets.o Parser/grammar.o Parser/pgen.o Objects/obmalloc.o Python/dynamic_annotations.o Python/mysnprintf.o Python/pyctype.o Parser/tokenizer_pgen.o Parser/printgrammar.o Parser/parsetok_pgen.o Parser/pgenmain.o -lpthread -ldl  -lutil -o Parser/pgen
/usr/bin/ld: /usr/lib/llvm-3.8/bin/../lib/LLVMgold.so: error loading plugin: /usr/lib/llvm-3.8/bin/../lib/LLVMgold.so: cannot open shared object file: No such file or directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:793: recipe for target 'Parser/pgen' failed
make[2]: *** [Parser/pgen] Error 1

as seen on ubuntu 16.04.

Related to https://bugs.launchpad.net/ubuntu/+source/llvm-toolchain-snapshot/+bug/1254970 which suggests we also need -B/usr/lib/gold-ld in our LDFLAGS and/or CFLAGS when using clang on Linux with LTO.

testing with it set in both still runs into errors; someone with clang LTO experience will need to untangle this.

(is this related to why --with-lto doesn't work on MacOS as well?)

----------
components: Build
messages: 274984
nosy: gregory.p.smith
priority: normal
severity: normal
stage: needs patch
status: open
title: configure --with-lto builds fail when CC=clang on Linux, requires gold linker
type: compile error
versions: Python 2.7, Python 3.5, Python 3.6

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


More information about the Python-bugs-list mailing list