gentoo / musl

[MIRROR] musl development overlay
https://gitweb.gentoo.org/proj/musl.git
99 stars 59 forks source link

dev-python/pypy3-exe-7.3.0 no longer compiles #451

Open ewildgoose opened 2 years ago

ewildgoose commented 2 years ago

Hi, pypy3-exe-7.3.0 now fails to find the download, so won't compile

Trivially grabbing latest upstream and re-applying the old musl patches gets the same failed result as using upstream gentoo pypy3-exe-7.3.5

  File "/var/tmp/portage/dev-python/pypy3-exe-7.3.5/work/pypy3.7-v7.3.5-src/rpython/rlib/clibffi.py", line 294, in <module>
    assert libc_name is not None, "Cannot find C library, ctypes.util.find_library('c') returned None"
AssertionError: Cannot find C library, ctypes.util.find_library('c') returned None

Adding the patch referenced in another issue here to python-2.7, allows things to get further (but it fails further along for me on arm/musl): https://raw.githubusercontent.com/alpinelinux/aports/master/main/python3/musl-find_library.patch

tgbugs commented 2 years ago

I see something similar with the gentoo repo dev-python/pypy3-exe-7.3.7. The alpine patch fixes the first issue, you then need pypy3-exe-7.3.0-musl-compat-fix-stdio-defs.patch and the patch listed below (instead of pypy3-exe-7.3.0-musl-compat-include-sys-time.patch which fails to apply for some reason) to get pypy3 to build. I didn't check on the gcc10 patch because I am on gcc11.

diff -r 9ef55f6fc369 pypy/module/cpyext/include/pytime.h
--- a/pypy/module/cpyext/include/pytime.h   Sun Oct 24 23:08:46 2021 +0300
+++ b/pypy/module/cpyext/include/pytime.h   Wed Jan 19 21:09:49 2022 -0500
@@ -2,6 +2,10 @@
 #ifndef Py_PYTIME_H
 #define Py_PYTIME_H

+#ifndef MS_WINDOWS
+#include <sys/time.h>
+#endif
+
 #include <pyconfig.h> /* include for defines */
 #include "object.h"
LinuxUserGD commented 2 years ago

After manually patching pypy3-exe-7.3.9.ebuild from main gentoo repo, it compiled fine on clang with libcxx and musl libc:

diff --git a/pypy/module/cpyext/include/pytime.h b/pypy/module/cpyext/include/pytime.h
index 6d553f5..3e29191 100644
--- a/pypy/module/cpyext/include/pytime.h
+++ b/pypy/module/cpyext/include/pytime.h
@@ -122,14 +122,14 @@ PyAPI_FUNC(PyObject *) _PyTime_AsNanosecondsObject(_PyTime_t t);
    tv_usec is always positive.
    Raise an exception and return -1 if the conversion overflowed,
    return 0 on success. */
-PyAPI_FUNC(int) _PyTime_AsTimeval(_PyTime_t t,
-    struct timeval *tv,
-    _PyTime_round_t round);
+//PyAPI_FUNC(int) _PyTime_AsTimeval(_PyTime_t t,
+//    struct timeval *tv,
+//    _PyTime_round_t round);

 /* Similar to _PyTime_AsTimeval(), but don't raise an exception on error. */
-PyAPI_FUNC(int) _PyTime_AsTimeval_noraise(_PyTime_t t,
-    struct timeval *tv,
-    _PyTime_round_t round);
+//PyAPI_FUNC(int) _PyTime_AsTimeval_noraise(_PyTime_t t,
+//    struct timeval *tv,
+//    _PyTime_round_t round);

 /* Convert a timestamp to a number of seconds (secs) and microseconds (us).
    us is always positive. This function is similar to _PyTime_AsTimeval()
diff --git a/rpython/rlib/clibffi.py b/rpython/rlib/clibffi.py
index 7c668fb..893ca63 100644
--- a/rpython/rlib/clibffi.py
+++ b/rpython/rlib/clibffi.py
@@ -276,7 +276,7 @@ else:

 if not _WIN32:
     libc_name = ctypes.util.find_library('c')
-    assert libc_name is not None, "Cannot find C library, ctypes.util.find_library('c') returned None"
+    #assert libc_name is not None, "Cannot find C library, ctypes.util.find_library('c') returned None"

     def get_libc_name():
         return libc_name
tgbugs commented 2 years ago

@LinuxUserGD you may run into issues if you just comment those lines out. See the links with discussion of the issue (that links back here as well) and a patchset that works against 7.3.9 https://github.com/tgbugs/dockerfiles/blob/f0a7ecbf8a02e1e4d6bc7677c801692d7256191f/source.org#patches