diff mbox series

[scarthgap,meta-python] python3-h5py: fix compile error with gcc 14

Message ID 20240718031733.2868099-1-changqing.li@windriver.com
State New
Headers show
Series [scarthgap,meta-python] python3-h5py: fix compile error with gcc 14 | expand

Commit Message

Changqing Li July 18, 2024, 3:17 a.m. UTC
From: Changqing Li <changqing.li@windriver.com>

Backport two patches to fix following compile error:

h5py/h5l.c: In function ‘__pyx_pf_4h5py_3h5l_9LinkProxy_12get_val’:
h5py/h5l.c:8152:107: error: passing argument 4 of ‘__pyx_f_4h5py_4defs_H5Lunpack_elink_val’ from incompatible pointer type [-Wincompatible-pointer-types]
 8152 |       __pyx_t_2 = __pyx_f_4h5py_4defs_H5Lunpack_elink_val(__pyx_v_buf, __pyx_v_buf_size, (&__pyx_v_wtf), (&__pyx_v_ext_file_name), (&__pyx_v_ext_obj_name)); if (unlikely(__pyx_t_2 == ((herr_t)((herr_t)-1L)))) __PYX_ERR(1, 187, __pyx_L5_error)
      |                                                                                                          ~^~~~~~~~~~~~~~~~~~~~~~~
      |                                                                                                           |
      |

Signed-off-by: Changqing Li <changqing.li@windriver.com>
---
 ...001-Use-libc.stdint-instead-of-numpy.patch | 27 +++++++++++++++++++
 ...ast-arguments-to-H5Lunpack_elink_val.patch | 27 +++++++++++++++++++
 .../python/python3-h5py_3.10.0.bb             |  5 +++-
 3 files changed, 58 insertions(+), 1 deletion(-)
 create mode 100644 meta-python/recipes-devtools/python/python3-h5py/0001-Use-libc.stdint-instead-of-numpy.patch
 create mode 100644 meta-python/recipes-devtools/python/python3-h5py/0002-Properly-cast-arguments-to-H5Lunpack_elink_val.patch

Comments

Martin Jansa July 18, 2024, 8:29 a.m. UTC | #1
You should remove the -Wno-error flags from:
https://git.openembedded.org/meta-openembedded/diff/meta-python/recipes-devtools/python/python3-h5py_3.11.0.bb?id=f0c767407d033e3f39ceeccc2f7e03a1ca7a6443
if your change fixes it.

On Thu, Jul 18, 2024 at 5:17 AM Changqing Li via
lists.openembedded.org
<changqing.li=windriver.com@lists.openembedded.org> wrote:
>
> From: Changqing Li <changqing.li@windriver.com>
>
> Backport two patches to fix following compile error:
>
> h5py/h5l.c: In function ‘__pyx_pf_4h5py_3h5l_9LinkProxy_12get_val’:
> h5py/h5l.c:8152:107: error: passing argument 4 of ‘__pyx_f_4h5py_4defs_H5Lunpack_elink_val’ from incompatible pointer type [-Wincompatible-pointer-types]
>  8152 |       __pyx_t_2 = __pyx_f_4h5py_4defs_H5Lunpack_elink_val(__pyx_v_buf, __pyx_v_buf_size, (&__pyx_v_wtf), (&__pyx_v_ext_file_name), (&__pyx_v_ext_obj_name)); if (unlikely(__pyx_t_2 == ((herr_t)((herr_t)-1L)))) __PYX_ERR(1, 187, __pyx_L5_error)
>       |                                                                                                          ~^~~~~~~~~~~~~~~~~~~~~~~
>       |                                                                                                           |
>       |
>
> Signed-off-by: Changqing Li <changqing.li@windriver.com>
> ---
>  ...001-Use-libc.stdint-instead-of-numpy.patch | 27 +++++++++++++++++++
>  ...ast-arguments-to-H5Lunpack_elink_val.patch | 27 +++++++++++++++++++
>  .../python/python3-h5py_3.10.0.bb             |  5 +++-
>  3 files changed, 58 insertions(+), 1 deletion(-)
>  create mode 100644 meta-python/recipes-devtools/python/python3-h5py/0001-Use-libc.stdint-instead-of-numpy.patch
>  create mode 100644 meta-python/recipes-devtools/python/python3-h5py/0002-Properly-cast-arguments-to-H5Lunpack_elink_val.patch
>
> diff --git a/meta-python/recipes-devtools/python/python3-h5py/0001-Use-libc.stdint-instead-of-numpy.patch b/meta-python/recipes-devtools/python/python3-h5py/0001-Use-libc.stdint-instead-of-numpy.patch
> new file mode 100644
> index 000000000..3c55fa697
> --- /dev/null
> +++ b/meta-python/recipes-devtools/python/python3-h5py/0001-Use-libc.stdint-instead-of-numpy.patch
> @@ -0,0 +1,27 @@
> +From 434e1bf4ab9fa53ec1293cde86f4dbec6784e50f Mon Sep 17 00:00:00 2001
> +From: Orion Poplawski <orion@nwra.com>
> +Date: Thu, 22 Feb 2024 08:41:17 -0700
> +Subject: [PATCH 1/2] Use libc.stdint instead of numpy
> +
> +Upstream-Status: Backport [https://github.com/h5py/h5py/pull/2382/commits/387a22b8c1513800c0401f496b4ed512c1639798]
> +Signed-off-by: Changqing Li <changqing.li@windriver.com>
> +---
> + h5py/api_types_ext.pxd                   | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/h5py/api_types_ext.pxd b/h5py/api_types_ext.pxd
> +index 91acb128..55a239f5 100644
> +--- a/h5py/api_types_ext.pxd
> ++++ b/h5py/api_types_ext.pxd
> +@@ -20,7 +20,7 @@ from libc.string cimport strlen, strchr, strcpy, strncpy, strcmp,\
> + ctypedef long size_t
> + from libc.time cimport time_t
> +
> +-from numpy cimport int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t
> ++from libc.stdint cimport int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t
> +
> + IF UNAME_SYSNAME != "Windows":
> +     cdef extern from "unistd.h":
> +--
> +2.25.1
> +
> diff --git a/meta-python/recipes-devtools/python/python3-h5py/0002-Properly-cast-arguments-to-H5Lunpack_elink_val.patch b/meta-python/recipes-devtools/python/python3-h5py/0002-Properly-cast-arguments-to-H5Lunpack_elink_val.patch
> new file mode 100644
> index 000000000..0f77f745a
> --- /dev/null
> +++ b/meta-python/recipes-devtools/python/python3-h5py/0002-Properly-cast-arguments-to-H5Lunpack_elink_val.patch
> @@ -0,0 +1,27 @@
> +From 9ed4f80fd482e135119086fb2015ca97dce306ae Mon Sep 17 00:00:00 2001
> +From: Orion Poplawski <orion@nwra.com>
> +Date: Thu, 15 Feb 2024 20:47:50 -0700
> +Subject: [PATCH 2/2] Properly cast arguments to H5Lunpack_elink_val
> +
> +Upstream-Status: Backport [https://github.com/h5py/h5py/pull/2380/commits/704e13ac83b42898514610c4df9f32f367e767e4]
> +Signed-off-by: Changqing Li <changqing.li@windriver.com>
> +---
> + h5py/h5l.pyx         | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/h5py/h5l.pyx b/h5py/h5l.pyx
> +index 60b252fa..af725bdb 100644
> +--- a/h5py/h5l.pyx
> ++++ b/h5py/h5l.pyx
> +@@ -184,7 +184,7 @@ cdef class LinkProxy:
> +             if info.type == H5L_TYPE_SOFT:
> +                 py_retval = buf
> +             else:
> +-                H5Lunpack_elink_val(buf, buf_size, &wtf, &ext_file_name, &ext_obj_name)
> ++                H5Lunpack_elink_val(buf, buf_size, &wtf, <const char **>&ext_file_name, <const char **>&ext_obj_name)
> +                 py_retval = (bytes(ext_file_name), bytes(ext_obj_name))
> +         finally:
> +             efree(buf)
> +--
> +2.25.1
> +
> diff --git a/meta-python/recipes-devtools/python/python3-h5py_3.10.0.bb b/meta-python/recipes-devtools/python/python3-h5py_3.10.0.bb
> index 8a9158525..d557a8188 100644
> --- a/meta-python/recipes-devtools/python/python3-h5py_3.10.0.bb
> +++ b/meta-python/recipes-devtools/python/python3-h5py_3.10.0.bb
> @@ -7,7 +7,10 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=113251d71fb0384712c719b567261c5c"
>  SRC_URI[sha256sum] = "d93adc48ceeb33347eb24a634fb787efc7ae4644e6ea4ba733d099605045c049"
>
>  SRC_URI += "file://0001-setup_build.py-avoid-absolute-path.patch \
> -            file://0001-Fix-Cython-3-compatibility.patch"
> +            file://0001-Fix-Cython-3-compatibility.patch \
> +            file://0001-Use-libc.stdint-instead-of-numpy.patch \
> +            file://0002-Properly-cast-arguments-to-H5Lunpack_elink_val.patch \
> +"
>
>  inherit pkgconfig pypi setuptools3
>
> --
> 2.25.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#111389): https://lists.openembedded.org/g/openembedded-devel/message/111389
> Mute This Topic: https://lists.openembedded.org/mt/107411257/3617156
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [martin.jansa@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Changqing Li July 19, 2024, 2:43 a.m. UTC | #2
On 7/18/24 16:29, Martin Jansa wrote:
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender and know the content is safe.
>
> You should remove the -Wno-error flags from:
> https://git.openembedded.org/meta-openembedded/diff/meta-python/recipes-devtools/python/python3-h5py_3.11.0.bb?id=f0c767407d033e3f39ceeccc2f7e03a1ca7a6443
> if your change fixes it.

You are right,  this can be removed.  I will send another patch for 
master to remove this.

3.11.0 already contains the fix. This patch is for scarthgap which still 
3.10.0.

Thanks

Changqing

>
> On Thu, Jul 18, 2024 at 5:17 AM Changqing Li via
> lists.openembedded.org
> <changqing.li=windriver.com@lists.openembedded.org>  wrote:
>> From: Changqing Li<changqing.li@windriver.com>
>>
>> Backport two patches to fix following compile error:
>>
>> h5py/h5l.c: In function ‘__pyx_pf_4h5py_3h5l_9LinkProxy_12get_val’:
>> h5py/h5l.c:8152:107: error: passing argument 4 of ‘__pyx_f_4h5py_4defs_H5Lunpack_elink_val’ from incompatible pointer type [-Wincompatible-pointer-types]
>>   8152 |       __pyx_t_2 = __pyx_f_4h5py_4defs_H5Lunpack_elink_val(__pyx_v_buf, __pyx_v_buf_size, (&__pyx_v_wtf), (&__pyx_v_ext_file_name), (&__pyx_v_ext_obj_name)); if (unlikely(__pyx_t_2 == ((herr_t)((herr_t)-1L)))) __PYX_ERR(1, 187, __pyx_L5_error)
>>        |                                                                                                          ~^~~~~~~~~~~~~~~~~~~~~~~
>>        |                                                                                                           |
>>        |
>>
>> Signed-off-by: Changqing Li<changqing.li@windriver.com>
>> ---
>>   ...001-Use-libc.stdint-instead-of-numpy.patch | 27 +++++++++++++++++++
>>   ...ast-arguments-to-H5Lunpack_elink_val.patch | 27 +++++++++++++++++++
>>   .../python/python3-h5py_3.10.0.bb             |  5 +++-
>>   3 files changed, 58 insertions(+), 1 deletion(-)
>>   create mode 100644 meta-python/recipes-devtools/python/python3-h5py/0001-Use-libc.stdint-instead-of-numpy.patch
>>   create mode 100644 meta-python/recipes-devtools/python/python3-h5py/0002-Properly-cast-arguments-to-H5Lunpack_elink_val.patch
>>
>> diff --git a/meta-python/recipes-devtools/python/python3-h5py/0001-Use-libc.stdint-instead-of-numpy.patch b/meta-python/recipes-devtools/python/python3-h5py/0001-Use-libc.stdint-instead-of-numpy.patch
>> new file mode 100644
>> index 000000000..3c55fa697
>> --- /dev/null
>> +++ b/meta-python/recipes-devtools/python/python3-h5py/0001-Use-libc.stdint-instead-of-numpy.patch
>> @@ -0,0 +1,27 @@
>> +From 434e1bf4ab9fa53ec1293cde86f4dbec6784e50f Mon Sep 17 00:00:00 2001
>> +From: Orion Poplawski<orion@nwra.com>
>> +Date: Thu, 22 Feb 2024 08:41:17 -0700
>> +Subject: [PATCH 1/2] Use libc.stdint instead of numpy
>> +
>> +Upstream-Status: Backport [https://github.com/h5py/h5py/pull/2382/commits/387a22b8c1513800c0401f496b4ed512c1639798]
>> +Signed-off-by: Changqing Li<changqing.li@windriver.com>
>> +---
>> + h5py/api_types_ext.pxd                   | 2 +-
>> + 1 file changed, 1 insertion(+), 1 deletion(-)
>> +
>> +diff --git a/h5py/api_types_ext.pxd b/h5py/api_types_ext.pxd
>> +index 91acb128..55a239f5 100644
>> +--- a/h5py/api_types_ext.pxd
>> ++++ b/h5py/api_types_ext.pxd
>> +@@ -20,7 +20,7 @@ from libc.string cimport strlen, strchr, strcpy, strncpy, strcmp,\
>> + ctypedef long size_t
>> + from libc.time cimport time_t
>> +
>> +-from numpy cimport int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t
>> ++from libc.stdint cimport int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t
>> +
>> + IF UNAME_SYSNAME != "Windows":
>> +     cdef extern from "unistd.h":
>> +--
>> +2.25.1
>> +
>> diff --git a/meta-python/recipes-devtools/python/python3-h5py/0002-Properly-cast-arguments-to-H5Lunpack_elink_val.patch b/meta-python/recipes-devtools/python/python3-h5py/0002-Properly-cast-arguments-to-H5Lunpack_elink_val.patch
>> new file mode 100644
>> index 000000000..0f77f745a
>> --- /dev/null
>> +++ b/meta-python/recipes-devtools/python/python3-h5py/0002-Properly-cast-arguments-to-H5Lunpack_elink_val.patch
>> @@ -0,0 +1,27 @@
>> +From 9ed4f80fd482e135119086fb2015ca97dce306ae Mon Sep 17 00:00:00 2001
>> +From: Orion Poplawski<orion@nwra.com>
>> +Date: Thu, 15 Feb 2024 20:47:50 -0700
>> +Subject: [PATCH 2/2] Properly cast arguments to H5Lunpack_elink_val
>> +
>> +Upstream-Status: Backport [https://github.com/h5py/h5py/pull/2380/commits/704e13ac83b42898514610c4df9f32f367e767e4]
>> +Signed-off-by: Changqing Li<changqing.li@windriver.com>
>> +---
>> + h5py/h5l.pyx         | 2 +-
>> + 1 file changed, 1 insertion(+), 1 deletion(-)
>> +
>> +diff --git a/h5py/h5l.pyx b/h5py/h5l.pyx
>> +index 60b252fa..af725bdb 100644
>> +--- a/h5py/h5l.pyx
>> ++++ b/h5py/h5l.pyx
>> +@@ -184,7 +184,7 @@ cdef class LinkProxy:
>> +             if info.type == H5L_TYPE_SOFT:
>> +                 py_retval = buf
>> +             else:
>> +-                H5Lunpack_elink_val(buf, buf_size, &wtf, &ext_file_name, &ext_obj_name)
>> ++                H5Lunpack_elink_val(buf, buf_size, &wtf, <const char **>&ext_file_name, <const char **>&ext_obj_name)
>> +                 py_retval = (bytes(ext_file_name), bytes(ext_obj_name))
>> +         finally:
>> +             efree(buf)
>> +--
>> +2.25.1
>> +
>> diff --git a/meta-python/recipes-devtools/python/python3-h5py_3.10.0.bb b/meta-python/recipes-devtools/python/python3-h5py_3.10.0.bb
>> index 8a9158525..d557a8188 100644
>> --- a/meta-python/recipes-devtools/python/python3-h5py_3.10.0.bb
>> +++ b/meta-python/recipes-devtools/python/python3-h5py_3.10.0.bb
>> @@ -7,7 +7,10 @@ LIC_FILES_CHKSUM ="file://LICENSE;md5=113251d71fb0384712c719b567261c5c"
>>   SRC_URI[sha256sum] = "d93adc48ceeb33347eb24a634fb787efc7ae4644e6ea4ba733d099605045c049"
>>
>>   SRC_URI +="file://0001-setup_build.py-avoid-absolute-path.patch \ - 
>> file://0001-Fix-Cython-3-compatibility.patch"
>> +file://0001-Fix-Cython-3-compatibility.patch  \
>> +file://0001-Use-libc.stdint-instead-of-numpy.patch  \
>> +file://0002-Properly-cast-arguments-to-H5Lunpack_elink_val.patch  \
>> +"
>>
>>   inherit pkgconfig pypi setuptools3
>>
>> --
>> 2.25.1
>>
>>
>> -=-=-=-=-=-=-=-=-=-=-=-
>> Links: You receive all messages sent to this group.
>> View/Reply Online (#111389):https://lists.openembedded.org/g/openembedded-devel/message/111389
>> Mute This Topic:https://lists.openembedded.org/mt/107411257/3617156
>> Group Owner:openembedded-devel+owner@lists.openembedded.org
>> Unsubscribe:https://lists.openembedded.org/g/openembedded-devel/unsub  [martin.jansa@gmail.com]
>> -=-=-=-=-=-=-=-=-=-=-=-
>>
diff mbox series

Patch

diff --git a/meta-python/recipes-devtools/python/python3-h5py/0001-Use-libc.stdint-instead-of-numpy.patch b/meta-python/recipes-devtools/python/python3-h5py/0001-Use-libc.stdint-instead-of-numpy.patch
new file mode 100644
index 000000000..3c55fa697
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-h5py/0001-Use-libc.stdint-instead-of-numpy.patch
@@ -0,0 +1,27 @@ 
+From 434e1bf4ab9fa53ec1293cde86f4dbec6784e50f Mon Sep 17 00:00:00 2001
+From: Orion Poplawski <orion@nwra.com>
+Date: Thu, 22 Feb 2024 08:41:17 -0700
+Subject: [PATCH 1/2] Use libc.stdint instead of numpy
+
+Upstream-Status: Backport [https://github.com/h5py/h5py/pull/2382/commits/387a22b8c1513800c0401f496b4ed512c1639798]
+Signed-off-by: Changqing Li <changqing.li@windriver.com>
+---
+ h5py/api_types_ext.pxd                   | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/h5py/api_types_ext.pxd b/h5py/api_types_ext.pxd
+index 91acb128..55a239f5 100644
+--- a/h5py/api_types_ext.pxd
++++ b/h5py/api_types_ext.pxd
+@@ -20,7 +20,7 @@ from libc.string cimport strlen, strchr, strcpy, strncpy, strcmp,\
+ ctypedef long size_t
+ from libc.time cimport time_t
+ 
+-from numpy cimport int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t
++from libc.stdint cimport int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t
+ 
+ IF UNAME_SYSNAME != "Windows":
+     cdef extern from "unistd.h":
+-- 
+2.25.1
+
diff --git a/meta-python/recipes-devtools/python/python3-h5py/0002-Properly-cast-arguments-to-H5Lunpack_elink_val.patch b/meta-python/recipes-devtools/python/python3-h5py/0002-Properly-cast-arguments-to-H5Lunpack_elink_val.patch
new file mode 100644
index 000000000..0f77f745a
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-h5py/0002-Properly-cast-arguments-to-H5Lunpack_elink_val.patch
@@ -0,0 +1,27 @@ 
+From 9ed4f80fd482e135119086fb2015ca97dce306ae Mon Sep 17 00:00:00 2001
+From: Orion Poplawski <orion@nwra.com>
+Date: Thu, 15 Feb 2024 20:47:50 -0700
+Subject: [PATCH 2/2] Properly cast arguments to H5Lunpack_elink_val
+
+Upstream-Status: Backport [https://github.com/h5py/h5py/pull/2380/commits/704e13ac83b42898514610c4df9f32f367e767e4]
+Signed-off-by: Changqing Li <changqing.li@windriver.com>
+---
+ h5py/h5l.pyx         | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/h5py/h5l.pyx b/h5py/h5l.pyx
+index 60b252fa..af725bdb 100644
+--- a/h5py/h5l.pyx
++++ b/h5py/h5l.pyx
+@@ -184,7 +184,7 @@ cdef class LinkProxy:
+             if info.type == H5L_TYPE_SOFT:
+                 py_retval = buf
+             else:
+-                H5Lunpack_elink_val(buf, buf_size, &wtf, &ext_file_name, &ext_obj_name)
++                H5Lunpack_elink_val(buf, buf_size, &wtf, <const char **>&ext_file_name, <const char **>&ext_obj_name)
+                 py_retval = (bytes(ext_file_name), bytes(ext_obj_name))
+         finally:
+             efree(buf)
+-- 
+2.25.1
+
diff --git a/meta-python/recipes-devtools/python/python3-h5py_3.10.0.bb b/meta-python/recipes-devtools/python/python3-h5py_3.10.0.bb
index 8a9158525..d557a8188 100644
--- a/meta-python/recipes-devtools/python/python3-h5py_3.10.0.bb
+++ b/meta-python/recipes-devtools/python/python3-h5py_3.10.0.bb
@@ -7,7 +7,10 @@  LIC_FILES_CHKSUM = "file://LICENSE;md5=113251d71fb0384712c719b567261c5c"
 SRC_URI[sha256sum] = "d93adc48ceeb33347eb24a634fb787efc7ae4644e6ea4ba733d099605045c049"
 
 SRC_URI += "file://0001-setup_build.py-avoid-absolute-path.patch \
-            file://0001-Fix-Cython-3-compatibility.patch"
+            file://0001-Fix-Cython-3-compatibility.patch \
+            file://0001-Use-libc.stdint-instead-of-numpy.patch \
+            file://0002-Properly-cast-arguments-to-H5Lunpack_elink_val.patch \
+"
 
 inherit pkgconfig pypi setuptools3