RJVB / lnxports

A "local port repository" for use with MacPorts on Linux, overriding ports from the main repository.
4 stars 1 forks source link

python39 fails to build with clang: `error: Unsupported relocation type` #17

Open barracuda156 opened 1 week ago

barracuda156 commented 1 week ago
--->  Building python39
make: Entering directory '/opt/local/var/macports/build/_home_svacchanda_lnxports_lang_python39/python39/work/Python-3.9.19'
Running code to generate profile data (this can take a while):
# First, we need to create a clean build with profile generation
# enabled.
/usr/bin/make CC=/usr/bin/clang profile-gen-stamp
make[1]: Entering directory '/opt/local/var/macports/build/_home_svacchanda_lnxports_lang_python39/python39/work/Python-3.9.19'
/usr/bin/make CC=/usr/bin/clang clean
make[2]: Entering directory '/opt/local/var/macports/build/_home_svacchanda_lnxports_lang_python39/python39/work/Python-3.9.19'
find . -depth -name '__pycache__' -exec rm -rf {} ';'
find . -name '*.py[co]' -exec rm -f {} ';'
find . -name '*.[oa]' -exec rm -f {} ';'
find . -name '*.s[ol]' -exec rm -f {} ';'
find . -name '*.so.[0-9]*.[0-9]*' -exec rm -f {} ';'
find . -name '*.lst' -exec rm -f {} ';'
find build -name 'fficonfig.h' -exec rm -f {} ';' || true
find: ?build?: No such file or directory
find build -name '*.py' -exec rm -f {} ';' || true
find: ?build?: No such file or directory
find build -name '*.py[co]' -exec rm -f {} ';' || true
find: ?build?: No such file or directory
rm -f pybuilddir.txt
rm -f Lib/lib2to3/*Grammar*.pickle
rm -f Programs/_testembed Programs/_freeze_importlib
find build -type f -a ! -name '*.gc??' -exec rm -f {} ';'
find: ?build?: No such file or directory
make[2]: [Makefile:1888: clean-retain-profile] Error 1 (ignored)
rm -f Include/pydtrace_probes.h
rm -f profile-gen-stamp
make[3]: Entering directory '/opt/local/var/macports/build/_home_svacchanda_lnxports_lang_python39/python39/work/Python-3.9.19'
find . -name '*.gc??' -exec rm -f {} ';'
find . -name '*.profclang?' -exec rm -f {} ';'
find . -name '*.dyn' -exec rm -f {} ';'
rm -f /opt/local/var/macports/build/_home_svacchanda_lnxports_lang_python39/python39/work/Python-3.9.19/coverage.info
rm -rf /opt/local/var/macports/build/_home_svacchanda_lnxports_lang_python39/python39/work/Python-3.9.19/lcov-report
rm -f profile-run-stamp
make[3]: Leaving directory '/opt/local/var/macports/build/_home_svacchanda_lnxports_lang_python39/python39/work/Python-3.9.19'
make[2]: Leaving directory '/opt/local/var/macports/build/_home_svacchanda_lnxports_lang_python39/python39/work/Python-3.9.19'
touch profile-clean-stamp
Building with support for profile generation:
/usr/bin/make CC=/usr/bin/clang build_all_generate_profile
make[2]: Entering directory '/opt/local/var/macports/build/_home_svacchanda_lnxports_lang_python39/python39/work/Python-3.9.19'
/usr/bin/make CC=/usr/bin/clang build_all CFLAGS_NODIST=" -fprofile-instr-generate" LDFLAGS_NODIST=" -fprofile-instr-generate" LIBS="-lintl -ldl  -lm"
make[3]: Entering directory '/opt/local/var/macports/build/_home_svacchanda_lnxports_lang_python39/python39/work/Python-3.9.19'
/usr/bin/clang -c -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -pipe -I/opt/local/libexec/openssl3/include -Os   -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -fprofile-instr-generate -I./Include/internal  -I. -I./Include -I/opt/local/libexec/openssl3/include -isystem/opt/local/include  -fPIC -DPy_BUILD_CORE -o Programs/python.o ./Programs/python.c
/usr/bin/clang -c -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -pipe -I/opt/local/libexec/openssl3/include -Os   -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -fprofile-instr-generate -I./Include/internal  -I. -I./Include -I/opt/local/libexec/openssl3/include -isystem/opt/local/include  -fPIC -DPy_BUILD_CORE -o Parser/acceler.o Parser/acceler.c
/usr/bin/clang -c -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -pipe -I/opt/local/libexec/openssl3/include -Os   -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -fprofile-instr-generate -I./Include/internal  -I. -I./Include -I/opt/local/libexec/openssl3/include -isystem/opt/local/include  -fPIC -DPy_BUILD_CORE -o Parser/grammar1.o Parser/grammar1.c
/usr/bin/clang -c -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -pipe -I/opt/local/libexec/openssl3/include -Os   -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -fprofile-instr-generate -I./Include/internal  -I. -I./Include -I/opt/local/libexec/openssl3/include -isystem/opt/local/include  -fPIC -DPy_BUILD_CORE -o Parser/listnode.o Parser/listnode.c
error: Unsupported relocation type
1 error generated.
make[3]: *** [Makefile:810: Programs/python.o] Error 1
make[3]: *** Waiting for unfinished jobs....
error: Unsupported relocation type
error: Unsupported relocation type
2 errors generated.
make[3]: *** [Makefile:1803: Parser/grammar1.o] Error 1
error: Unsupported relocation type
error: Unsupported relocation type
error: Unsupported relocation type
error: Unsupported relocation type
error: Unsupported relocation type
error: Unsupported relocation type
6 errors generated.
make[3]: *** [Makefile:1803: Parser/listnode.o] Error 1
error: Unsupported relocation type
error: Unsupported relocation type
error: Unsupported relocation type
error: Unsupported relocation type
4 errors generated.
make[3]: *** [Makefile:1803: Parser/acceler.o] Error 1
make[3]: Leaving directory '/opt/local/var/macports/build/_home_svacchanda_lnxports_lang_python39/python39/work/Python-3.9.19'
make[2]: *** [Makefile:533: build_all_generate_profile] Error 2
make[2]: Leaving directory '/opt/local/var/macports/build/_home_svacchanda_lnxports_lang_python39/python39/work/Python-3.9.19'
make[1]: *** [Makefile:509: profile-gen-stamp] Error 2
make[1]: Leaving directory '/opt/local/var/macports/build/_home_svacchanda_lnxports_lang_python39/python39/work/Python-3.9.19'
make: *** [Makefile:521: profile-run-stamp] Error 2
make: Leaving directory '/opt/local/var/macports/build/_home_svacchanda_lnxports_lang_python39/python39/work/Python-3.9.19'
Command failed:  cd "/opt/local/var/macports/build/_home_svacchanda_lnxports_lang_python39/python39/work/Python-3.9.19" && /usr/bin/make -j4 -w all MAKE="/usr/bin/make CC=/usr/bin/clang" 
Exit code: 2
Error: Failed to build python39: command execution failed

I am kinda stuck now: gcc does not fail on this, but fails later on because its installation is incomplete and it lacks gcc-ar. Clang has clang-ar, but fails to compile this.

barracuda156 commented 1 week ago

I wonder if this is this LLVM bug: https://github.com/llvm/llvm-project/issues/55971 I have clang 14.0.3 here…

barracuda156 commented 1 week ago

UPD. With disabled LTO it has built with clang.

barracuda156 commented 1 week ago

Looks like it did not installed some secondary stuff:

sh-5.1# port select --set python python39
Selecting 'python39' for 'python' failed: could not create new link "/opt/local/share/man/man1/python.1": target "/opt/local/share/man/man1/python3.9.1" doesn't exist