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)

Cheers,

Sean

Reply via email to