Repository navigation
_tkinter build issue on Centos7 due changing TK/TCL detection by configure script. #95957
Description
Bug report
I'm trying to build python 3.11rc1 and faced with issue with correct importing _tkinter module due RPM build.
Connected issues 90005 and pull request 31698.
I've installed tk-devel and tcl-devel packages on Centos7, but they are quite old (2015 year), but still usable and should be supported by python3.11. It doesn't contain needed .pc files for pkg-config, so during compilation correct flags aren't added.
During compilation and building debug environment I've got:
gcc -pthread -shared -L/opt/wargaming/wargaming-python311/root/usr/lib64-Wl,-z,relro -Wl,-rpath,/opt/wargaming/wargaming-python311/root/usr/lib64 -
Wl,--enable-new-dtags -g -L/usr/lib64/openssl11 -L/usr/lib64 -L/opt/wargaming/wargaming-python311/root/usr/lib64-Wl,-z,relro -Wl,-rpath,/opt/wargam
ing/wargaming-python311/root/usr/lib64 -Wl,--enable-new-dtags -g -L/usr/lib64/openssl11 -L/usr/lib64 -L/opt/wargaming/wargaming-python311/root/usr/
lib64-Wl,-z,relro -Wl,-rpath,/opt/wargaming/wargaming-python311/root/usr/lib64 -Wl,--enable-new-dtags -g -L/usr/lib64/openssl11 -L/usr/lib64 -flto
-fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -L/opt/wargaming/wargaming-python311/root/usr/lib64-Wl,-z,relro -Wl,-rpath,/opt/warga
ming/wargaming-python311/root/usr/lib64 -Wl,--enable-new-dtags -g -L/usr/lib64/openssl11 -L/usr/lib64 -L/opt/wargaming/wargaming-python311/root/usr
/lib64-Wl,-z,relro -Wl,-rpath,/opt/wargaming/wargaming-python311/root/usr/lib64 -Wl,--enable-new-dtags -g -L/usr/lib64/openssl11 -L/usr/lib64 -I/op
t/wargaming/wargaming-python311/root/usr/include -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffe
r-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -I/usr/include/openssl11 -I/usr/include build/temp.linux-x86_64-3.11
-pydebug/builddir/build/BUILD/Python-3.11.0rc1/Modules/_ctypes/_ctypes.o build/temp.linux-x86_64-3.11-pydebug/builddir/build/BUILD/Python-3.11.0rc1
/Modules/_ctypes/callbacks.o build/temp.linux-x86_64-3.11-pydebug/builddir/build/BUILD/Python-3.11.0rc1/Modules/_ctypes/callproc.o build/temp.linux
-x86_64-3.11-pydebug/builddir/build/BUILD/Python-3.11.0rc1/Modules/_ctypes/cfield.o build/temp.linux-x86_64-3.11-pydebug/builddir/build/BUILD/Pytho
n-3.11.0rc1/Modules/_ctypes/stgdict.o -L. -L/opt/wargaming/wargaming-python311/root/usr/lib64 -L/usr/lib64/openssl11 -L/usr/lib64 -L/usr/local/lib
-lffi -ldl -o build/lib.linux-x86_64-3.11-pydebug/_ctypes.cpython-311d-x86_64-linux-gnu.so
*** WARNING: renaming "_tkinter" since importing it failed: /builddir/build/BUILD/Python-3.11.0rc1/build/debug/build/lib.linux-x86_64-3.11-pydebug/
_tkinter.cpython-311d-x86_64-linux-gnu.so: undefined symbol: Tcl_AddErrorInfo
Following modules built successfully but were removed because they could not be imported:
_tkinter
It seems that I need correct TCLTK_CFLAGS and TCLTK_LIBS, but it's quite problematic to find it manually and it's better than on Centos7 it will be detected automatically.
Adding in SPEC file the next string:
export TCLTK_LIBS="-ltk8.5 -ltcl8.5"
solves the issue.
Your environment
docker with mock inside, devtoolset-9 is present, openssl11.
- CPython versions tested on: 3.11rc1
- Operating system and architecture: Centos7, x86_64
Activity
pythongh-95957: Add instructions for TCL/TK and OpenSSL on RHEL/CentOS 7
tiran commentedon Aug 13, 2022
We are not going to add detection for TCL/TK to configure for several reasons:
I have created a PR with additional documentation and some pkg-config overrides. Some people may find it useful to build Python with RHEL 7 / CentOS 7's OpenSSL 1.1 package instead of building their own OpenSSL, too.
sharewax commentedon Aug 13, 2022
openssl11-devel is provided pkg-config part. I have in spec the next thing:
But anyway in require patch for aclocal.m4:
00501-openssl11-configure.patch(part of spec file)
I've repo with SCL for python3.10 and I suppose that I'll provide for 3.11 too, when it's going to release.
tiran commentedon Aug 13, 2022
The
openssl.pcfile is for upstream users that don't want to patch CPython or don't know how to patch it. Downstream packagers can solve the problem in a different way.By the way, you should neither set CFLAGS nor patch
aclocal.m4. The file is auto-generated.sed -i 's/PKG_CONFIG openssl /PKG_CONFIG openssl11 /g' configureis enough to build Python with RHEL 7's openssl11 package.sharewax commentedon Aug 13, 2022
Yes, but in SPEC files I often see (like here for example)
thank you, updated, removed a lot of FLAGS, one patch and etc in SPEC file:
pythongh-95957: Add instructions for Tcl/Tk and OpenSSL on RHEL/CentO…
gh-95957: Add instructions for Tcl/Tk and OpenSSL on RHEL/CentOS 7 (#…
gh-95957: Add instructions for Tcl/Tk and OpenSSL on RHEL/CentOS 7 (G…
pablogsal commentedon Aug 18, 2022
@tiran is anything left to do here?
tiran commentedon Aug 18, 2022
Nope, thanks!