freebsd-ports/net/libfabric/Makefile
Dimitry Andric 26bc5ce8ba net/libfabric: fix build with clang 16
Clang 16 has a new error about incompatible function types, which shows
up when building net/libfabric (on i386):

  prov/hook/src/hook_domain.c:124:12: error: incompatible function pointer types passing 'ssize_t (struct fid_ep *, size_t)' (aka 'int (struct fid_ep *, unsigned int)') to parameter of type 'ssize_t (*)(struct fid_ep *, uint64_t)' (aka 'int (*)(struct fid_ep *, unsigned long long)') [-Wincompatible-function-pointer-types]
                                                       hook_credit_handler);
                                                       ^~~~~~~~~~~~~~~~~~~
  prov/hook/src/hook_domain.c:150:17: error: incompatible function pointer types initializing 'void (*)(struct fid_ep *, uint64_t)' (aka 'void (*)(struct fid_ep *, unsigned long long)') with an expression of type 'void (struct fid_ep *, size_t)' (aka 'void (struct fid_ep *, unsigned int)') [-Wincompatible-function-pointer-types]
          .add_credits = hook_add_credits,
                         ^~~~~~~~~~~~~~~~
  prov/hook/src/hook_domain.c:152:22: error: incompatible function pointer types initializing 'void (*)(struct fid_domain *, ssize_t (*)(struct fid_ep *, uint64_t))' (aka 'void (*)(struct fid_domain *, int (*)(struct fid_ep *, unsigned long long))') with an expression of type 'void (struct fid_domain *, ssize_t (*)(struct fid_ep *, size_t))' (aka 'void (struct fid_domain *, int (*)(struct fid_ep *, unsigned int))') [-Wincompatible-function-pointer-types]
          .set_send_handler = hook_set_send_handler,
                              ^~~~~~~~~~~~~~~~~~~~~

The problem is that the 'credits' parameter used in these functions is
size_t in some cases, but uint64_t in other cases. On LP64 architectures
this does not result in any errors, but on e.g. i386 you get the above.

Make the 'credits' parameter uint64_t everywhere to fix this issue.

PR:		271537
Approved by:	yuri (maintainer)
MFH:		2023Q2
2023-05-20 22:02:45 +02:00

62 lines
2 KiB
Makefile

PORTNAME= libfabric
DISTVERSION= 1.15.1
PORTREVISION= 1
CATEGORIES= net
MASTER_SITES= https://github.com/ofiwg/${PORTNAME}/releases/download/v${DISTVERSION}/
MAINTAINER= yuri@FreeBSD.org
COMMENT= Open Fabric Interfaces
WWW= https://ofiwg.github.io/libfabric/
LICENSE= BSD2CLAUSE
LICENSE_FILE= ${WRKSRC}/COPYING
BUILD_DEPENDS= bash:shells/bash
LIB_DEPENDS= libepoll-shim.so:devel/libepoll-shim
USES= gmake libtool pkgconfig tar:bz2
USE_LDCONFIG= yes
GNU_CONFIGURE= yes
CONFIGURE_ARGS= --disable-static
CONFIGURE_SHELL= ${LOCALBASE}/bin/bash # workaround for https://github.com/ofiwg/libfabric/issues/7901
CFLAGS+= -I${LOCALBASE}/include/libepoll-shim
LDFLAGS+= -L${LOCALBASE}/lib -lepoll-shim
INSTALL_TARGET= install-strip
OPTIONS_MULTI= PROVIDERS
OPTIONS_MULTI_PROVIDERS= RXD RXM SOCKETS TCP UDP
OPTIONS_DEFAULT= ${OPTIONS_MULTI_PROVIDERS}
OPTIONS_SUB= yes
PROVIDERS_DESC= Providers to build:
OPTIONS_MULTI_PROVIDERS+= VERBS
VERBS_PLIST_FILES= man/man7/fi_verbs.7.gz
.for p in ${OPTIONS_MULTI_PROVIDERS}
${p}_DESC= '${p:tl}' provider
${p}_CONFIGURE_ENABLE= ${p:tl}
.endfor
SED_WRAP_CLOSE= { \
i\\\n \
\#ifdef SHIM_SYS_SHIM_HELPERS\\\n \
\#undef close\\\n \
\#endif\n \
a\\\n \
\#ifdef SHIM_SYS_SHIM_HELPERS\\\n \
\#define close epoll_shim_close\\\n \
\#endif\n \
}
post-patch:
@${FIND} ${WRKSRC} -name "*.[ch]" -and -exec ${GREP} -q '<asm/types\.h>' {} \; -print | ${XARGS} ${REINPLACE_CMD} 's|<asm/types\.h>|<sys/types.h>|'
@${FIND} ${WRKSRC} -name "*.[ch]" -and -exec ${GREP} -q '<malloc\.h>' {} \; -print | ${XARGS} ${REINPLACE_CMD} 's|<malloc\.h>|<stdlib.h>|'
@${FIND} ${WRKSRC} -name "*.[ch]" -and -exec ${GREP} -q '<alloca\.h>' {} \; -print | ${XARGS} ${REINPLACE_CMD} 's|<alloca\.h>|<stdlib.h>|'
@${GREP} -Flr --include='*.c' '.close' ${WRKSRC} | ${XARGS} ${REINPLACE_CMD} $$'/\\.close/${SED_WRAP_CLOSE}'
@${REINPLACE_CMD} $$'/fi_ops.*close/${SED_WRAP_CLOSE}' ${WRKSRC}/src/fabric.c
@${REINPLACE_CMD} $$'/[*>]close/${SED_WRAP_CLOSE}' ${WRKSRC}/include/rdma/fabric.h
.include <bsd.port.mk>