Re: FreeBSD-head-riscv64-build - Build #9623 (r336573) - Failure

From: Li-Wen Hsu <lwhsu_at_FreeBSD.org>
Date: Sun, 22 Jul 2018 01:01:16 +0000
On Sun, Jul 22, 2018 at 02:18:32 +0300, Konstantin Belousov wrote:
> On Sat, Jul 21, 2018 at 02:16:17AM +0000, jenkins-admin_at_FreeBSD.org wrote:
> > --- lib/ofed/libmlx5__L ---
> > In file included from /workspace/src/contrib/ofed/libmlx5/mlx5.h:44:0,
> >                  from /workspace/src/contrib/ofed/libmlx5/buf.c:42:
> > /workspace/obj/workspace/src/riscv.riscv64/tmp/usr/include/infiniband/udma_barrier.h:108:2: error: #error No architecture specific memory barrier defines found!
> >  #error No architecture specific memory barrier defines found!
> >   ^~~~~
> 
> The patch below should be enough to fix the build,  modulo the syntax
> errors which I cannot check.  The reason is that it seems riscv is not
> cross-buildable from stable/11 host:
> --- includes_subdir_include/rpcsvc ---
> RPCGEN_CPP=cpp\ -target\ riscv64-unknown-freebsd12.0\ --sysroot=/usr/home/konstantinb/build/bsd/DEV/obj/usr/home/konstantinb/build/bsd/DEV/src/riscv.riscv64/tmp\ -B/usr/local rpcgen -C -h -DWANT_NFS3 /usr/home/konstantinb/build/bsd/DEV/src/include/rpcsvc/klm_prot.x -o klm_prot.h
> --- key_prot.h ---
> error: unknown target triple 'riscv64-unknown-freebsd12.0', please use -triple or -arch
> *** [key_prot.h] Error code 1
> 
> make[4]: stopped in /usr/home/konstantinb/build/bsd/DEV/src/include/rpcsvc
> 
> So if somebody who care about riscv and can build the world could
> confirm the fix, I will commit it.
> 
> diff --git a/contrib/ofed/include/udma_barrier.h b/contrib/ofed/include/udma_barrier.h
> index 71d264f8dce..6709d4433a7 100644
> --- a/contrib/ofed/include/udma_barrier.h
> +++ b/contrib/ofed/include/udma_barrier.h
> _at__at_ -104,6 +104,10 _at__at_
>  #include <sys/types.h>
>  #include <machine/atomic.h>
>  #define udma_to_device_barrier() dmb()
> +#elif defined(__riscv__)
> +#include <sys/types.h>
> +#include <machine/atomic.h>
> +#define	udma_to_device_barrier() fence()
>  #else
>  #error No architecture specific memory barrier defines found!
>  #endif

Thanks for looking into this.  Attached patch is slightly modified.
RISC-V is using __riscv and there are few more atomic macros need to be
defined.

However this seems not enough, there are some c++ errors which may take
longer to fix:

In file included from /usr/home/lwhsu/freebsd-src/contrib/ofed/librdmacm/cma.h:43:0,
                 from /usr/home/lwhsu/freebsd-src/contrib/ofed/librdmacm/acm.c:42:
/usr/home/lwhsu/freebsd-src/contrib/ofed/librdmacm/cma.h: In function 'fastlock_init':
/usr/home/lwhsu/freebsd-src/contrib/ofed/librdmacm/cma.h:60:2: error: invalid initializer
  atomic_store(&lock->cnt, 0);
  ^
In file included from /usr/home/lwhsu/freebsd-src/contrib/ofed/librdmacm/acm.c:42:0:
/usr/home/lwhsu/freebsd-src/contrib/ofed/librdmacm/cma.h: In function 'fastlock_acquire':
/usr/home/lwhsu/freebsd-src/contrib/ofed/librdmacm/cma.h:68:2: error: operand type 'struct <anonymous> *' is incompatible with argument 1 of '__atomic_fetch_add'
  if (atomic_fetch_add(&lock->cnt, 1) > 0)
  ^~
/usr/home/lwhsu/freebsd-src/contrib/ofed/librdmacm/cma.h: In function 'fastlock_release':
/usr/home/lwhsu/freebsd-src/contrib/ofed/librdmacm/cma.h:73:2: error: operand type 'struct <anonymous> *' is incompatible with argument 1 of '__atomic_fetch_sub'
  if (atomic_fetch_sub(&lock->cnt, 1) > 1)
  ^~
*** [acm.o] Error code 1

make[6]: stopped in /usr/home/lwhsu/freebsd-src/lib/ofed/librdmacm


BTW, stable/11 should be fine to cross-build riscv64, this job uses
11.2-RELEASE and riscv64-xtoolchain-gcc package, with
CROSS_TOOLCHAIN=riscv64-gcc defined.


Best,
Li-Wen

-- 
Li-Wen Hsu <lwhsu_at_FreeBSD.org>
https://lwhsu.org

Received on Sat Jul 21 2018 - 23:01:18 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:17 UTC