Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 863950

Summary: dev-lang/python-3.10.6: ld.lld: error: cannot open /usr/lib/llvm/14/bin/../../../../lib/clang/14.0.6/lib/linux/libclang_rt.profile-x86_64.a: No such file or directory
Product: Gentoo Linux Reporter: HougeLangley <hougelangley1987>
Component: Current packagesAssignee: Python Gentoo Team <python>
Status: RESOLVED NEEDINFO    
Severity: normal CC: immoloism
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 408963    
Attachments: emerge full build log
Build info

Description HougeLangley 2022-08-06 09:16:53 UTC
Created attachment 798250 [details]
emerge full build log

I used musl/clang stage3 to build system. updating system in liveusb.

clang -shared   -Wl,-O1 -Wl,--as-needed -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind -Wl,--as-needed -flto -g -fprofile-instr-generate -o libpython3.10.so Modules/getbuildinfo.o Parser/token.o  Parser/pegen.o Parser/parser.o Parser/string_parser.o Parser/peg_api.o Parser/myreadline.o Parser/tokenizer.o Objects/abstract.o Objects/accu.o Objects/boolobject.o Objects/bytes_methods.o Objects/bytearrayobject.o Objects/bytesobject.o Objects/call.o Objects/capsule.o Objects/cellobject.o Objects/classobject.o Objects/codeobject.o Objects/complexobject.o Objects/descrobject.o Objects/enumobject.o Objects/exceptions.o Objects/genericaliasobject.o Objects/genobject.o Objects/fileobject.o Objects/floatobject.o Objects/frameobject.o Objects/funcobject.o Objects/interpreteridobject.o Objects/iterobject.o Objects/listobject.o Objects/longobject.o Objects/dictobject.o Objects/odictobject.o Objects/memoryobject.o Objects/methodobject.o Objects/moduleobject.o Objects/namespaceobject.o Objects/object.o Objects/obmalloc.o Objects/picklebufobject.o Objects/rangeobject.o Objects/setobject.o Objects/sliceobject.o Objects/structseq.o Objects/tupleobject.o Objects/typeobject.o Objects/unicodeobject.o Objects/unicodectype.o Objects/unionobject.o Objects/weakrefobject.o Python/_warnings.o Python/Python-ast.o Python/asdl.o Python/ast.o Python/ast_opt.o Python/ast_unparse.o Python/bltinmodule.o Python/ceval.o Python/codecs.o Python/compile.o Python/context.o Python/dynamic_annotations.o Python/errors.o Python/frozenmain.o Python/future.o Python/getargs.o Python/getcompiler.o Python/getcopyright.o Python/getplatform.o Python/getversion.o Python/hamt.o Python/hashtable.o Python/import.o Python/importdl.o Python/initconfig.o Python/marshal.o Python/modsupport.o Python/mysnprintf.o Python/mystrtoul.o Python/pathconfig.o Python/preconfig.o Python/pyarena.o Python/pyctype.o Python/pyfpe.o Python/pyhash.o Python/pylifecycle.o Python/pymath.o Python/pystate.o Python/pythonrun.o Python/pytime.o Python/bootstrap_hash.o Python/structmember.o Python/symtable.o Python/sysmodule.o Python/thread.o Python/traceback.o Python/getopt.o Python/pystrcmp.o Python/pystrtod.o Python/pystrhex.o Python/dtoa.o Python/formatter_unicode.o Python/fileutils.o Python/suggestions.o Python/dynload_shlib.o    Modules/config.o Modules/getpath.o Modules/main.o Modules/gcmodule.o Modules/posixmodule.o  Modules/errnomodule.o  Modules/pwdmodule.o  Modules/_sre.o  Modules/_codecsmodule.o  Modules/_weakref.o  Modules/_functoolsmodule.o  Modules/_operator.o  Modules/_collectionsmodule.o  Modules/_abc.o  Modules/itertoolsmodule.o  Modules/atexitmodule.o  Modules/signalmodule.o  Modules/_stat.o  Modules/timemodule.o  Modules/_threadmodule.o  Modules/_localemodule.o  Modules/_iomodule.o Modules/iobase.o Modules/fileio.o Modules/bytesio.o Modules/bufferedio.o Modules/textio.o Modules/stringio.o  Modules/faulthandler.o  Modules/_tracemalloc.o  Modules/symtablemodule.o  Modules/xxsubtype.o Python/frozen.o   -ldl  -lm  -lm; \
fi
ld.lld: [0;31merror: [0mcannot open /usr/lib/llvm/14/bin/../../../../lib/clang/14.0.6/lib/linux/libclang_rt.profile-x86_64.a: No such file or directory
clang-14: [0;1;31merror: [0m[1mlinker command failed with exit code 1 (use -v to see invocation)[0m
ln: failed to access 'libpython3.10.so.1.0': No such file or directory
make[3]: *** [Makefile:654: libpython3.10.so] Error 1
make[3]: Leaving directory '/var/tmp/portage/dev-lang/python-3.10.6/work/Python-3.10.6'
make[2]: *** [Makefile:530: build_all_generate_profile] Error 2
make[2]: Leaving directory '/var/tmp/portage/dev-lang/python-3.10.6/work/Python-3.10.6'
make[1]: *** [Makefile:506: profile-gen-stamp] Error 2
make[1]: Leaving directory '/var/tmp/portage/dev-lang/python-3.10.6/work/Python-3.10.6'
make: *** [Makefile:518: profile-run-stamp] Error 2
 * ERROR: dev-lang/python-3.10.6::gentoo failed (compile phase):
 *   emake failed
Comment 1 HougeLangley 2022-08-06 09:17:30 UTC
emerge --info have to waite
Comment 2 HougeLangley 2022-08-06 09:26:29 UTC
Created attachment 798253 [details]
Build info
Comment 3 HougeLangley 2022-08-06 09:31:56 UTC
I know why, could not enable lto and pgo.
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-08-10 03:15:55 UTC
(In reply to HougeLangley from comment #3)
> I know why, could not enable lto and pgo.

?

I think you'll need some USE flags on e.g. compiler-rt (like USE=profile)
Comment 5 immolo 2022-12-26 19:31:18 UTC
I came across this while helping someone else and have confirmed this issue exists on a clang/musl system when the PGO flag is set for dev-lang/python.

This is caused when people are either mismatching versions of clang and compiler-rt-sanitzer and missing the dependency in the python ebuild so when running emerge -vauDN @world there is a chance python will merge before llvm/clang updates causing this (symlinking it fixes the issue and allows it to build as well).

I believe the solution is to add a BDEPEND in Python for when using clang with pgo useflag for sys-libs/compiler-rt sys-libs/compiler-rt-sanitizers, I have patch ready to go for the Python BDEP part but not sure what the best way to handle the mismatch of versions just yet so some feedback would be welcomed so I can PR this over (I'm on here and IRC so either is fine).

Steps to reproduce:

1. Install stage3-llvm-musl
2. Set USE="PGO"
3. emerge -va sys-libs/compiler-rt sys-libs/compiler-rt-sanitizers
4. emerge -va dev-lang/python

To fix from here:

1. ln -s /usr/lib/clang/15.0.6/lib/linux/libclang_rt.profile-x86_64.a /usr/lib/clang/15.0.5/lib/linux/libclang_rt.profile-x86_64.a
2. emerge -va dev-lang/python
Comment 6 immolo 2022-12-26 19:36:07 UTC
This most likely effects clang/glibc stage3 tarballs also FWIW.