Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 06 Jan 2024 18:58:35 +0000
From:      bugzilla-noreply@freebsd.org
To:        ports-bugs@FreeBSD.org
Subject:   [Bug 276159] net/mosh: fix build with clang 18
Message-ID:  <bug-276159-7788@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D276159

            Bug ID: 276159
           Summary: net/mosh: fix build with clang 18
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: zi@FreeBSD.org
          Reporter: dim@FreeBSD.org
          Assignee: zi@FreeBSD.org
             Flags: maintainer-feedback?(zi@FreeBSD.org)

Clang 18 is more strict about how builtin functions are used, resulting
in an error building net/mosh:

  ocb_internal.cc:752:22: error: use of undeclared identifier 'bswap64'
    752 |                         ctx->KtopStr[0] =3D bswap64(ctx->KtopStr[=
0]);
        |                                           ^
  ocb_internal.cc:753:22: error: use of undeclared identifier 'bswap64'
    753 |                         ctx->KtopStr[1] =3D bswap64(ctx->KtopStr[=
1]);
        |                                           ^

The problem is that __builtin_bswap64 is not being detected correctly by
the configure script (the existence of the regular bswap64 is forced via
ac_cv_have_decl_bswap64=3Dyes in CONFIGURE_ENV):

  checking whether be64toh is declared... yes
  checking whether betoh64 is declared... no
  checking whether bswap64 is declared... (cached) yes
  checking whether __builtin_bswap64 is declared... no

This is because configure attempts to detect __builtin_bswap64 via the
following C fragment:

  int
  main (void)
  {
  #ifndef __builtin_bswap64
  #ifdef __cplusplus
    (void) __builtin_bswap64;
  #else
    (void) __builtin_bswap64;
  #endif
  #endif

which results in an error:

  conftest.cpp:80:10: error: builtin functions must be directly called
     80 |   (void) __builtin_bswap64;
        |          ^

Work around it by adding ac_cv_have_decl___builtin_bswap64=3Dyes to
CONFIGURE_ENV too.

While here, swap around the HAVE_DECL___BUILTIN_BSWAP64 and
HAVE_DECL_BSWAP64 blocks in src/crypto/ocb_internal.cc, so it prefers to
use the builtin before calling any external function or macro.

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



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