Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] python-sip: fix compile error
@ 2023-11-23 17:41 Ralf Dragon
  2023-11-25 22:04 ` Yann E. MORIN
  0 siblings, 1 reply; 6+ messages in thread
From: Ralf Dragon @ 2023-11-23 17:41 UTC (permalink / raw)
  To: buildroot; +Cc: Ralf Dragon, Gwenhael Goavec-Merou, Asaf Kahlon

Without the patch, python-sip fails with:

siplib.c: In function ‘sip_api_get_frame’:
siplib.c:13750:22: error: invalid use of undefined type ‘struct _frame’
13750 |         frame = frame->f_back;

Signed-off-by: Ralf Dragon <hypnotoad@lindra.de>
---
 package/python-sip/0002-fixframe.patch | 46 ++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 package/python-sip/0002-fixframe.patch

diff --git a/package/python-sip/0002-fixframe.patch b/package/python-sip/0002-fixframe.patch
new file mode 100644
index 0000000000..86eb878b11
--- /dev/null
+++ b/package/python-sip/0002-fixframe.patch
@@ -0,0 +1,46 @@
+Signed-off-by: Ralf Dragon <hypnotoad@lindra.de>
+
+Index: host-python-sip-4.19.25/siplib/sip.h
+===================================================================
+--- host-python-sip-4.19.25.orig/siplib/sip.h
++++ host-python-sip-4.19.25/siplib/sip.h
+@@ -1799,7 +1799,7 @@ typedef struct _sipAPIDef {
+     int (*api_get_time)(PyObject *, sipTimeDef *);
+     PyObject *(*api_from_time)(const sipTimeDef *);
+     int (*api_is_user_type)(const sipWrapperType *);
+-    struct _frame *(*api_get_frame)(int);
++    PyFrameObject *(*api_get_frame)(int);
+     int (*api_check_plugin_for_type)(const sipTypeDef *, const char *);
+     PyObject *(*api_unicode_new)(SIP_SSIZE_T, unsigned, int *, void **);
+     void (*api_unicode_write)(int, void *, int, unsigned);
+Index: host-python-sip-4.19.25/siplib/siplib.c
+===================================================================
+--- host-python-sip-4.19.25.orig/siplib/siplib.c
++++ host-python-sip-4.19.25/siplib/siplib.c
+@@ -448,7 +448,7 @@ static PyObject *sip_api_from_datetime(c
+ static int sip_api_get_time(PyObject *obj, sipTimeDef *time);
+ static PyObject *sip_api_from_time(const sipTimeDef *time);
+ static int sip_api_is_user_type(const sipWrapperType *wt);
+-static struct _frame *sip_api_get_frame(int);
++static PyFrameObject *sip_api_get_frame(int);
+ static int sip_api_check_plugin_for_type(const sipTypeDef *td,
+         const char *name);
+ static PyObject *sip_api_unicode_new(SIP_SSIZE_T len, unsigned maxchar,
+@@ -13741,13 +13741,13 @@ static int sip_api_is_user_type(const si
+ /*
+  * Return a frame from the execution stack.
+  */
+-static struct _frame *sip_api_get_frame(int depth)
++static PyFrameObject *sip_api_get_frame(int depth)
+ {
+-    struct _frame *frame = PyEval_GetFrame();
++    PyFrameObject *frame = PyEval_GetFrame();
+ 
+     while (frame != NULL && depth > 0)
+     {
+-        frame = frame->f_back;
++        frame = PyFrame_GetBack(frame);
+         --depth;
+     }
+ 
+
-- 
2.39.2

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Buildroot] [PATCH 1/1] python-sip: fix compile error
  2023-11-23 17:41 [Buildroot] [PATCH 1/1] python-sip: fix compile error Ralf Dragon
@ 2023-11-25 22:04 ` Yann E. MORIN
  2023-11-27 21:14   ` Ralf Dragon
  0 siblings, 1 reply; 6+ messages in thread
From: Yann E. MORIN @ 2023-11-25 22:04 UTC (permalink / raw)
  To: Ralf Dragon; +Cc: Gwenhael Goavec-Merou, Asaf Kahlon, buildroot

Ralf, All,

On 2023-11-23 18:41 +0100, Ralf Dragon spake thusly:
> Without the patch, python-sip fails with:
> 
> siplib.c: In function ‘sip_api_get_frame’:
> siplib.c:13750:22: error: invalid use of undefined type ‘struct _frame’
> 13750 |         frame = frame->f_back;
> 
> Signed-off-by: Ralf Dragon <hypnotoad@lindra.de>

Thanks for this patch; please find below a few comments.

> ---
>  package/python-sip/0002-fixframe.patch | 46 ++++++++++++++++++++++++++
>  1 file changed, 46 insertions(+)
>  create mode 100644 package/python-sip/0002-fixframe.patch
> 
> diff --git a/package/python-sip/0002-fixframe.patch b/package/python-sip/0002-fixframe.patch
> new file mode 100644
> index 0000000000..86eb878b11
> --- /dev/null
> +++ b/package/python-sip/0002-fixframe.patch
> @@ -0,0 +1,46 @@
> +Signed-off-by: Ralf Dragon <hypnotoad@lindra.de>

    $ ./utils/docker-run make check-package
    package/python-sip/0002-fixframe.patch:0: missing Upstream in the header (http://nightly.buildroot.org/#_additional_patch_documentation)

A bundled patch should be formatted like a proper patch, with a commit
log and explanations for the patch, ready to be submitted upstream:
    https://buildroot.org/downloads/manual/manual.html#patch-policy

Here, you'd want to explain why it now fails, so that we can assess
whether we need to backport the fix to maintainance branches.

So, something along the lines of:

    siplib: fix build with python >= 3.11

    With python 3.11, the PyFrameObject structure members have been
    removed from the public C API:

        https://docs.python.org/3.11/whatsnew/3.11.html#whatsnew311-c-api-porting
        https://docs.python.org/3.11/whatsnew/3.11.html#pyframeobject-3-11-hiding

    So, use the proper object type that can store an actual
    PyFrameObject.

    Signed-off-by: Your Name <your@mail>
    Upstream: [upstream status]

(please adapt the above, it's mostly for illustration)

We also try hard to push patches upstream so that we do not have to
carry them indefinitely. Please try and submit that patch to the SIP
project:
    https://riverbankcomputing.com/support/lists

> +Index: host-python-sip-4.19.25/siplib/sip.h
> +===================================================================

What diff fornat is that? We usually have plain diff, or git-formatted
patches.

Can you look into reworking this patch of yours, please?

Regards,
Yann E. MORIN.

> +--- host-python-sip-4.19.25.orig/siplib/sip.h
> ++++ host-python-sip-4.19.25/siplib/sip.h
> +@@ -1799,7 +1799,7 @@ typedef struct _sipAPIDef {
> +     int (*api_get_time)(PyObject *, sipTimeDef *);
> +     PyObject *(*api_from_time)(const sipTimeDef *);
> +     int (*api_is_user_type)(const sipWrapperType *);
> +-    struct _frame *(*api_get_frame)(int);
> ++    PyFrameObject *(*api_get_frame)(int);
> +     int (*api_check_plugin_for_type)(const sipTypeDef *, const char *);
> +     PyObject *(*api_unicode_new)(SIP_SSIZE_T, unsigned, int *, void **);
> +     void (*api_unicode_write)(int, void *, int, unsigned);
> +Index: host-python-sip-4.19.25/siplib/siplib.c
> +===================================================================
> +--- host-python-sip-4.19.25.orig/siplib/siplib.c
> ++++ host-python-sip-4.19.25/siplib/siplib.c
> +@@ -448,7 +448,7 @@ static PyObject *sip_api_from_datetime(c
> + static int sip_api_get_time(PyObject *obj, sipTimeDef *time);
> + static PyObject *sip_api_from_time(const sipTimeDef *time);
> + static int sip_api_is_user_type(const sipWrapperType *wt);
> +-static struct _frame *sip_api_get_frame(int);
> ++static PyFrameObject *sip_api_get_frame(int);
> + static int sip_api_check_plugin_for_type(const sipTypeDef *td,
> +         const char *name);
> + static PyObject *sip_api_unicode_new(SIP_SSIZE_T len, unsigned maxchar,
> +@@ -13741,13 +13741,13 @@ static int sip_api_is_user_type(const si
> + /*
> +  * Return a frame from the execution stack.
> +  */
> +-static struct _frame *sip_api_get_frame(int depth)
> ++static PyFrameObject *sip_api_get_frame(int depth)
> + {
> +-    struct _frame *frame = PyEval_GetFrame();
> ++    PyFrameObject *frame = PyEval_GetFrame();
> + 
> +     while (frame != NULL && depth > 0)
> +     {
> +-        frame = frame->f_back;
> ++        frame = PyFrame_GetBack(frame);
> +         --depth;
> +     }
> + 
> +
> -- 
> 2.39.2
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Buildroot] [PATCH 1/1] python-sip: fix compile error
  2023-11-25 22:04 ` Yann E. MORIN
@ 2023-11-27 21:14   ` Ralf Dragon
  2023-11-29  6:42     ` Yann E. MORIN
  0 siblings, 1 reply; 6+ messages in thread
From: Ralf Dragon @ 2023-11-27 21:14 UTC (permalink / raw)
  To: buildroot


[-- Attachment #1.1: Type: text/plain, Size: 1714 bytes --]

Dear Yann,

thank you for your feedback. As you might have noticed, this is my first 
submission to buildroot and I had no contact so far to such a 
contribution process. So feedback is appreciated.

> Here, you'd want to explain why it now fails, so that we can assess
> whether we need to backport the fix to maintainance branches.
>
> So, something along the lines of:
>
>      siplib: fix build with python >= 3.11
>
>      With python 3.11, the PyFrameObject structure members have been
>      removed from the public C API:
>
> https://docs.python.org/3.11/whatsnew/3.11.html#whatsnew311-c-api-porting
> https://docs.python.org/3.11/whatsnew/3.11.html#pyframeobject-3-11-hiding
>
>      So, use the proper object type that can store an actual
>      PyFrameObject.
>
Your description it is already quite good 🙂. I will check again. I have 
to say, the patch checker command passed for me, but I was probably in 
the long-term branch at that time.


> We also try hard to push patches upstream so that we do not have to
> carry them indefinitely. Please try and submit that patch to the SIP
> project:
> https://riverbankcomputing.com/support/lists

They write that siplib is no longer supported and that 4.19.25 is the 
last version: https://riverbankcomputing.com/software/sip/download . 
That's why I did not consider asking there.

>> +Index: host-python-sip-4.19.25/siplib/sip.h
>> +===================================================================
> What diff fornat is that? We usually have plain diff, or git-formatted
> patches.

I think it is the output from "git diff" piped into the file.

> Can you look into reworking this patch of yours, please?

Will do.

Best,

Ralf

[-- Attachment #1.2: Type: text/html, Size: 3599 bytes --]

[-- Attachment #2: Type: text/plain, Size: 150 bytes --]

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Buildroot] [PATCH 1/1] python-sip: fix compile error
  2023-11-27 21:14   ` Ralf Dragon
@ 2023-11-29  6:42     ` Yann E. MORIN
  2023-11-29 22:10       ` Ralf Dragon
  0 siblings, 1 reply; 6+ messages in thread
From: Yann E. MORIN @ 2023-11-29  6:42 UTC (permalink / raw)
  To: Ralf Dragon; +Cc: buildroot

Ralf, All,

On 2023-11-27 22:14 +0100, Ralf Dragon spake thusly:
> thank you for your feedback. As you might have noticed, this is my
> first submission to buildroot and I had no contact so far to such
> a contribution process. So feedback is appreciated.

No worries, you did quite good!

>   Here, you'd want to explain why it now fails, so that we can assess
>   whether we need to backport the fix to maintainance branches.
> 
>   So, something along the lines of:
> 
>        siplib: fix build with python >= 3.11
> 
>        With python 3.11, the PyFrameObject structure members have been
>        removed from the public C API:
> 
>            [1]https://docs.python.org/3.11/whatsnew/3.11.html#whatsnew311-c-api-porting
>            [2]https://docs.python.org/3.11/whatsnew/3.11.html#pyframeobject-3-11-hiding
> 
>        So, use the proper object type that can store an actual
>        PyFrameObject.
> 
> Your description it is already quite good 🙂. I will check again.

Thanks, it would be good to be sure why the change is needed.

> I have to say, the patch checker command passed for me, but I was
> probably in the long-term branch at that time.

Usually, we run the tooling in our reference environment, which
utils/docker-run uses, so that you are sure to use the proper versions
of the checkers.

>   We also try hard to push patches upstream so that we do not have to
>   carry them indefinitely. Please try and submit that patch to the SIP
>   project:
>        [3]https://riverbankcomputing.com/support/lists
> 
> They write that siplib is no longer supported and that 4.19.25 is the last version:
> [4]https://riverbankcomputing.com/software/sip/download . That's why I did not consider asking there.

What I read is that version 4 is no longer maintained:

    SIP v4 is no longer supported. This is the last release.

The repository is still getting a lot of attention, and they tagged
6.7.12 last october, which is prestty recent. Also, it looks like it is
now a proper python package, so we should be able to migrate python-sip
to the python-package infra now, and drop our custom _CONFIGURE_CMDS,
_BUILD_CMDS, and _INSTLAL_CMDS altogether.

Of course, pyqt5, the sole user of python-sip, may still require sip v4,
which would preclude updating... :-(

Could you look into that?

>     +Index: host-python-sip-4.19.25/siplib/sip.h
>     +===================================================================
> 
>   What diff fornat is that? We usually have plain diff, or git-formatted
>   patches.
> 
> I think it is the output from "git diff" piped into the file.

The official repository is using mercurial, not git, and that does not
look like an hg diff either...

Regards,
Yann E. MORIN.

>   Can you look into reworking this patch of yours, please?
> 
> Will do.
> 
> Best,
> 
> Ralf
> 
> Links:
> 1. https://docs.python.org/3.11/whatsnew/3.11.html#whatsnew311-c-api-porting
> 2. https://docs.python.org/3.11/whatsnew/3.11.html#pyframeobject-3-11-hiding
> 3. https://riverbankcomputing.com/support/lists
> 4. https://riverbankcomputing.com/software/sip/download

> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot


-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Buildroot] [PATCH 1/1] python-sip: fix compile error
  2023-11-29  6:42     ` Yann E. MORIN
@ 2023-11-29 22:10       ` Ralf Dragon
  2023-12-12 15:20         ` Ralf Dragon
  0 siblings, 1 reply; 6+ messages in thread
From: Ralf Dragon @ 2023-11-29 22:10 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: buildroot


[-- Attachment #1.1: Type: text/plain, Size: 1375 bytes --]

Dear Yann,

We also try hard to push patches upstream so that we do not have to
>>    carry them indefinitely. Please try and submit that patch to the SIP
>>    project:
>>         [3]https://riverbankcomputing.com/support/lists
>>
>> They write that siplib is no longer supported and that 4.19.25 is the last version:
>> [4]https://riverbankcomputing.com/software/sip/download  . That's why I did not consider asking there.
> What I read is that version 4 is no longer maintained:
>
>      SIP v4 is no longer supported. This is the last release.
>
> The repository is still getting a lot of attention, and they tagged
> 6.7.12 last october, which is prestty recent. Also, it looks like it is
> now a proper python package, so we should be able to migrate python-sip
> to the python-package infra now, and drop our custom _CONFIGURE_CMDS,
> _BUILD_CMDS, and _INSTLAL_CMDS altogether.
>
> Of course, pyqt5, the sole user of python-sip, may still require sip v4,
> which would preclude updating... :-(
>
> Could you look into that?

Debian did a pretty similar fix like mine 1 year ago: 
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=%231023913 . Freebsd 
uses pyqt5 with sip6 
https://gitlab.com/FreeBSD/freebsd-ports/-/commit/08cac15470d53f0475de0de67a94c7e2cd7e021e 
. I will do one attempt to update to their versions 5.15.10 with 6.7.12 
from SIP6.

Best,

Ralf


[-- Attachment #1.2: Type: text/html, Size: 2330 bytes --]

[-- Attachment #2: Type: text/plain, Size: 150 bytes --]

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Buildroot] [PATCH 1/1] python-sip: fix compile error
  2023-11-29 22:10       ` Ralf Dragon
@ 2023-12-12 15:20         ` Ralf Dragon
  0 siblings, 0 replies; 6+ messages in thread
From: Ralf Dragon @ 2023-12-12 15:20 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: buildroot

Dear all,

here is my conclusion regarding sip6:

The library discontinues the "sip" tool that configure.py of pyqt5 
searches. Instead, one should use PyQt-builder (which is easy to 
package) and the sip-build tool [1]. However, when I get it working I 
run into the same problem which once was fixed python-pyqt5.mk: 
sip-build actually does compile and executes a test binary called 
cfgtest_QtCore, similar to what a configure.sh script does. The output 
file cfgtest_QtCore.out is currently created by a buildroot hook in 
python-pyqt5.mk. With sip-build, another solution seems needed because 
sip-build deletes the file instead of skipping the execution of 
cfgtest_QtCore. It then tries to execute cfgtest_QtCore which is 
compiled for the target.

I am neither a buildroot nor a python expert and do not know the proper 
way to enforce that this is done with the host compiler and the rest of 
the compilation is done for the target. If that would be fixed, then one 
could probably easily also get pyqt6 to run. So it would be good if 
someone could have a look at this, but I cannot do that soon.

Best,

Ralf

[1] https://www.riverbankcomputing.com/static/Docs/PyQt5/installation.html#building-pyqt5




_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-12-12 15:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-23 17:41 [Buildroot] [PATCH 1/1] python-sip: fix compile error Ralf Dragon
2023-11-25 22:04 ` Yann E. MORIN
2023-11-27 21:14   ` Ralf Dragon
2023-11-29  6:42     ` Yann E. MORIN
2023-11-29 22:10       ` Ralf Dragon
2023-12-12 15:20         ` Ralf Dragon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox