This page is a collection of the sometimes mysterious error messages from CPAN testers when compiling or running XS modules.
Free to wrong pool
This happens when C
malloc is used with the Perl
free. It occurs with a Perl built with
threads for Windows (
solution of the problem is to use Perl's memory allocators
Safefree as described in
perlclib. Another solution may be to undefine Perl's
redefinition of "free". See [Win32] "Free to wrong pool ..." error at Perlmonks.
Not a CODE reference
This is caused on some systems by giving a value to
error: too few arguments to function 'Perl_vwarn'
This is caused by using the prefix
Perl_ when calling
functions such as
Perl_croak. It can be resolved by using
Undefined PLT symbol "_Unwind_Resume" (symnum = 166)
This is an error which occurs on the NetBSD operating system. It
-lgcc_s to be added to the compile line.
perl: fatal: relocation error
This is a known error with Perl on Solaris related to the use of different assemblers. See perlsolaris. This error seems to indicate something wrong with the testing computer rather than the program, and is probably not resolvable by the module programmer.
Unknown error - dlerror() not implemented
This seems to happen on Linux. The error string is on line 138 of DynaLoader.xs.
error: 'my_perl' undeclared
Related to this? https://github.com/ambs/text-ngram/pull/1/files
#define PERL_UNUSED_CONTEXT PERL_UNUSED_ARG(my_perl)
error C2143: syntax error : missing ';' before 'type'
This is an error of the Microsoft C compiler. It is caused by having a variable declared in the CODE: section of an XS file. Use the PREINIT: section of the XS file instead.
warning: passing argument 3 of 'Perl_sv_2pv_flags' from incompatible pointer type
This bubbles up from uses of the
SvPV macro when the
programmer uses a non-STRLEN variable for the length of a string on a
char * x; unsigned xlen; x = SvPV (sv, xlen);
It's actually possible to cause segmentation violation and other
memory errors with some combinations of compilers and interpreters, so
be diligent about using
STRLEN for string lengths:
char * x; STRLEN xlen; x = SvPV (sv, xlen);
wstat 1280, 0x500
Segmentation fault on Windows.
Non-zero wait status: 138
This error occurs in OpenBSD tests of XS modules.
The "non-zero wait status" seems to be 128 + the signal which killed the child process during a call to the system call "wait". So the signal is 10, which means "bus error". In other words, a memory error occurred during the execution which halted the test process and returned this status to the calling process.
Non-zero wait status: 139
This indicates a segmentation fault error on BSD operating systems.
Bizarre copy of hash in subroutine entry
"Bizarre copy of ... " errors may be caused by a variety of
conditions. It's actually an error from the file
where it looks at a variable's type. This fatal error happens when
Perl examines a scalar and cannot work out what to do with it.
Generally this indicates some kind of corruption has occurred.
For example, this has happened to me by putting a badly-formatted reference on the stack before calling a Perl routine from C. See perlcall.
Another way this has happened to me is by taking a pointer in the C to
a Perl scalar, but forgetting to increment its reference count with
SvREFCNT_inc, then when the scalar was eventually used,
it had been overwritten, causing this error to occur.
... in subroutine entry
An error with its location given as "in subroutine entry" is occuring within your XS or C code rather than in Perl and the Perl interpreter cannot give the line number. The best it can do is say that the error occurred somewhere after the subroutine that it points to.
At the time of creating this page, the CPAN testers website was not indexable by Google (it was forbidden or heavily dampened by "robots.txt"). That means when a module author who uses Perl XS to write a module received a bug report with an obscure message like "Free to wrong pool", it was hard to find distributions with similar bugs.
Blog article on error message "Attempt to free unreferenced scalar: SV 0xDEADBEEF".
An older page on this site, before I got organized.
A very useful "code search engine" which searches the latest versions of modules on CPAN. The search is case-sensitive.