perl: unset NDEBUG after loading Perl headers
Otherwise, loading Perl bindings fails early with[1]
undefined symbol: Perl_pad_sv at /nix/store/h2jsb5i4yfblr2f3ac2c7zpmlmj7zjym-perl-5.40.0/lib/perl5/5.40.0/XSLoader.pm line 94
Apparently, it's expected behavior by Perl that this symbol only exists
with `DEBUGGING` being set, hence it's used by the headers. However,
`pkgs.perl` from nixpkgs is apparently not built with `-DDEBUGGING`
causing this error.
Now, `NDEBUG` is manually unset after loading the Perl
headers rather than setting `DEBUGGING` causing the error mentioned
above.
I confirmed that this not only fixes the problem described above, but
running the Hydra tests with
diff --git a/perl/lib/Nix/Store.xs b/perl/lib/Nix/Store.xs
index dfdd64d28..14788266c 100644
--- a/perl/lib/Nix/Store.xs
+++ b/perl/lib/Nix/Store.xs
@@ -27,6 +27,7 @@ using namespace nix;
static AsyncIoRoot & aio()
{
+assert(false);
static thread_local AsyncIoRoot root;
return root;
}
still results in assertion errors.
Finally, added a small install-check that importing `Nix::Store` works
fine.
[1] https://git.lix.systems/lix-project/hydra/issues/69
Change-Id: I58521777eb0f94b766a9813aa4bbd06f9052bd35
This commit is contained in:
@@ -57,5 +57,10 @@ perl.pkgs.toPerlModule (
|
||||
postUnpack = "sourceRoot=$sourceRoot/perl";
|
||||
|
||||
passthru = { inherit perl; };
|
||||
|
||||
doInstallCheck = true;
|
||||
installCheckPhase = ''
|
||||
env PERL5LIB="$PERL5LIB:$out/${perl.libPrefix}" perl -e 'use Nix::Store'
|
||||
'';
|
||||
}
|
||||
)
|
||||
|
||||
@@ -5,14 +5,12 @@
|
||||
// can i make it any more obvious?
|
||||
#include "lix/libutil/result.hh"
|
||||
|
||||
// Without this, Perl defines NDEBUG, which makes the assertions
|
||||
// ineffective and might break Lix
|
||||
#define DEBUGGING
|
||||
|
||||
#include "EXTERN.h"
|
||||
#include "perl.h"
|
||||
#include "XSUB.h"
|
||||
|
||||
#undef NDEBUG
|
||||
|
||||
/* Prevent a clash between some Perl and libstdc++ macros. */
|
||||
#undef do_open
|
||||
#undef do_close
|
||||
|
||||
Reference in New Issue
Block a user