title: How to static compile python on centos 8?
body: <p>I am using the <code>centos:8</code> docker file and trying to compile python (with the static flag and openssl).<br />
  This is my docker file:</p>
  <pre><code>FROM centos:8
  
  RUN dnf update -y
  RUN yum -y install dnf-plugins-core
  RUN dnf config-manager --enable powertools
  RUN dnf -y builddep python3
  RUN dnf -y install wget
  RUN wget https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tgz
  RUN tar xzvf Python*
  COPY ./Setup /Python-3.9.6/Modules/Setup
  RUN dnf install -y gcc openssl-devel bzip2-devel libffi-devel wget make glibc-static glibc-common glibc-devel openssl
  RUN cd Python*/ &amp;&amp; ./configure --with-system-ffi --with-computed-gotos --enable-optimizations --enable-loadable-sqlite-extensions LDFLAGS=&quot;-static&quot; --disable-shared &amp;&amp; make LDFLAGS=&quot;-static&quot; LINKFORSHARED=&quot; &quot;
  </code></pre>
  <p>This is the change I did to Modules/Setup:</p>
  <pre><code># Socket module helper for socket(2)
  _socket socketmodule.c
  
  # Socket module helper for SSL support; you must comment out the other
  # socket line above, and possibly edit the SSL variable:
  SSL=/usr/include/openssl
  _ssl _ssl.c \
   -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
   -L$(SSL)/lib -lssl -lcrypto                                                                
  </code></pre>
  <p>This is the error:</p>
  <pre><code>libpython3.9.a(dynload_shlib.o): In function `_PyImport_FindSharedFuncptr':
  /Python-3.9.6/./Python/dynload_shlib.c:100: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
  /usr/bin/ld: cannot find -lssl
  /usr/bin/ld: cannot find -lcrypto
  collect2: error: ld returned 1 exit status
  make[3]: Leaving directory '/Python-3.9.6'
  make[3]: *** [Makefile:606: python] Error 1
  make[2]: *** [Makefile:535: build_all_generate_profile] Error 2
  make[2]: Leaving directory '/Python-3.9.6'
  make[1]: *** [Makefile:511: profile-gen-stamp] Error 2
  make[1]: Leaving directory '/Python-3.9.6'
  make: *** [Makefile:523: profile-run-stamp] Error 2
  </code></pre>
  <p>And the full output can be found <a href="https://pastebin.com/2Wd8FLHs" rel="nofollow noreferrer">here</a></p>
  <p>UPDATE:</p>
  <p>When I enter the docker and this is the output for the commands:</p>
  <pre class="lang-sh prettyprint-override"><code>[root@54c0d9495d37 /]# ld -lssl
  ld: warning: cannot find entry symbol _start; not setting start address
  [root@54c0d9495d37 /]# ld -lcrypto
  ld: warning: cannot find entry symbol _start; not setting start address
  </code></pre>