petdance/scratch — Issue #832: Failure due to missing external definition of inlined functions
Author: petdance
Created: 2011-11-14 06:02:00+00:00
State: open
Labels: bug, configure, Pri-major, Sev-medium

As of version RELEASE_2_11_0-902-gdce9186, attempting to build parrot with Sun's compiler under Linux fails with the following errors:
```
/tmp/parrot/blib/lib/libparrot.so: undefined reference to `Parrot_pmc_box_integer'
/tmp/parrot/blib/lib/libparrot.so: undefined reference to `Parrot_pmc_box_string'
/tmp/parrot/blib/lib/libparrot.so: undefined reference to `Parrot_pmc_box_number'
}}}

The problem is a reappearance of TT #1646. There really seem to be three separate issues:

1. The config::auto inline test does not test the inline keyword in the way that parrot ultimately uses it. (It specifies neither static nor external, and is in the same file as it is ultimately used.) It is relevant to note that gcc -std=c99 won't accept the current inline test files either. A correct test would test the way that inline is intended to actually be used. If parrot wants to assume that inline functions also have external linkage, then the tests should be written to test for this. Note that traditional GNU inline behavior is different from C99 behavior.
A good discussion of these issues is at
[http://www.greenend.org.uk/rjk/2003/03/inline.html]. (In perl 5, we test for and use only {{{ static inline }}}. Feel free to copy those tests.)

2. The result of the configure test is, in some cases, ignored anyway. Specifically, if the compiler passes the second test for {{{ __inline }}}, the following code in {{{ config/gen/config_h/feature_h.in }}} unconditionally uses a plain {{{ inline }}} anyway, even though Configure determined that didn't work:
{{{
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
# define PARROT_INLINE inline
# define PARROT_HAS_INLINE
#else
# define PARROT_INLINE
#endif
```

3. The functions above are never declared 'extern'.

Originally http://trac.parrot.org/parrot/ticket/1943