Skip to content

Conversation

@zanieb
Copy link
Member

@zanieb zanieb commented Mar 19, 2025

It's not clear why we're not using this. Let's see what happens.

@zanieb zanieb added python:3.13 libc:musl platform:linux Specific to the Linux platform labels Mar 19, 2025
@zanieb
Copy link
Member Author

zanieb commented Mar 19, 2025

Well, that's a first problem

2025-03-19T22:14:54.8625163Z cpython-3.13> usage: build.py [-h] [-d] [-f] [-v] target
2025-03-19T22:14:54.8626404Z cpython-3.13> build.py: error: argument target: invalid get_target value: 'x86_64-unknown-linux-musl'
2025-03-19T22:14:54.8729341Z cpython-3.13> make[2]: *** [jit_stencils.h] Error 2
2025-03-19T22:14:54.8730619Z cpython-3.13> Makefile:2965: recipe for target 'jit_stencils.h' failed

resolved in db52d2b

@zanieb
Copy link
Member Author

zanieb commented Mar 19, 2025

2025-03-19T23:16:36.4962413Z cpython-3.13> musl-clang -L/tools/deps/lib -Wl,--exclude-libs,ALL -LModules/_hacl  -flto=thin -g -fprofile-instr-generate -Xlinker -export-dynamic -o python Programs/python.o -L. -lpython3.13 -ldl  -lpthread     -lbz2          -lffi -ldl  -lm  -lncursesw  -lpanelw -lncursesw   -ldb  -lmpdec  -lexpat  -lcrypto        -llzma       -lrt         -lsqlite3  -lssl -lcrypto            -ltcl8.6 -ltk8.6 -lX11 -lxcb -lXau   -luuid      -lm    -lm   -lexpat  -ledit -lncursesw        -lz                       -lm
2025-03-19T23:16:36.4971610Z cpython-3.13> musl-clang -L/tools/deps/lib -Wl,--exclude-libs,ALL -LModules/_hacl  -flto=thin -g -fprofile-instr-generate -Xlinker -export-dynamic -o Programs/_testembed Programs/_testembed.o -L. -lpython3.13 -ldl  -lpthread -lbz2          -lffi -ldl  -lm  -lncursesw  -lpanelw -lncursesw   -ldb  -lmpdec  -lexpat  -lcrypto        -llzma       -lrt         -lsqlite3  -lssl -lcrypto            -ltcl8.6 -ltk8.6 -lX11 -lxcb -lXau   -luuid      -lm    -lm   -lexpat  -ledit -lncursesw        -lz                       -lm
2025-03-19T23:16:36.5088042Z cpython-3.13> clang-14clang-14: warning: argument unused during compilation: '-nostdinc' [-Wunused-command-line-argument]
2025-03-19T23:16:36.5088753Z cpython-3.13> :
2025-03-19T23:16:36.5089031Z cpython-3.13> warning:
2025-03-19T23:16:36.5089458Z cpython-3.13> argument unused during compilation: '-nostdinc' [-Wunused-command-line-argument]
2025-03-19T23:16:36.5763818Z cpython-3.13> /tools/host/bin/ld: /tools/llvm/lib/clang/14.0.3/lib/linux/libclang_rt.profile-x86_64.a(InstrProfilingFile.c.o): in function `parseAndSetFilename':
2025-03-19T23:16:36.5764605Z cpython-3.13> InstrProfilingFile.c:(.text.parseAndSetFilename+0xf9): undefined reference to `__strdup'
2025-03-19T23:16:36.5777376Z cpython-3.13> clang-14
2025-03-19T23:16:36.5778447Z cpython-3.13> :
2025-03-19T23:16:36.5779459Z cpython-3.13> error:
2025-03-19T23:16:36.5780850Z cpython-3.13> linker command failed with exit code 1 (use -v to see invocation)
2025-03-19T23:16:36.5797322Z cpython-3.13> Makefile:977: recipe for target 'python' failed
2025-03-19T23:16:36.5798690Z cpython-3.13> make[2]: *** [python] Error 1
2025-03-19T23:16:36.5800281Z cpython-3.13> make[2]: *** Waiting for unfinished jobs....
2025-03-19T23:16:36.7876207Z cpython-3.13> /tools/host/bin/ld: /tools/llvm/lib/clang/14.0.3/lib/linux/libclang_rt.profile-x86_64.a(InstrProfilingFile.c.o): in function `
2025-03-19T23:16:36.7877248Z cpython-3.13> parseAndSetFilename':
2025-03-19T23:16:36.7877702Z cpython-3.13> InstrProfilingFile.c:(.text.parseAndSetFilename+0xf9): undefined reference to `__strd

@zanieb
Copy link
Member Author

zanieb commented Mar 19, 2025

This looks like an actual blocker, InstrProfilingFile.c:(.text.parseAndSetFilename+0xf9): undefined reference to '__strdup' — I don't know if we should pursue this further here. We might want to revisit once we're on a newer LLVM toolchain?

@indygreg
Copy link
Collaborator

The way PGO works is an extra library providing PGO instrumentation is linked automagically.

It looks like that library is referencing a symbol that isn't being linked in. It is likely that LLVM is making assumptions about which symbols are present and/or which extra libraries need to be linked to resolve all symbols. Those assumptions are likely tailored for glibc and don't hold on musl.

It is also possible that glibc only symbols are leaking into the LLVM PGO instrumentation library (because LLVM was compiled against glibc). In that case, we can't do much.

It is possible a newer version of LLVM has worked around this issue somehow. I'd focus on upgrading the toolchain. Then we can hash out PGO.

@zanieb
Copy link
Member Author

zanieb commented Dec 10, 2025

After upgrading llvm, I encounter a similar looking issue

2025-12-10T15:03:03.6830183Z cpython-3.13> /tools/host/bin/ld:
2025-12-10T15:03:03.6853001Z cpython-3.13> warning: libcrypto-lib-x86_64-gf2m.o: missing .note.GNU-stack section implies executable stack
2025-12-10T15:03:03.6854038Z cpython-3.13> /tools/host/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
2025-12-10T15:03:03.7362865Z cpython-3.13> /tools/host/bin/ld:
2025-12-10T15:03:03.7364469Z cpython-3.13> warning:
2025-12-10T15:03:03.7364841Z cpython-3.13> libcrypto-lib-x86_64-gf2m.o
2025-12-10T15:03:03.7365270Z cpython-3.13> : missing .note.GNU-stack section implies executable stack
2025-12-10T15:03:03.7365660Z cpython-3.13> /tools/host/bin/ld:
2025-12-10T15:03:03.7366142Z cpython-3.13> NOTE: This behaviour is deprecated and will be removed in a future version of the linker
2025-12-10T15:03:04.0107224Z cpython-3.13> /tools/host/bin/ld: /tools/llvm/lib/clang/21/lib/x86_64-unknown-linux-gnu/libclang_rt.profile.a(InstrProfilingFile.c.o): in function `parseAndSetFilename':
2025-12-10T15:03:04.0109305Z cpython-3.13> InstrProfilingFile.c:(.text.parseAndSetFilename+0xfd): undefined reference to `__strdup'
2025-12-10T15:03:04.0626616Z cpython-3.13> /tools/host/bin/ld
2025-12-10T15:03:04.0628258Z cpython-3.13> :
2025-12-10T15:03:04.0629037Z cpython-3.13> /tools/llvm/lib/clang/21/lib/x86_64-unknown-linux-gnu/libclang_rt.profile.a(InstrProfilingFile.c.o)
2025-12-10T15:03:04.0629582Z cpython-3.13> : in function `
2025-12-10T15:03:04.0629890Z cpython-3.13> parseAndSetFilename
2025-12-10T15:03:04.0630210Z cpython-3.13> ':
2025-12-10T15:03:04.0630494Z cpython-3.13> InstrProfilingFile.c:
2025-12-10T15:03:04.0630992Z cpython-3.13> (
2025-12-10T15:03:04.0631273Z cpython-3.13> .text.parseAndSetFilename
2025-12-10T15:03:04.0631593Z cpython-3.13> +0x
2025-12-10T15:03:04.0632011Z cpython-3.13> fd
2025-12-10T15:03:04.0632275Z cpython-3.13> )
2025-12-10T15:03:04.0632556Z cpython-3.13> : undefined reference to `
2025-12-10T15:03:04.0632858Z cpython-3.13> __strdup
2025-12-10T15:03:04.0633120Z cpython-3.13> '
2025-12-10T15:03:04.0800874Z cpython-3.13> clang: error: linker command failed with exit code 1 (use -v to see invocation)
2025-12-10T15:03:04.0817760Z cpython-3.13> Makefile:978: recipe for target 'python' failed
2025-12-10T15:03:04.0820209Z cpython-3.13> make[2]: *** [python] Error 1
2025-12-10T15:03:04.0820685Z cpython-3.13> make[2]: *** Waiting for unfinished jobs....
2025-12-10T15:03:04.1371226Z cpython-3.13> clang: error: linker command failed with exit code 1 (use -v to see invocation)
2025-12-10T15:03:04.1392553Z cpython-3.13> Makefile:1537: recipe for target 'Programs/_testembed' failed
2025-12-10T15:03:04.1393517Z cpython-3.13> make[2]: Leaving directory '/build/Python-3.13.11'
2025-12-10T15:03:04.1394252Z cpython-3.13> make[2]: *** [Programs/_testembed] Error 1
2025-12-10T15:03:04.1395585Z cpython-3.13> Makefile:835: recipe for target 'profile-gen-stamp' failed
2025-12-10T15:03:04.1396051Z cpython-3.13> make[1]: *** [profile-gen-stamp] Error 2
2025-12-10T15:03:04.1397604Z cpython-3.13> make[1]: Leaving directory '/build/Python-3.13.11'
2025-12-10T15:03:04.1401530Z cpython-3.13> Makefile:846: recipe for target 'profile-run-stamp' failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

libc:musl platform:linux Specific to the Linux platform python:3.13

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants