Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Mingli-001 opened this issue Sep 27, 2024 · 1 comment

Comments

@Mingli-001
Copy link

Mingli-001 commented Sep 27, 2024

_______________________ 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
Copy link
Author

Mingli-001 commented Sep 27, 2024

>>> 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''

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant