Friday, March 04, 2022

Re: [sparc64] Fix build of archivers/snappy

On Thu, Mar 03, 2022 at 12:31:06AM -0500, Kurt Mosiejczuk wrote:
> snappy 1.1.9 explodes horribly on sparc64:
>
> /usr/obj/ports/snappy-1.1.9/bin/c++ -DHAVE_CONFIG_H -Dsnappy_EXPORTS -I. -I/usr/obj/ports/snappy-1.1.9/snappy-1.1.9 -O2 -pipe -Wall -Wextra -fno-exceptions -fno-rtti -DNDEBUG -fPIC -std=c++11 -MD -MT CMakeFiles/snappy.dir/snappy.cc.o -MF CMakeFiles/snappy.dir/snappy.cc.o.d -o CMakeFiles/snappy.dir/snappy.cc.o -c /usr/obj/ports/snappy-1.1.9/snappy-1.1.9/snappy.cc
> /usr/obj/ports/snappy-1.1.9/snappy-1.1.9/snappy.cc:1017:8: warning: always_inline function might not be inlinable [-Wattributes]
> size_t AdvanceToNextTag(const uint8_t** ip_p, size_t* tag) {
> ^~~~~~~~~~~~~~~~
> /usr/obj/ports/snappy-1.1.9/snappy-1.1.9/snappy.cc: In function 'std::pair<const unsigned char*, long int> snappy::DecompressBranchless(const uint8_t*, const uint8_t*, ptrdiff_t, T, ptrdiff_t) [with T = char*]':
> /usr/obj/ports/snappy-1.1.9/snappy-1.1.9/snappy.cc:1017:8: error: inlining failed in call to always_inline 'size_t snappy::AdvanceToNextTag(const uint8_t**, size_t*)': function body can be overwritten at link time
> /usr/obj/ports/snappy-1.1.9/snappy-1.1.9/snappy.cc:1097:43: note: called from here
> size_t tag_type = AdvanceToNextTag(&ip, &tag);
>
> ...
>
> There's a bit more.
>
> This patch makes it _not_ set always_inline on sparc64. This fixes the build.

No need for a patch, you could pass `-U HAVE_ATTRIBUTE_ALWAYS_INLINE` in
our Makefile.

We could also disable the flag that triggers this?

Index: Makefile
===================================================================
RCS file: /home/cvs/ports/archivers/snappy/Makefile,v
retrieving revision 1.13
diff -u -p -r1.13 Makefile
--- Makefile 30 Mar 2020 20:43:50 -0000 1.13
+++ Makefile 4 Mar 2022 10:28:17 -0000
@@ -19,6 +19,10 @@ WANTLIB += m ${COMPILER_LIBCXX}

COMPILER = base-clang ports-gcc base-gcc

+.if ${MACHINE_ARCH} == sparc64
+CFLAGS += -Wno-attributes
+.endif
+
MODULES = devel/cmake

CONFIGURE_ARGS += -DBUILD_SHARED_LIBS=ON \




>
> ok?
>
> --Kurt
>
> Index: patches/patch-snappy-stubs-internal_h
> ===================================================================
> RCS file: patches/patch-snappy-stubs-internal_h
> diff -N patches/patch-snappy-stubs-internal_h
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-snappy-stubs-internal_h 3 Mar 2022 05:28:19 -0000
> @@ -0,0 +1,14 @@
> +Don't set this for sparc64, it keeps it from building
> +
> +Index: snappy-stubs-internal.h
> +--- snappy-stubs-internal.h.orig
> ++++ snappy-stubs-internal.h
> +@@ -99,7 +99,7 @@
> +

No comments:

Post a Comment