[Bug 262032] [NEW PORT] devel/xnvme: Cross-platform libraries and tools for NVMe devices

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 06 Oct 2023 15:05:17 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=262032

--- Comment #4 from Robert Clausecker <fuz@FreeBSD.org> ---
Thank you for your update.  I've test-built the port and found some new issues.

 - Please use ${DISTVERSION} instead of hardcoding 0.7.1 in MASTER_SITES.  This
   makes it easier to update the port.
 - Check if e.g. sysutils might be a more appropriate category for the port.

Testing the port, it immediately fails to build due to a missing Python
dependency:

WARNING: Recommend using either -Dbuildtype or -Doptimization + -Ddebug. Using
both is redundant since they override each other. See:
https://mesonbuild.com/Builtin-options.html#build-type-options
The Meson build system
Version: 1.2.2
Source dir: /wrkdirs/usr/ports/devel/xnvme/work/xnvme-0.7.1
Build dir: /wrkdirs/usr/ports/devel/xnvme/work/xnvme-0.7.1/_build
Build type: native build
Project name: xnvme
Project version: 0.7.1
C compiler for the host machine: cc (clang 14.0.5 "FreeBSD clang version 14.0.5
(https://github.com/llvm/llvm-project.git llvmorg-14.0.5-0-gc12386ae247c)")
C linker for the host machine: cc ld.lld 14.0.5
Host machine cpu family: arm
Host machine cpu: armv7
Message: host_machine.system: freebsd
Compiler for C supports arguments -Wno-missing-braces: YES 
Compiler for C supports arguments -Wno-cast-function-type: YES 
Compiler for C supports arguments -Wno-strict-aliasing: YES 
Program python3 found: NO

meson.build:49:31: ERROR: python3 not found

A full log can be found at
/wrkdirs/usr/ports/devel/xnvme/work/xnvme-0.7.1/_build/meson-logs/meson-log.txt
WARNING: Running the setup command as `meson [options]` instead of `meson setup
[options]` is ambiguous and deprecated.
===>  Script "configure" failed unexpectedly.

This is because on FreeBSD, we do not by default install a python3 binary and
ports must not assume that it exist.
To fix this, add "USES=python:build" to the port Makefile.  This causes a
PYTHON environment variable to be defined when meson is run.  It holds the path
of the Python interpreter.  Obey that variable instead of assuming the command
is named python3.

Temporarily patching this issue by supplying

pre-configure:
        ${REINPLACE_CMD} -e s,python3,${PYTHON_CMD}, ${WRKSRC}/meson.build

in the port Makefile, the build then fails on armv7 FreeBSD 13.2 as follows:

cc -Ilib/libxnvme.so.p -Ilib -I../lib -I. -I.. -Iinclude -I../include
-fno-color-diagnostics -D_FILE_OFFSET_BITS=64 -Wa
ll -Winvalid-pch -Wextra -std=gnu11 -Wno-missing-braces -Wno-cast-function-type
-Wno-strict-aliasing -include xnvme_con
fig.h -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -fPIC -pthread
-MD -MQ lib/libxnvme.so.p/xnvme_adm.c.o -M
F lib/libxnvme.so.p/xnvme_adm.c.o.d -o lib/libxnvme.so.p/xnvme_adm.c.o -c
../lib/xnvme_adm.c                           
In file included from ../lib/xnvme_adm.c:6:
In file included from ../include/libxnvme.h:46:                                 
../include/libxnvme_cmd.h:32:1: error: static_assert failed due to requirement
'sizeof(struct xnvme_cmd_ctx) == 128' "I
ncorrect size"                                                                  
XNVME_STATIC_ASSERT(sizeof(struct xnvme_cmd_ctx) == 128, "Incorrect size") 
^                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
../include/libxnvme_util.h:16:40: note: expanded from macro
'XNVME_STATIC_ASSERT'
#define XNVME_STATIC_ASSERT(cond, msg) static_assert(cond, msg);
                                       ^             ~~~~                       
/usr/include/assert.h:73:23: note: expanded from macro 'static_assert'          
#define static_assert   _Static_assert                                          
                        ^                                                       
1 error generated.                                                              

It also fails elsewhere, but this is the first error.  Please either fix the
issue or disable armv7 (either with BROKEN_armv7 or NOT_FOR_ARCHS=armv7).  On
arm64 the build succeeds with a warning that should be addressed:

[ 26% 54/201] cc -Ilib/libxnvme.so.p -Ilib -I../lib -I. -I.. -Iinclude
-I../include -fno-color-diagnostics -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch
-Wextra -std=gnu11 -Wno-missing-braces -Wno-cast-function-type
-Wno-strict-aliasing -include xnvme_config.h -O2 -pipe -fstack-protector-strong
-fno-strict-aliasing -fPIC -pthread -MD -MQ lib/libxnvme.so.p/xnvme_buf.c.o -MF
lib/libxnvme.so.p/xnvme_buf.c.o.d -o lib/libxnvme.so.p/xnvme_buf.c.o -c
../lib/xnvme_buf.c
../lib/xnvme_buf.c:255:68: warning: format specifies type 'unsigned long long'
but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
                printf("    - {byte: '%06llu', expected: 0x%x, actual:
0x%x)\n", i, exp[i],
                                      ~~~~~~                                   
 ^
                                      %06zu
1 warning generated.

Please check these issues and resubmit.  I have so far not tested on x86 yet.

-- 
You are receiving this mail because:
You are the assignee for the bug.