diff --git a/src/common.cpp b/src/common.cpp index 7dad9f72d..f30b81e2f 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -1995,7 +1995,7 @@ std::string get_executable_path(const char *argv0) { // https://opensource.apple.com/source/adv_cmds/adv_cmds-163/ps/print.c uint32_t buffSize = sizeof buff; if (_NSGetExecutablePath(buff, &buffSize) == 0) return std::string(buff); -#elif defined(__BSD__) +#elif defined(__BSD__) && defined(KERN_PROC_PATHNAME) // BSDs do not have /proc by default, (although it can be mounted as procfs via the Linux // compatibility layer). We can use sysctl instead: per sysctl(3), passing in a process ID of -1 // returns the value for the current process.