Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable the crash handler if execinfo=no scons option is set #88520

Merged
merged 1 commit into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions platform/linuxbsd/crash_handler_linuxbsd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
#include "core/version.h"
#include "main/main.h"

#ifdef DEBUG_ENABLED
#define CRASH_HANDLER_ENABLED 1
#ifndef DEBUG_ENABLED
#undef CRASH_HANDLER_ENABLED
#endif

#ifdef CRASH_HANDLER_ENABLED
Expand Down
18 changes: 12 additions & 6 deletions platform/linuxbsd/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def get_opts():
BoolVariable("wayland", "Enable Wayland display", True),
BoolVariable("libdecor", "Enable libdecor support", True),
BoolVariable("touch", "Enable touch events", True),
BoolVariable("execinfo", "Use libexecinfo on systems where glibc is not available", False),
BoolVariable("execinfo", "Use libexecinfo on systems where glibc is not available", None),
]


Expand Down Expand Up @@ -487,14 +487,20 @@ def configure(env: "SConsEnvironment"):
if platform.system() == "Linux":
env.Append(LIBS=["dl"])

if not env["execinfo"] and platform.libc_ver()[0] != "glibc":
if platform.libc_ver()[0] != "glibc":
# The default crash handler depends on glibc, so if the host uses
# a different libc (BSD libc, musl), fall back to libexecinfo.
print("Note: Using `execinfo=yes` for the crash handler as required on platforms where glibc is missing.")
env["execinfo"] = True
if not "execinfo" in env:
print("Note: Using `execinfo=yes` for the crash handler as required on platforms where glibc is missing.")
env["execinfo"] = True

if env["execinfo"]:
env.Append(LIBS=["execinfo"])
if env["execinfo"]:
env.Append(LIBS=["execinfo"])
env.Append(CPPDEFINES=["CRASH_HANDLER_ENABLED"])
else:
print("Note: Using `execinfo=no` disables the crash handler on platforms where glibc is missing.")
else:
env.Append(CPPDEFINES=["CRASH_HANDLER_ENABLED"])

if platform.system() == "FreeBSD":
env.Append(LINKFLAGS=["-lkvm"])
Expand Down
Loading