Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Apr 2017 14:21:06 +0000
From:      Ruslan Bukin <ruslan.bukin@cl.cam.ac.uk>
To:        Baptiste Daroussin <bapt@FreeBSD.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r316978 - in head: contrib/zstd etc/mtree lib lib/libzstd share/mk usr.bin usr.bin/zstd
Message-ID:  <20170419142106.GA59031@bsdpad.com>
In-Reply-To: <201704152005.v3FK5M2j002459@repo.freebsd.org>
References:  <201704152005.v3FK5M2j002459@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This break RISC-V world build:
/home/br/obj//riscv.riscv64/usr/home/br/dev/freebsd-head/tmp/usr/lib/libprivatezstd.so: undefined reference to `__bswap
si2'
/home/br/obj//riscv.riscv64/usr/home/br/dev/freebsd-head/tmp/usr/lib/libprivatezstd.so: undefined reference to `__bswap
di2'

Here is patch that makes it compilable:

diff --git a/contrib/zstd/lib/common/xxhash.c b/contrib/zstd/lib/common/xxhash.c
index eb44222c5fc..d59a22a0638 100644
--- a/contrib/zstd/lib/common/xxhash.c
+++ b/contrib/zstd/lib/common/xxhash.c
@@ -206,7 +206,7 @@ static U64 XXH_read64(const void* memPtr)
 #if defined(_MSC_VER)     /* Visual Studio */
 #  define XXH_swap32 _byteswap_ulong
 #  define XXH_swap64 _byteswap_uint64
-#elif GCC_VERSION >= 403
+#elif (GCC_VERSION >= 403 && !defined(__riscv__))
 #  define XXH_swap32 __builtin_bswap32
 #  define XXH_swap64 __builtin_bswap64
 #else

Ruslan

On Sat, Apr 15, 2017 at 08:05:22PM +0000, Baptiste Daroussin wrote:
> Author: bapt
> Date: Sat Apr 15 20:05:22 2017
> New Revision: 316978
> URL: https://svnweb.freebsd.org/changeset/base/316978
> 
> Log:
>   Import zstandard 1.1.4 in base
>   
>   zstandard is a new compression library/tool which is very fast at
>   compression/decompression
>   
>   For now import as a private library
> 
> Added:
>   head/contrib/zstd/
>      - copied from r316976, vendor/zstd/dist/
>   head/lib/libzstd/
>   head/lib/libzstd/Makefile   (contents, props changed)
>   head/usr.bin/zstd/
>   head/usr.bin/zstd/Makefile   (contents, props changed)
> Modified:
>   head/etc/mtree/BSD.usr.dist
>   head/lib/Makefile
>   head/share/mk/src.libnames.mk
>   head/usr.bin/Makefile
> 
> Modified: head/etc/mtree/BSD.usr.dist
> ==============================================================================
> --- head/etc/mtree/BSD.usr.dist	Sat Apr 15 20:03:50 2017	(r316977)
> +++ head/etc/mtree/BSD.usr.dist	Sat Apr 15 20:05:22 2017	(r316978)
> @@ -17,6 +17,8 @@
>              ..
>              ucl
>              ..
> +            zstd
> +            ..
>          ..
>      ..
>      lib
> 
> Modified: head/lib/Makefile
> ==============================================================================
> --- head/lib/Makefile	Sat Apr 15 20:03:50 2017	(r316977)
> +++ head/lib/Makefile	Sat Apr 15 20:05:22 2017	(r316978)
> @@ -90,6 +90,7 @@ SUBDIR=	${SUBDIR_BOOTSTRAP} \
>  	libxo \
>  	liby \
>  	libz \
> +	libzstd \
>  	ncurses
>  
>  # Inter-library dependencies.  When the makefile for a library contains LDADD
> 
> Added: head/lib/libzstd/Makefile
> ==============================================================================
> --- /dev/null	00:00:00 1970	(empty, because file is newly added)
> +++ head/lib/libzstd/Makefile	Sat Apr 15 20:05:22 2017	(r316978)
> @@ -0,0 +1,34 @@
> +# $FreeBSD$
> +
> +LIB=	zstd
> +SRCS=	entropy_common.c \
> +	error_private.c \
> +	fse_decompress.c \
> +	pool.c \
> +	threading.c \
> +	xxhash.c \
> +	zstd_common.c \
> +	fse_compress.c \
> +	huf_compress.c \
> +	zstd_compress.c \
> +	zstdmt_compress.c \
> +	huf_decompress.c \
> +	zstd_decompress.c \
> +	zbuff_common.c \
> +	zbuff_compress.c \
> +	zbuff_decompress.c \
> +	cover.c \
> +	divsufsort.c \
> +	zdict.c
> +WARNS=	2
> +INCS=	zstd.h
> +CFLAGS+=	-I${ZSTDDIR}/lib -I${ZSTDDIR}/lib/common -DXXH_NAMESPACE=ZSTD_
> +
> +PRIVATELIB=	yes
> +
> +ZSTDDIR=	${SRCTOP}/contrib/zstd
> +.PATH:	${ZSTDDIR}/lib/common ${ZSTDDIR}/lib/compress \
> +	${ZSTDDIR}/lib/decompress ${ZSTDDIR}/lib/deprecated \
> +	${ZSTDDIR}/lib/dictBuilder ${ZSTDDIR}/lib
> +
> +.include <bsd.lib.mk>
> 
> Modified: head/share/mk/src.libnames.mk
> ==============================================================================
> --- head/share/mk/src.libnames.mk	Sat Apr 15 20:03:50 2017	(r316977)
> +++ head/share/mk/src.libnames.mk	Sat Apr 15 20:05:22 2017	(r316978)
> @@ -24,7 +24,8 @@ _PRIVATELIBS=	\
>  		sqlite3 \
>  		ssh \
>  		ucl \
> -		unbound
> +		unbound \
> +		zstd
>  
>  _INTERNALLIBS=	\
>  		amu \
> 
> Modified: head/usr.bin/Makefile
> ==============================================================================
> --- head/usr.bin/Makefile	Sat Apr 15 20:03:50 2017	(r316977)
> +++ head/usr.bin/Makefile	Sat Apr 15 20:05:22 2017	(r316978)
> @@ -189,7 +189,8 @@ SUBDIR=	alias \
>  	xo \
>  	xz \
>  	xzdec \
> -	yes
> +	yes \
> +	zstd
>  
>  # NB: keep these sorted by MK_* knobs
>  
> 
> Added: head/usr.bin/zstd/Makefile
> ==============================================================================
> --- /dev/null	00:00:00 1970	(empty, because file is newly added)
> +++ head/usr.bin/zstd/Makefile	Sat Apr 15 20:05:22 2017	(r316978)
> @@ -0,0 +1,21 @@
> +# $FreeBSD$
> +
> +PROG=	zstd
> +SRCS=	bench.c \
> +	datagen.c \
> +	dibio.c \
> +	fileio.c \
> +	zstdcli.c
> +
> +CFLAGS+=	-I${SRCTOP}/contrib/zstd/programs \
> +		-I${SRCTOP}/contrib/zstd/lib/common \
> +		-I${SRCTOP}/contrib/zstd/lib/compress \
> +		-I${SRCTOP}/contrib/zstd/lib/dictBuilder \
> +		-I${SRCTOP}/contrib/zstd/lib \
> +		-DXXH_NAMESPACE=ZSTD_
> +
> +WARNS=	2
> +LIBADD=	zstd
> +.PATH: ${SRCTOP}/contrib/zstd/programs
> +
> +.include <bsd.prog.mk>
> 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170419142106.GA59031>