[New-bugs-announce] [issue40261] Build of Python where make is called from subprocess, within a virtualenv, breaks on macOS

Ruben report at bugs.python.org
Sun Apr 12 07:04:21 EDT 2020


New submission from Ruben <rubendibattista at gmail.com>:

This problem is driving me crazy. I'm working with a library (python-for-android) that builds python during a build process. 

Now, during this process, the classical workflow with `./configure` and `make` is being called from a subprocess. To try to isolate the issue, I call `make` to build Python from a file, let's call it `make.py`, in the source tree, where I simply do (after running `./configure`, manually or from a subprocess):

```
import subprocess; 
subprocess.run(["make", "-j8"])
```

I get the following error: 

```
/opt/local/bin/ranlib: file: libpython3.8.a(dynamic_annotations.o) has no symbols
/opt/local/bin/ranlib: file: libpython3.8.a(pymath.o) has no symbols
gcc     -Wl,-stack_size,1000000  -framework CoreFoundation -o python.exe Programs/python.o libpython3.8.a -ldl   -framework CoreFoundation
gcc     -Wl,-stack_size,1000000  -framework CoreFoundation -o Programs/_testembed Programs/_testembed.o libpython3.8.a -ldl   -framework CoreFoundation
./python.exe -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' LDSHARED='gcc -bundle -undefined dynamic_lookup    ' OPT='-DNDEBUG -g -fwrapv -O3 -Wall'      _TCLTK_INCLUDES='' _TCLTK_LIBS=''       ./python.exe -E ./setup.py  build
```

Is this a bug of my OS, my env configuration, venv/virtualenv, Python makefile or, most probably, myself? 

I attached the log files from the following runs: 
- make from the shell without virtualenv (`make.log`)
- make from shell within virtualenv (`make.venv.log`)
- make from python subprocess without virtualenv (`make.py.log`)
- make from python subprocess within a virtualenv creted with pew (`make.py.venv.log)
- make from python subprocess within a virtualenv created with venv (`make.py.venv2.log`)

My system details:

macOS 10.15.4

Steps to reproduce: 

1. Download Python-3.8.2
2. Extract the tgz
3. Run ./configure
4. cat `make.py` in the source tree where `make.py` is:
```
import subprocess

subprocess.run(["env"])
subprocess.run(["make", "-j8"])
```
5. Run python make.py

----------
components: Installation, macOS
files: make.py.venv.log.gz
messages: 366232
nosy: ned.deily, rdbisme, ronaldoussoren
priority: normal
severity: normal
status: open
title: Build of Python where make is called from subprocess, within a virtualenv, breaks on macOS
type: compile error
versions: Python 3.8
Added file: https://bugs.python.org/file49050/make.py.venv.log.gz

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40261>
_______________________________________


More information about the New-bugs-announce mailing list