fix: don't crash on startup on macOS

This is caused, through several layers of absurdity, by runtime type
information of Nix things being invisible due to -fvisibility=hidden
inside n-e-j.

We don't have any idea why n-e-j has -fvisibility=hidden, since blame
says it's from the initial commit. It is plausible that it was some
ill-advised optimization but it's not sound.

The crash is caused by dynamic_cast<RootArgs *>(MyArgs *) failing, which
is in turn caused by the RTTI being invisible.

See: https://www.qt.io/blog/quality-assurance/one-way-dynamic_cast-across-library-boundaries-can-fail-and-how-to-fix-it
Fixes: #2
This commit is contained in:
jade 2024-05-27 18:23:13 -06:00 committed by Lunaphied
parent 13524829d1
commit 30cf61fd26
2 changed files with 2 additions and 2 deletions

View file

@ -12,7 +12,7 @@
class MyArgs : virtual public nix::MixEvalArgs,
virtual public nix::MixCommonArgs,
virtual nix::RootArgs {
virtual public nix::RootArgs {
public:
std::string releaseExpr;
nix::Path gcRootsDir;

View file

@ -31,4 +31,4 @@ executable('nix-eval-jobs', src,
threads_dep
],
install: true,
cpp_args: ['-std=c++2a', '-fvisibility=hidden', '--include', 'autotools-config.h'])
cpp_args: ['-std=c++2a', '--include', 'autotools-config.h'])