py-setproctitle icon indicating copy to clipboard operation
py-setproctitle copied to clipboard

ERROR tests/setproctitle_test.py::test_embedded - subprocess.CalledProcessErr...

Open Mingli-001 opened this issue 1 year ago • 1 comments

_______________________ ERROR at setup of test_embedded ________________________

pyconfig = <function pyconfig.<locals>.pyconfig_func at 0x7fac0e5f6a70>

    @pytest.fixture(scope="session")
    def pyrun(pyconfig):
        """
        Build the pyrun executable and return its path
        """
        # poor man's make
        here = os.path.abspath(os.path.dirname(__file__))
        ver2 = "%s.%s" % sys.version_info[:2]
        source = os.path.join(here, "pyrun.c")
        target = os.path.join(here, f"pyrun{ver2}")
        if (
            os.path.exists(target)
            and os.stat(target).st_mtime > os.stat(source).st_mtime
        ):
            return target
    
        cmdline = ["cc"]  # big punt
        cmdline.extend(pyconfig("includes"))
        cmdline.extend(["-o", target, source])
        cmdline.extend(pyconfig("ldflags"))
        cmdline.append(f"-L{pyconfig('prefix')[0]}/lib")
>       sp.check_call(cmdline)

tests/conftest.py:63: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

popenargs = (['cc', '-I/usr/include/python3.10', '-I/usr/include/python3.10', '-o', '/usr/lib64/python3-setproctitle/ptest/tests/pyrun3.10', '/usr/lib64/python3-setproctitle/ptest/tests/pyrun.c', ...],)
kwargs = {}, retcode = 1
cmd = ['cc', '-I/usr/include/python3.10', '-I/usr/include/python3.10', '-o', '/usr/lib64/python3-setproctitle/ptest/tests/pyrun3.10', '/usr/lib64/python3-setproctitle/ptest/tests/pyrun.c', ...]

    def check_call(*popenargs, **kwargs):
        """Run command with arguments.  Wait for command to complete.  If
        the exit code was zero then return, otherwise raise
        CalledProcessError.  The CalledProcessError object will have the
        return code in the returncode attribute.
    
        The arguments are the same as for the call function.  Example:
    
        check_call(["ls", "-l"])
        """
        retcode = call(*popenargs, **kwargs)
        if retcode:
            cmd = kwargs.get("args")
            if cmd is None:
                cmd = popenargs[0]
>           raise CalledProcessError(retcode, cmd)
E           subprocess.CalledProcessError: Command '['cc', '-I/usr/include/python3.10', '-I/usr/include/python3.10', '-o', '/usr/lib64/python3-setproctitle/ptest/tests/pyrun3.10', '/usr/lib64/python3-setproctitle/ptest/tests/pyrun.c', '-lcrypt', '-ldl', '-lpthread', '-lm', '-lm', '-L/usr/lib']' returned non-zero exit status 1.

../../python3.10/subprocess.py:369: CalledProcessError
---------------------------- Captured stderr setup -----------------------------
Usage: /usr/bin/python3.10-config [--prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--abiflags|--configdir|--embed]
/usr/lib64/gcc/x86_64-wrs-linux/11.4.0/../../../../x86_64-wrs-linux/bin/ld: /tmp/ccx0yEpv.o: in function `main':
pyrun.c:(.text+0x17): undefined reference to `Py_Initialize'
/usr/lib64/gcc/x86_64-wrs-linux/11.4.0/../../../../x86_64-wrs-linux/bin/ld: pyrun.c:(.text+0x37): undefined reference to `PyRun_SimpleFileExFlags'
/usr/lib64/gcc/x86_64-wrs-linux/11.4.0/../../../../x86_64-wrs-linux/bin/ld: pyrun.c:(.text+0x47): undefined reference to `Py_Finalize'
collect2: error: ld returned 1 exit status

Mingli-001 avatar Sep 27 '24 03:09 Mingli-001

>>> import subprocess
>>> subprocess.check_output(["/usr/bin/python3.10-config", "--help"])
Usage: /usr/bin/python3.10-config [--prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--abiflags|--configdir|--embed]
b''

Mingli-001 avatar Sep 27 '24 08:09 Mingli-001