On Sun, Oct 08, 2023 at 10:14:22PM -0400, Sean McBride wrote:
> Hello,
> 
> I've been trying to compile some open source C/C++ code on OpenBSD (that
> already builds on Mac, Windows, and linux) and one error I hit on one
> project was a link error trying to link to the backtrace() function.
> 
> So I went to check the man page.  But the man page does not document what
> linker flag is needed.  Luckily the FreeBSD man page does.
> 
> Contrast the first few lines of each:
> 
> -----------------------------------------------
> FreeBSD:
> 
> NAME
>        backtrace -- fill in the       backtrace of the currently executing 
> thread
> 
> LIBRARY
>        Backtrace Access       Library (libexecinfo, -lexecinfo)
> 
> SYNOPSIS
>        #include       <execinfo.h>
> -----------------------------------------------
> 
> 
> -----------------------------------------------
> OpenBSD:
> 
> NAME
>        backtrace,         backtrace_symbols,           backtrace_symbols_fd,
>        backtrace_symbols_fmt, backtrace_symbols_fd_fmt -- fill        in  the 
> back-
>        trace of       the currently executing thread
> 
> SYNOPSIS
>        #include       <execinfo.h>
> -----------------------------------------------
> 
> 
> So tldr: `man backtrace` should name the required linker flag (-lexecinfo)

from mdoc(7):

.\" .Sh LIBRARY
.\" For sections 2, 3, and 9 only.
.\" Not used in OpenBSD.

note about it not being used added by jmc@ in 2010

Only use in base is in libelf.

Reply via email to