truenas / py-libzfs

Python libzfs bindings
GNU Lesser General Public License v3.0
81 stars 24 forks source link

Build error on FreeBSD 14.1-RELEASE #274

Open jurajlutter opened 4 months ago

jurajlutter commented 4 months ago

While trying to build devel/py-libzfs on recent FreeBSD 14.1-RELEASE, I've come across the following:

libzfs.c:950:11: warning: 'likely' macro redefined [-Wmacro-redefined]
  950 |   #define likely(x)   __builtin_expect(!!(x), 1)
      |           ^
/usr/src/sys/contrib/openzfs/include/sys/zfs_context.h:131:9: note: previous definition is here
  131 | #define likely(x)       __builtin_expect((x), 1)
      |         ^
libzfs.c:951:11: warning: 'unlikely' macro redefined [-Wmacro-redefined]
  951 |   #define unlikely(x) __builtin_expect(!!(x), 0)
      |           ^
/usr/src/sys/contrib/openzfs/include/sys/zfs_context.h:132:9: note: previous definition is here
  132 | #define unlikely(x)     __builtin_expect((x), 0)
      |         ^
libzfs.c:1267:3: error: unknown type name 'pool_raidz_expand_stat_t'
 1267 |   pool_raidz_expand_stat_t *stats;
      |   ^
libzfs.c:6488:46: warning: passing 'char **' to parameter of type 'const char **' discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
 6488 |     (void)(nvpair_value_string(__pyx_v_pair, (&__pyx_v_cstr)));
      |                                              ^~~~~~~~~~~~~~~
/usr/src/sys/contrib/openzfs/include/sys/nvpair.h:291:70: note: passing argument to parameter here
  291 | _SYS_NVPAIR_H int nvpair_value_string(const nvpair_t *, const char **);
      |                                                                      ^
libzfs.c:7461:52: warning: passing 'char ***' to parameter of type 'const char ***' discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
 7461 |     (void)(nvpair_value_string_array(__pyx_v_pair, ((char ***)(&__pyx_v_carray)), (&__pyx_v_carraylen)));
      |                                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/contrib/openzfs/include/sys/nvpair.h:304:71: note: passing argument to parameter here
  304 | _SYS_NVPAIR_H int nvpair_value_string_array(nvpair_t *, const char ***,
      |                                                                       ^
libzfs.c:9323:72: warning: passing 'char **' to parameter of type 'const char *const *' discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
 9323 |       (void)(nvlist_add_string_array(__pyx_v_self->handle, __pyx_t_34, ((char **)__pyx_v_carray), __pyx_t_29));
      |                                                                        ^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/contrib/openzfs/include/sys/nvpair.h:204:25: note: passing argument to parameter here
  204 |     const char * const *, uint_t);
      |                         ^
libzfs.c:10709:72: warning: passing 'nvlist_t **' (aka 'struct nvlist **') to parameter of type 'const nvlist_t *const *' (aka 'const struct nvlist *const *') discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
 10709 |       (void)(nvlist_add_nvlist_array(__pyx_v_self->handle, __pyx_t_45, ((nvlist_t **)__pyx_v_carray), __pyx_t_29));
       |                                                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/contrib/openzfs/include/sys/nvpair.h:206:29: note: passing argument to parameter here
  206 |     const nvlist_t * const *, uint_t);
      |                             ^
libzfs.c:54414:170: error: use of undeclared identifier 'ZPOOL_CONFIG_RAIDZ_EXPAND_STATS'
 54414 |   __pyx_v_ret = ((struct __pyx_vtabstruct_6libzfs_NVList *)__pyx_v_nvroot->__pyx_vtab)->nvlist_lookup_uint64_array(__pyx_v_nvroot, ((nvlist_t *)__pyx_v_nvroot->handle), ZPOOL_CONFIG_RAIDZ_EXPAND_STATS, ((uint64_t **)(&__pyx_v_self->stats)), (&__pyx_v_total));
       |                                                                                                                                                                          ^
libzfs.c:62885:88: warning: passing 'char **' to parameter of type 'const char **' discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
 62885 |     __pyx_t_4 = __Pyx_PyInt_From_zpool_status_t(zpool_get_status(__pyx_v_self->handle, (&__pyx_v_msg_id), NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3011, __pyx_L1_error)
       |                                                                                        ^~~~~~~~~~~~~~~~~
/usr/src/sys/contrib/openzfs/include/libzfs.h:449:74: note: passing argument to parameter here
  449 | _LIBZFS_H zpool_status_t zpool_get_status(zpool_handle_t *, const char **,
      |                                                                          ^
libzfs.c:87520:85: warning: passing 'const char *' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
 87520 |         __pyx_v_ret = zfs_destroy_snaps(__pyx_v_self->__pyx_base.__pyx_base.handle, __pyx_v_c_name, __pyx_v_defer_deletion);
       |                                                                                     ^~~~~~~~~~~~~~
/usr/src/sys/contrib/openzfs/include/libzfs.h:729:55: note: passing argument to parameter here
  729 | _LIBZFS_H int zfs_destroy_snaps(zfs_handle_t *, char *, boolean_t);
      |                                                       ^
8 warnings and 2 errors generated.

Let aside warning, the errors are preventing py-libzfs from built. I even tried to blindly use the most recent commit (3d3fce5) to no avail.

I don't have much insight into OpenZFS code and/or changes.

Could someone with better insight have a look?

Thanks.

ddurieux commented 4 months ago

+1 same error :/

ddurieux commented 4 months ago

ah not same error, mine is:

libzfs.c:63310:81: error: too few arguments to function call, expected 3, have 2
 63310 |         __pyx_v_ret = zpool_add(__pyx_v_self->handle, __pyx_v_vd->nvlist->handle);
ddurieux commented 4 months ago

It's fixed in lst release of this lib, the FreeBSD port not up to date, that's why we have the error, for me we can close this issue