Bug 281521

Summary: security/libretls: fix build with clang 19
Product: Ports & Packages Reporter: Dimitry Andric <dim>
Component: Individual Port(s)Assignee: Baptiste Daroussin <bapt>
Status: Closed FIXED    
Severity: Affects Some People Flags: bugzilla: maintainer-feedback? (bapt)
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Bug Depends on:    
Bug Blocks: 280562    
Attachments:
Description Flags
security/libretls: fix build with clang 19 none

Description Dimitry Andric freebsd_committer freebsd_triage 2024-09-15 16:54:23 UTC
Clang 19 has become more strict about function redefinitions, which
results in:

  compat/arc4random.c:197:1: error: redefinition of 'arc4random_buf'
    197 | arc4random_buf(void *buf, size_t n)
        | ^
  /usr/include/ssp/stdlib.h:38:22: note: previous definition is here
     38 | __ssp_redirect(void, arc4random_buf, (void *__buf, size_t __len),
        |                      ^

The problem is that the configure script "detects" arc4random_buf just
fine, due to the ports system passing ac_cv_func_arc4random_buf=yes, but
it also has an overriding part:

  # fork detection missing, weak seed on failure
  # https://svnweb.freebsd.org/base/head/lib/libc/gen/arc4random.c?revision=268642&view=markup
  USE_BUILTIN_ARC4RANDOM=yes

I think both of these are no longer true, so delete these lines in
post-patch, which ensures that compat/arc4random.c is _not_ compiled at
all.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2024-09-15 16:55:50 UTC
Created attachment 253587 [details]
security/libretls: fix build with clang 19
Comment 2 Baptiste Daroussin freebsd_committer freebsd_triage 2024-09-17 07:32:34 UTC
fixed another way, thank ;)