Bug#752354: perl: trivial test C program fails to compile

Russ Allbery rra at debian.org
Mon Jun 23 08:19:28 UTC 2014


Niko Tyni <ntyni at debian.org> writes:

> Thanks for looking at this.

> The probe doesn't actually use anything from the headers, it just
> includes them:

> #include <XSUB.h>
> #include <EXTERN.h>
> #include <perl.h>
> int main() { return 0; }

> It's not clear to me that this should require libperl linkage?

It's from a static inline function defined in the headers.  See perl.h:

#ifndef PERL_NO_INLINE_FUNCTIONS
/* Static inline funcs that depend on includes and declarations above.
   Some of these reference functions in the perl object files, and some
   compilers aren't smart enough to eliminate unused static inline
   functions, so including this file in source code can cause link errors
   even if the source code uses none of the functions. Hence including these
   can be be suppressed by setting PERL_NO_INLINE_FUNCTIONS. Doing this will
   (obviously) result in unworkable XS code, but allows simple probing code
   to continue to work, because it permits tests to include the perl headers
   for definitions without creating a link dependency on the perl library
   (which may not exist yet).
*/

#  include "inline.h"
#endif

So the solution is to either always link with the Perl flags, not just
compile, or to define that macro in probes.

-- 
Russ Allbery (rra at debian.org)               <http://www.eyrie.org/~eagle/>




More information about the Perl-maintainers mailing list