I’d like to build Python 3.11.1 on Centos 7 and glibc 2.29. I can build python3.11 just fine against system glibc, but when I include glibc2.29 in the flags like so:
export LD_LIBRARY_PATH="/usr/local/sqlite3/lib:/usr/local/ssl/lib:/usr/local/zlib-ng/lib:/usr/opt/glibc-2.29/usr/lib64:/usr/lib:/usr/lib64"
export CFLAGS="${CFLAGS} -march=x86-64 -mtune=haswell -Wno-error=format-truncation"
export CPPFLAGS="${CPPFLAGS} -I/usr/local/ssl/include -I/usr/local/zlib-ng/include -I/usr/local/sqlite3/include -I/usr/opt/glibc-2.29/usr/include"
export LDFLAGS="${LDFLAGS} -Wl,-rpath=/usr/local/sqlite3/lib -Wl,-rpath=/usr/local/zlib-ng/lib -Wl,-rpath=/usr/local/ssl/lib -Wl,-rpath=/usr/lib -Wl,-rpath=/usr/opt/glibc-2.29/lib64 -Wl,--dynamic-linker=/usr/opt/glibc-2.29/lib64/ld-linux-x86-64.so.2"
export LD_RUN_PATH="/usr/local/sqlite3/lib:/usr/local/ssl/lib:/usr/local/zlib-ng/lib:/usr/opt/glibc-2.29/lib64"
I get lines like:
/opt/rh/devtoolset-11/root/usr/libexec/gcc/x86_64-redhat-linux/11/ld: /tmp/ccaTf9kQ.lto.o: in function `set_inheritable':
/tmp/Python-3.11.1/Python/fileutils.c:1433: undefined reference to `fcntl64'
/opt/rh/devtoolset-11/root/usr/libexec/gcc/x86_64-redhat-linux/11/ld: /tmp/Python-3.11.1/Python/fileutils.c:1452: undefined reference to `fcntl64'
/opt/rh/devtoolset-11/root/usr/libexec/gcc/x86_64-redhat-linux/11/ld: /tmp/Python-3.11.1/Python/fileutils.c:1433: undefined reference to `fcntl64'
/opt/rh/devtoolset-11/root/usr/libexec/gcc/x86_64-redhat-linux/11/ld: /tmp/Python-3.11.1/Python/fileutils.c:1433: undefined reference to `fcntl64'
/opt/rh/devtoolset-11/root/usr/libexec/gcc/x86_64-redhat-linux/11/ld: /tmp/Python-3.11.1/Python/fileutils.c:1307: undefined reference to `fcntl64'
/opt/rh/devtoolset-11/root/usr/libexec/gcc/x86_64-redhat-linux/11/ld: /tmp/ccaTf9kQ.lto.o:/tmp/Python-3.11.1/Python/fileutils.c:1307: more undefined references to `fcntl64' follow
/opt/rh/devtoolset-11/root/usr/libexec/gcc/x86_64-redhat-linux/11/ld: /tmp/ccaTf9kQ.lto.o: in function `os_memfd_create':
/tmp/Python-3.11.1/./Modules/posixmodule.c:13177: undefined reference to `memfd_create'
/opt/rh/devtoolset-11/root/usr/libexec/gcc/x86_64-redhat-linux/11/ld: /tmp/ccaTf9kQ.lto.o: in function `create_stdio.isra.0':
/tmp/Python-3.11.1/Python/pylifecycle.c:2195: undefined reference to `fcntl64'
/opt/rh/devtoolset-11/root/usr/libexec/gcc/x86_64-redhat-linux/11/ld: /tmp/Python-3.11.1/Python/pylifecycle.c:2195: undefined reference to `fcntl64'
/opt/rh/devtoolset-11/root/usr/libexec/gcc/x86_64-redhat-linux/11/ld: /tmp/ccaTf9kQ.lto.o: in function `os_scandir':
/tmp/Python-3.11.1/Python/fileutils.c:2374: undefined reference to `fcntl64'
/opt/rh/devtoolset-11/root/usr/libexec/gcc/x86_64-redhat-linux/11/ld: /tmp/ccaTf9kQ.lto.o: in function `os_listdir':
/tmp/Python-3.11.1/Python/fileutils.c:2374: undefined reference to `fcntl64'
/opt/rh/devtoolset-11/root/usr/libexec/gcc/x86_64-redhat-linux/11/ld: /tmp/ccaTf9kQ.lto.o: in function `signal_set_wakeup_fd':
/tmp/Python-3.11.1/Python/fileutils.c:2416: undefined reference to `fcntl64'
/opt/rh/devtoolset-11/root/usr/libexec/gcc/x86_64-redhat-linux/11/ld: /tmp/ccaTf9kQ.lto.o:/tmp/Python-3.11.1/Python/fileutils.c:2374: more undefined references to `fcntl64' follow
collect2: error: ld returned 1 exit status
make: [Makefile:1196: Programs/_freeze_module] Error 1 (ignored)
./Programs/_freeze_module importlib._bootstrap ./Lib/importlib/_bootstrap.py Python/frozen_modules/importlib._bootstrap.h
make: ./Programs/_freeze_module: No such file or directory
make: [Makefile:1205: Python/frozen_modules/importlib._bootstrap.h] Error 127 (ignored)
./Programs/_freeze_module importlib._bootstrap_external ./Lib/importlib/_bootstrap_external.py Python/frozen_modules/importlib._bootstrap_external.h
make: ./Programs/_freeze_module: No such file or directory
make: [Makefile:1208: Python/frozen_modules/importlib._bootstrap_external.h] Error 127 (ignored)
gcc -pthread -c -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=haswell -Wno-error=format-truncation -march=x86-64 -mtune=haswell -Wno-error=format-truncation -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c11 -Werror=implicit-function-declaration -fvisibility=hidden -I./Include/internal -I. -I./Include -I/usr/local/ssl/include -I/usr/local/zlib-ng/include -I/usr/local/sqlite3/include -I/usr/opt/glibc-2.29/usr/include -I/usr/local/ssl/include -I/usr/local/zlib-ng/include -I/usr/local/sqlite3/include -I/usr/opt/glibc-2.29/usr/include -DPy_BUILD_CORE -o Programs/_bootstrap_python.o Programs/_bootstrap_python.c
Programs/_bootstrap_python.c:13:10: fatal error: Python/frozen_modules/importlib._bootstrap.h: No such file or directory
13 | #include "Python/frozen_modules/importlib._bootstrap.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: [Makefile:2460: Programs/_bootstrap_python.o] Error 1 (ignored)
./Programs/_freeze_module getpath ./Modules/getpath.py Python/frozen_modules/getpath.h
make: ./Programs/_freeze_module: No such file or directory
make: [Makefile:1200: Python/frozen_modules/getpath.h] Error 127 (ignored)
gcc -pthread -c -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=haswell -Wno-error=format-truncation -march=x86-64 -mtune=haswell -Wno-error=format-truncation -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c11 -Werror=implicit-function-declaration -fvisibility=hidden -I./Include/internal -I. -I./Include -I/usr/local/ssl/include -I/usr/local/zlib-ng/include -I/usr/local/sqlite3/include -I/usr/opt/glibc-2.29/usr/include -I/usr/local/ssl/include -I/usr/local/zlib-ng/include -I/usr/local/sqlite3/include -I/usr/opt/glibc-2.29/usr/include -DPy_BUILD_CORE -DPYTHONPATH='""' \
-DPREFIX='"/usr"' \
-DEXEC_PREFIX='"/usr"' \
-DVERSION='"3.11"' \
-DVPATH='""' \
-DPLATLIBDIR='"lib"' \
-DPYTHONFRAMEWORK='""' \
-o Modules/getpath.o ./Modules/getpath.c
./Modules/getpath.c:22:10: fatal error: ../Python/frozen_modules/getpath.h: No such file or directory
22 | #include "../Python/frozen_modules/getpath.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
<snip>
/opt/rh/devtoolset-11/root/usr/libexec/gcc/x86_64-redhat-linux/11/ld: cannot find Programs/_bootstrap_python.o: No such file or directory
/opt/rh/devtoolset-11/root/usr/libexec/gcc/x86_64-redhat-linux/11/ld: cannot find Modules/getpath.o: No such file or directory
collect2: error: ld returned 1 exit status
make: [Makefile:1108: _bootstrap_python] Error 1 (ignored)
./Programs/_freeze_module zipimport ./Lib/zipimport.py Python/frozen_modules/zipimport.h
make: ./Programs/_freeze_module: No such file or directory
make: [Makefile:1211: Python/frozen_modules/zipimport.h] Error 127 (ignored)
./_bootstrap_python ./Programs/_freeze_module.py abc ./Lib/abc.py Python/frozen_modules/abc.h
make: ./_bootstrap_python: No such file or directory
make: [Makefile:1214: Python/frozen_modules/abc.h] Error 127 (ignored)
./_bootstrap_python ./Programs/_freeze_module.py codecs ./Lib/codecs.py Python/frozen_modules/codecs.h
make: ./_bootstrap_python: No such file or directory
make: [Makefile:1217: Python/frozen_modules/codecs.h] Error 127 (ignored)
./_bootstrap_python ./Programs/_freeze_module.py io ./Lib/io.py Python/frozen_modules/io.h
make: ./_bootstrap_python: No such file or directory
make: [Makefile:1220: Python/frozen_modules/io.h] Error 127 (ignored)
./_bootstrap_python ./Programs/_freeze_module.py _collections_abc ./Lib/_collections_abc.py Python/frozen_modules/_collections_abc.h
make: ./_bootstrap_python: No such file or directory
make: [Makefile:1223: Python/frozen_modules/_collections_abc.h] Error 127 (ignored)
./_bootstrap_python ./Programs/_freeze_module.py _sitebuiltins ./Lib/_sitebuiltins.py Python/frozen_modules/_sitebuiltins.h
make: ./_bootstrap_python: No such file or directory
make: [Makefile:1226: Python/frozen_modules/_sitebuiltins.h] Error 127 (ignored)
./_bootstrap_python ./Programs/_freeze_module.py genericpath ./Lib/genericpath.py Python/frozen_modules/genericpath.h
make: ./_bootstrap_python: No such file or directory
make: [Makefile:1229: Python/frozen_modules/genericpath.h] Error 127 (ignored)
./_bootstrap_python ./Programs/_freeze_module.py ntpath ./Lib/ntpath.py Python/frozen_modules/ntpath.h
make: ./_bootstrap_python: No such file or directory
make: [Makefile:1232: Python/frozen_modules/ntpath.h] Error 127 (ignored)
./_bootstrap_python ./Programs/_freeze_module.py posixpath ./Lib/posixpath.py Python/frozen_modules/posixpath.h
make: ./_bootstrap_python: No such file or directory
make: [Makefile:1235: Python/frozen_modules/posixpath.h] Error 127 (ignored)
./_bootstrap_python ./Programs/_freeze_module.py os ./Lib/os.py Python/frozen_modules/os.h
make: ./_bootstrap_python: No such file or directory
make: [Makefile:1238: Python/frozen_modules/os.h] Error 127 (ignored)
./_bootstrap_python ./Programs/_freeze_module.py site ./Lib/site.py Python/frozen_modules/site.h
make: ./_bootstrap_python: No such file or directory
make: [Makefile:1241: Python/frozen_modules/site.h] Error 127 (ignored)
./_bootstrap_python ./Programs/_freeze_module.py stat ./Lib/stat.py Python/frozen_modules/stat.h
make: ./_bootstrap_python: No such file or directory
make: [Makefile:1244: Python/frozen_modules/stat.h] Error 127 (ignored)
./_bootstrap_python ./Programs/_freeze_module.py importlib.util ./Lib/importlib/util.py Python/frozen_modules/importlib.util.h
make: ./_bootstrap_python: No such file or directory
make: [Makefile:1247: Python/frozen_modules/importlib.util.h] Error 127 (ignored)
./_bootstrap_python ./Programs/_freeze_module.py importlib.machinery ./Lib/importlib/machinery.py Python/frozen_modules/importlib.machinery.h
make: ./_bootstrap_python: No such file or directory
make: [Makefile:1250: Python/frozen_modules/importlib.machinery.h] Error 127 (ignored)
./_bootstrap_python ./Programs/_freeze_module.py runpy ./Lib/runpy.py Python/frozen_modules/runpy.h
make: ./_bootstrap_python: No such file or directory
make: [Makefile:1253: Python/frozen_modules/runpy.h] Error 127 (ignored)
./_bootstrap_python ./Programs/_freeze_module.py __hello__ ./Lib/__hello__.py Python/frozen_modules/__hello__.h
make: ./_bootstrap_python: No such file or directory
make: [Makefile:1256: Python/frozen_modules/__hello__.h] Error 127 (ignored)
./_bootstrap_python ./Programs/_freeze_module.py __phello__ ./Lib/__phello__/__init__.py Python/frozen_modules/__phello__.h
make: ./_bootstrap_python: No such file or directory
make: [Makefile:1259: Python/frozen_modules/__phello__.h] Error 127 (ignored)
./_bootstrap_python ./Programs/_freeze_module.py __phello__.ham ./Lib/__phello__/ham/__init__.py Python/frozen_modules/__phello__.ham.h
make: ./_bootstrap_python: No such file or directory
make: [Makefile:1262: Python/frozen_modules/__phello__.ham.h] Error 127 (ignored)
./_bootstrap_python ./Programs/_freeze_module.py __phello__.ham.eggs ./Lib/__phello__/ham/eggs.py Python/frozen_modules/__phello__.ham.eggs.h
make: ./_bootstrap_python: No such file or directory
make: [Makefile:1265: Python/frozen_modules/__phello__.ham.eggs.h] Error 127 (ignored)
./_bootstrap_python ./Programs/_freeze_module.py __phello__.spam ./Lib/__phello__/spam.py Python/frozen_modules/__phello__.spam.h
make: ./_bootstrap_python: No such file or directory
make: [Makefile:1268: Python/frozen_modules/__phello__.spam.h] Error 127 (ignored)
./_bootstrap_python ./Programs/_freeze_module.py frozen_only ./Tools/freeze/flag.py Python/frozen_modules/frozen_only.h
make: ./_bootstrap_python: No such file or directory
make: [Makefile:1271: Python/frozen_modules/frozen_only.h] Error 127 (ignored)
./_bootstrap_python ./Tools/scripts/deepfreeze.py \
Python/frozen_modules/importlib._bootstrap.h:importlib._bootstrap \
Python/frozen_modules/importlib._bootstrap_external.h:importlib._bootstrap_external \
Python/frozen_modules/zipimport.h:zipimport \
Python/frozen_modules/abc.h:abc \
Python/frozen_modules/codecs.h:codecs \
Python/frozen_modules/io.h:io \
Python/frozen_modules/_collections_abc.h:_collections_abc \
Python/frozen_modules/_sitebuiltins.h:_sitebuiltins \
Python/frozen_modules/genericpath.h:genericpath \
Python/frozen_modules/ntpath.h:ntpath \
Python/frozen_modules/posixpath.h:posixpath \
Python/frozen_modules/os.h:os \
Python/frozen_modules/site.h:site \
Python/frozen_modules/stat.h:stat \
Python/frozen_modules/importlib.util.h:importlib.util \
Python/frozen_modules/importlib.machinery.h:importlib.machinery \
Python/frozen_modules/runpy.h:runpy \
Python/frozen_modules/__hello__.h:__hello__ \
Python/frozen_modules/__phello__.h:__phello__ \
Python/frozen_modules/__phello__.ham.h:__phello__.ham \
Python/frozen_modules/__phello__.ham.eggs.h:__phello__.ham.eggs \
Python/frozen_modules/__phello__.spam.h:__phello__.spam \
Python/frozen_modules/frozen_only.h:frozen_only \
-o Python/deepfreeze/deepfreeze.c
make: ./_bootstrap_python: No such file or directory
make: [Makefile:1292: Python/deepfreeze/deepfreeze.c] Error 127 (ignored)
Note: Deepfreeze may have added some global objects,
so run 'make regen-global-objects' if necessary.
gcc -pthread -c -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=haswell -Wno-error=format-truncation -march=x86-64 -mtune=haswell -Wno-error=format-truncation -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c11 -Werror=implicit-function-declaration -fvisibility=hidden -I./Include/internal -I. -I./Include -I/usr/local/ssl/include -I/usr/local/zlib-ng/include -I/usr/local/sqlite3/include -I/usr/opt/glibc-2.29/usr/include -I/usr/local/ssl/include -I/usr/local/zlib-ng/include -I/usr/local/sqlite3/include -I/usr/opt/glibc-2.29/usr/include -DPy_BUILD_CORE -o Python/deepfreeze/deepfreeze.o Python/deepfreeze/deepfreeze.c
cc1: fatal error: Python/deepfreeze/deepfreeze.c: No such file or directory
compilation terminated.
<snip>
/opt/rh/devtoolset-11/root/usr/libexec/gcc/x86_64-redhat-linux/11/ld: cannot find Python/deepfreeze/deepfreeze.o: No such file or directory
/opt/rh/devtoolset-11/root/usr/libexec/gcc/x86_64-redhat-linux/11/ld: cannot find Modules/getpath.o: No such file or directory
collect2: error: ld returned 1 exit status
make: [Makefile:836: python] Error 1 (ignored)
Creating directory /usr/bin
Creating directory /usr/lib
if test "no-framework" = "no-framework" ; then \
/usr/bin/install -c python /tmp/python-3.11.1-rpmbuild/usr/bin/python3.11; \
else \
/usr/bin/install -c -s Mac/pythonw /tmp/python-3.11.1-rpmbuild/usr/bin/python3.11; \
fi
/usr/bin/install: cannot stat ‘python’: No such file or directory
make: [Makefile:1926: altbininstall] Error 1 (ignored)
if test "3.11" != "3.11"; then \
if test -f /tmp/python-3.11.1-rpmbuild/usr/bin/python3.11 -o -h /tmp/python-3.11.1-rpmbuild/usr/bin/python3.11; \
then rm -f /tmp/python-3.11.1-rpmbuild/usr/bin/python3.11; \
fi; \
(cd /tmp/python-3.11.1-rpmbuild/usr/bin; ln python3.11 python3.11); \
fi
if test "x" != "x" ; then \
rm -f /tmp/python-3.11.1-rpmbuild/usr/bin/python3.11-32; \
lipo \
-output /tmp/python-3.11.1-rpmbuild/usr/bin/python3.11-32 \
/tmp/python-3.11.1-rpmbuild/usr/bin/python3.11; \
fi
if test "x" != "x" ; then \
rm -f /tmp/python-3.11.1-rpmbuild/usr/bin/python3.11-intel64; \
lipo \
-output /tmp/python-3.11.1-rpmbuild/usr/bin/python3.11-intel64 \
/tmp/python-3.11.1-rpmbuild/usr/bin/python3.11; \
fi
Running code to generate profile data (this can take a while):
# First, we need to create a clean build with profile generation
# enabled.
make profile-gen-stamp
make[1]: Entering directory '/tmp/Python-3.11.1'
make clean
make[2]: Entering directory '/tmp/Python-3.11.1'
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 '*.wasm' -exec rm -f {} ';'
find . -name '*.lst' -exec rm -f {} ';'
find build -name 'fficonfig.h' -exec rm -f {} ';' || true
find build -name '*.py' -exec rm -f {} ';' || true
find build -name '*.py[co]' -exec rm -f {} ';' || true
rm -f pybuilddir.txt
rm -f Lib/lib2to3/*Grammar*.pickle
rm -f _bootstrap_python
rm -f python.html python*.js python.data python*.symbols python*.map
rm -f ./usr/lib/python3.11/os.py
rm -f Programs/_testembed Programs/_freeze_module
rm -f Python/deepfreeze/*.[co]
rm -f Python/frozen_modules/*.h
rm -f Python/frozen_modules/MANIFEST
find build -type f -a ! -name '*.gc??' -exec rm -f {} ';'
rm -f Include/pydtrace_probes.h
rm -f profile-gen-stamp
make[3]: Entering directory '/tmp/Python-3.11.1'
find . -name '*.gc??' -exec rm -f {} ';'
find . -name '*.profclang?' -exec rm -f {} ';'
find . -name '*.dyn' -exec rm -f {} ';'
rm -f /tmp/Python-3.11.1/coverage.info
rm -rf /tmp/Python-3.11.1/lcov-report
rm -f profile-run-stamp
make[3]: Leaving directory '/tmp/Python-3.11.1'
make[2]: Leaving directory '/tmp/Python-3.11.1'
touch profile-clean-stamp
Building with support for profile generation:
make build_all_generate_profile
make[2]: Entering directory '/tmp/Python-3.11.1'
make build_all CFLAGS_NODIST=" -fprofile-generate" LDFLAGS_NODIST=" -fprofile-generate" LIBS="-lpthread -ldl -lutil"
make[3]: Entering directory '/tmp/Python-3.11.1'
gcc -pthread -c -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=haswell -Wno-error=format-truncation -march=x86-64 -mtune=haswell -Wno-error=format-truncation -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c11 -Werror=implicit-function-declaration -fvisibility=hidden -fprofile-generate -I./Include/internal -I. -I./Include -I/usr/local/ssl/include -I/usr/local/zlib-ng/include -I/usr/local/sqlite3/include -I/usr/opt/glibc-2.29/usr/include -I/usr/local/ssl/include -I/usr/local/zlib-ng/include -I/usr/local/sqlite3/include -I/usr/opt/glibc-2.29/usr/include -DPy_BUILD_CORE -o Programs/python.o ./Programs/python.c
Any thoughts on how to resolve this?