Mailing List Archive

compiling errors, SSL
I have built this on systems at work, that are populated by CAD guys who have developed a good set of libraries to maintain in a linux distribution.  Went without a hitch.

I am trying to build this at home with an opensuse distribution.  I am not trying to do any modifications to python, now or in the future.  I am trying to build this as another software installation wants 3.7 or better and opensuse provided 3.6.

I am stuck with a early compile error after the make command. 

I have downloaded, built and installed the openSSl.I have changed the ld.so.conf to include the newly built ssl in the list and re-ran ldconfig.  Even though I have added the newly built ssl to the conf file a dump of the ldconfig does not show the locally built ssl libs.  Does this process depend on LD_LIBRARY_PATH ?  Defining LD_LIBRARY_PATH made no discernable difference.

kevin@localhost:~/Sources/Python-3.10.5> sudo ldconfig -p | grep ssl
[sudo] password for root:  
       libssl3.so (libc6,x86-64) => /usr/lib64/libssl3.so
       libssl.so.1.1 (libc6,x86-64) => /usr/lib64/libssl.so.1.1
       libevent_openssl-2.1.so.6 (libc6,x86-64) => /usr/lib64/libevent_openssl-2.1.so.6

The newly built ssl dir:kevin@localhost:~/Sources/Python-3.10.5> ls -lrt /usr/local/ssl
total 40
drwxr-xr-x 1 root root    14 Jul 18 15:17 include
drwxr-xr-x 1 root root   190 Jul 18 15:17 lib64
drwxr-xr-x 1 root root    30 Jul 18 15:17 bin
drwxr-xr-x 1 root root     0 Jul 18 15:17 private
drwxr-xr-x 1 root root     0 Jul 18 15:17 certs
drwxr-xr-x 1 root root    36 Jul 18 15:17 misc
-rw-r--r-- 1 root root 12292 Jul 18 15:17 openssl.cnf.dist
-rw-r--r-- 1 root root 12292 Jul 18 15:17 openssl.cnf
-rw-r--r-- 1 root root   412 Jul 18 15:17 ct_log_list.cnf.dist
-rw-r--r-- 1 root root   412 Jul 18 15:17 ct_log_list.cnf
drwxr-xr-x 1 root root    12 Jul 18 15:18 share


I see in the web pages the known prerequisites and installed them.kevin@localhost:/usr/local/ssl/lib64> sudo zypper install python310-idle python310-devel python310-curses python310-dbm python310-tk
kevin@localhost:/usr/local/ssl/lib64> sudo zypper install build-essential gdb lcov pkg-config       libbz2-dev libffi-dev libgdbm-dev libgdbm-compat-dev liblzma-dev       libncur
ses5-dev libreadline6-dev libsqlite3-dev libssl-dev       lzma lzma-dev tk-dev uuid-dev zlib1g-dev

I see in the web pages this snip:Python build finished successfully!
The necessary bits to build these optional modules were not found:
_bz2 _dbm _gdbm
_lzma _sqlite3 _ssl
_tkinter _uuid readline
zlib
To find the necessary bits, look in setup.py in detect_modules()
for the module's name.What is one supposed to do with detect_modules?  Add something or remove something ?
This is the config line: 
kevin@localhost:~/Sources/Python-3.10.5> ./configure --prefix=/usr/local --enable-optimizations --with-openssl=/usr/local/ssl --with-openssl-rpath=auto

This is output from make:
kevin@localhost:~/Sources/Python-3.10.5> make
Rebuilding with profile guided optimizations:
rm -f profile-clean-stamp
make build_all CFLAGS_NODIST=" -fprofile-use -fprofile-correction" LDFLAGS_NODIST=""
make[1]: Entering directory '/home/kevin/Sources/Python-3.10.5'
gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall    -fno-semantic-interposition -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-miss
ing-field-initializers -Werror=implicit-function-declaration -fvisibility=hidden -fprofile-use -fprofile-correction -I./Include/internal  -I. -I./Include    -DPy_BUILD_CORE \
       -DABIFLAGS='""' \
       -DMULTIARCH=\"x86_64-linux-gnu\" \
       -o Python/sysmodule.o ./Python/sysmodule.c
gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall    -fno-semantic-interposition -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-miss
ing-field-initializers -Werror=implicit-function-declaration -fvisibility=hidden -fprofile-use -fprofile-correction -I./Include/internal  -I. -I./Include    -DPy_BUILD_CORE \
       -DSOABI='"cpython-310-x86_64-linux-gnu"' \
       -o Python/dynload_shlib.o ./Python/dynload_shlib.c
gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall    -fno-semantic-interposition -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-miss
ing-field-initializers -Werror=implicit-function-declaration -fvisibility=hidden -fprofile-use -fprofile-correction -I./Include/internal  -I. -I./Include    -DPy_BUILD_CORE -o Mo
dules/config.o Modules/config.c
gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall    -fno-semantic-interposition -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-miss
ing-field-initializers -Werror=implicit-function-declaration -fvisibility=hidden -fprofile-use -fprofile-correction -I./Include/internal  -I. -I./Include    -DPy_BUILD_CORE -DPYT
HONPATH='""' \
       -DPREFIX='"/usr/local"' \
       -DEXEC_PREFIX='"/usr/local"' \
       -DVERSION='"3.10"' \
       -DVPATH='""' \
       -o Modules/getpath.o ./Modules/getpath.c
gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall    -fno-semantic-interposition -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-miss
ing-field-initializers -Werror=implicit-function-declaration -fvisibility=hidden -fprofile-use -fprofile-correction -I./Include/internal  -I. -I./Include    -DPy_BUILD_CORE \
     -DGITVERSION="\"`LC_ALL=C `\"" \
     -DGITTAG="\"`LC_ALL=C `\"" \
     -DGITBRANCH="\"`LC_ALL=C `\"" \
     -o Modules/getbuildinfo.o ./Modules/getbuildinfo.c
rm -f libpython3.10.a
ar rcs libpython3.10.a 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 Object
s/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 Obj
ects/classobject.o Objects/codeobject.o Objects/complexobject.o Objects/descrobject.o Objects/enumobject.o Objects/exceptions.o Objects/genericaliasobject.o Objects/genobject.o O
bjects/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 Obje
cts/picklebufobject.o Objects/rangeobject.o Objects/setobject.o Objects/sliceobject.o Objects/structseq.o Objects/tupleobject.o Objects/typeobject.o Objects/unicodeobject.o Objec
ts/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/blt
inmodule.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 Pyth
on/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/mars
hal.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/py
lifecycle.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/atexitmodu
le.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 Modul
es/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
gcc -pthread   -fno-semantic-interposition  -Xlinker -export-dynamic -o python Programs/python.o libpython3.10.a -lcrypt -lpthread -ldl  -lutil -lm   -lm  
./python -E -S -m sysconfig --generate-posix-vars ;\
if test $? -ne 0 ; then \
       echo "generate-posix-vars failed" ; \
       rm -f ./pybuilddir.txt ; \
       exit 1 ; \
fi
CC='gcc -pthread' LDSHARED='gcc -pthread -shared   -fno-semantic-interposition ' OPT='-DNDEBUG -g -fwrapv -O3 -Wall'   _TCLTK_INCLUDES='' _TCLTK_LIBS=''       ./python -E ./setu
p.py  build
running build
running build_ext
INFO: Can't locate Tcl/Tk libs and/or headers
building '_ssl' extension
gcc -pthread -fPIC -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fno-semantic-interposition -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-miss
ing-field-initializers -Werror=implicit-function-declaration -fvisibility=hidden -fprofile-use -fprofile-correction -I./Include/internal -I/usr/local/ssl/include -I./Include -I.
-I/usr/local/include -I/home/kevin/Sources/Python-3.10.5/Include -I/home/kevin/Sources/Python-3.10.5 -c /home/kevin/Sources/Python-3.10.5/Modules/_ssl.c -o build/temp.linux-x86_6
4-3.10/home/kevin/Sources/Python-3.10.5/Modules/_ssl.o
/home/kevin/Sources/Python-3.10.5/Modules/_ssl.c: In function ‘PyInit__ssl’:
/home/kevin/Sources/Python-3.10.5/Modules/_ssl.c:6238:1: warning: ‘/home/kevin/Sources/Python-3.10.5/build/temp.linux-x86_64-3.10/home/kevin/Sources/Python-3.10.5/Modules/_ssl.gc
da’ profile count data file not found [-Wmissing-profile]
6238 | }
     | ^
gcc -pthread -shared -fno-semantic-interposition build/temp.linux-x86_64-3.10/home/kevin/Sources/Python-3.10.5/Modules/_ssl.o -L/usr/local/ssl/lib -L/usr/local/lib -Wl,--enable-n
ew-dtags,-R/usr/local/ssl/lib -lssl -lcrypto -o build/lib.linux-x86_64-3.10/_ssl.cpython-310-x86_64-linux-gnu.so
/usr/bin/ld: cannot find -lssl
/usr/bin/ld: cannot find -lcrypto
collect2: error: ld returned 1 exit status
building '_hashlib' extension
gcc -pthread -fPIC -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fno-semantic-interposition -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-miss
ing-field-initializers -Werror=implicit-function-declaration -fvisibility=hidden -fprofile-use -fprofile-correction -I./Include/internal -I/usr/local/ssl/include -I./Include -I.
-I/usr/local/include -I/home/kevin/Sources/Python-3.10.5/Include -I/home/kevin/Sources/Python-3.10.5 -c /home/kevin/Sources/Python-3.10.5/Modules/_hashopenssl.c -o build/temp.lin
ux-x86_64-3.10/home/kevin/Sources/Python-3.10.5/Modules/_hashopenssl.o
/home/kevin/Sources/Python-3.10.5/Modules/_hashopenssl.c: In function ‘PyInit__hashlib’:
/home/kevin/Sources/Python-3.10.5/Modules/_hashopenssl.c:2287:1: warning: ‘/home/kevin/Sources/Python-3.10.5/build/temp.linux-x86_64-3.10/home/kevin/Sources/Python-3.10.5/Modules
/_hashopenssl.gcda’ profile count data file not found [-Wmissing-profile]
2287 | }
     | ^
gcc -pthread -shared -fno-semantic-interposition build/temp.linux-x86_64-3.10/home/kevin/Sources/Python-3.10.5/Modules/_hashopenssl.o -L/usr/local/ssl/lib -L/usr/local/lib -Wl,--
enable-new-dtags,-R/usr/local/ssl/lib -lssl -lcrypto -o build/lib.linux-x86_64-3.10/_hashlib.cpython-310-x86_64-linux-gnu.so
/usr/bin/ld: cannot find -lssl
/usr/bin/ld: cannot find -lcrypto
collect2: error: ld returned 1 exit status

Python build finished successfully!
The necessary bits to build these optional modules were not found:
_dbm                  _gdbm                 _lzma               
_sqlite3              _tkinter              nis                 
readline                                                        
To find the necessary bits, look in setup.py in detect_modules() for the module's name.


The following modules found by detect_modules() in setup.py, have been
built by the Makefile instead, as configured by the Setup files:
_abc                  pwd                   time                


Failed to build these modules:
_hashlib              _ssl                                      


Could not build the ssl module!
Python requires a OpenSSL 1.1.1 or newer
Custom linker flags may require --with-openssl-rpath=auto

running build_scripts
copying and adjusting /home/kevin/Sources/Python-3.10.5/Tools/scripts/pydoc3 -> build/scripts-3.10
copying and adjusting /home/kevin/Sources/Python-3.10.5/Tools/scripts/idle3 -> build/scripts-3.10
copying and adjusting /home/kevin/Sources/Python-3.10.5/Tools/scripts/2to3 -> build/scripts-3.10
changing mode of build/scripts-3.10/pydoc3 from 644 to 755
changing mode of build/scripts-3.10/idle3 from 644 to 755
changing mode of build/scripts-3.10/2to3 from 644 to 755
renaming build/scripts-3.10/pydoc3 to build/scripts-3.10/pydoc3.10
renaming build/scripts-3.10/idle3 to build/scripts-3.10/idle3.10
renaming build/scripts-3.10/2to3 to build/scripts-3.10/2to3-3.10
gcc -pthread   -fno-semantic-interposition  -Xlinker -export-dynamic -o Programs/_testembed Programs/_testembed.o libpython3.10.a -lcrypt -lpthread -ldl  -lutil -lm   -lm  
sed -e "s,@EXENAME@,/usr/local/bin/python3.10," < ./Misc/python-config.in >python-config.py
LC_ALL=C sed -e 's,\$(\([A-Za-z0-9_]*\)),\$\{\1\},g' < Misc/python-config.sh >python-config
make[1]: Leaving directory '/home/kevin/Sources/Python-3.10.5'


This looks to me like it is having problems with finding the ssl and causing the failure.  Is it looking for 32bit versions?  How do I tell it that there are no 32bit versions.
Thanks for your attention.

Kevin
Re: compiling errors, SSL [ In reply to ]
On Tue, Jul 19, 2022 at 2:17 PM Kevin T via Python-Dev <
python-dev@python.org> wrote:

> I have built this on systems at work, that are populated by CAD guys who
> have developed a good set of libraries to maintain in a linux
> distribution. Went without a hitch.
>
> I am trying to build this at home with an opensuse distribution. I am not
> trying to do any modifications to python, now or in the future. I am
> trying to build this as another software installation wants 3.7 or better
> and opensuse provided 3.6.
>
> I am stuck with a early compile error after the make command.
>
> I have downloaded, built and installed the openSSl.
> I have changed the ld.so.conf to include the newly built ssl in the list
> and re-ran ldconfig. Even though I have added the newly built ssl to the
> conf file a dump of the ldconfig does not show the locally built ssl libs.
> Does this process depend on LD_LIBRARY_PATH ? Defining LD_LIBRARY_PATH
> made no discernable difference.
>
> kevin@localhost:~/Sources/Python-3.10.5> sudo ldconfig -p | grep ssl
> [sudo] password for root:
> libssl3.so (libc6,x86-64) => /usr/lib64/libssl3.so
> libssl.so.1.1 (libc6,x86-64) => /usr/lib64/libssl.so.1.1
> libevent_openssl-2.1.so.6 (libc6,x86-64) =>
> /usr/lib64/libevent_openssl-2.1.so.6
>
> The newly built ssl dir:
> kevin@localhost:~/Sources/Python-3.10.5> ls -lrt /usr/local/ssl
> total 40
> drwxr-xr-x 1 root root 14 Jul 18 15:17 include
> drwxr-xr-x 1 root root 190 Jul 18 15:17 lib64
> drwxr-xr-x 1 root root 30 Jul 18 15:17 bin
> drwxr-xr-x 1 root root 0 Jul 18 15:17 private
> drwxr-xr-x 1 root root 0 Jul 18 15:17 certs
> drwxr-xr-x 1 root root 36 Jul 18 15:17 misc
> -rw-r--r-- 1 root root 12292 Jul 18 15:17 openssl.cnf.dist
> -rw-r--r-- 1 root root 12292 Jul 18 15:17 openssl.cnf
> -rw-r--r-- 1 root root 412 Jul 18 15:17 ct_log_list.cnf.dist
> -rw-r--r-- 1 root root 412 Jul 18 15:17 ct_log_list.cnf
> drwxr-xr-x 1 root root 12 Jul 18 15:18 share
>
>
> I see in the web pages the known prerequisites and installed them.
> kevin@localhost:/usr/local/ssl/lib64> sudo zypper install python310-idle
> python310-devel python310-curses python310-dbm python310-tk
>
> kevin@localhost:/usr/local/ssl/lib64> sudo zypper install build-essential
> gdb lcov pkg-config libbz2-dev libffi-dev libgdbm-dev
> libgdbm-compat-dev liblzma-dev libncur
> ses5-dev libreadline6-dev libsqlite3-dev libssl-dev lzma lzma-dev
> tk-dev uuid-dev zlib1g-dev
>
> I see in the web pages this snip:
>
> Python build finished successfully!
> The necessary bits to build these optional modules were not found:
> _bz2 _dbm _gdbm
> _lzma _sqlite3 _ssl
> _tkinter _uuid readline
> zlib
> To find the necessary bits, look in setup.py in detect_modules()
> for the module's name.
>
> What is one supposed to do with detect_modules? Add something or remove
> something ?
>

It's up to you. It's more of a hint to let you know how Python searches for
what it needs to build those modules. Also know that setup.py is going away
in Python 3.12: https://github.com/python/cpython/pull/94474 .